-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
8
-
None
-
Java8b129, Win7, ATI Radeon HD 4600
See the Stackoverflow question for a description, test case and work-around:
http://stackoverflow.com/questions/20732100/javafx-why-does-stage-setresizablefalse-cause-additional-margins
----------
Test code:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import javafx.scene.Group;
public class ResizableStageAutoSizingTest extends Application {
public static void main(final String[] args) {
launch(args);
}
@Override
public void start(final Stage primaryStage) throws Exception {
final Rectangle rectangle = new Rectangle(200, 100, Color.POWDERBLUE);
// if you use a Group, the content is in the top left corner with a white margins to the right and bottom.
final Scene scene = new Scene(new Group(rectangle));
// if you use a BorderPane instead of a Group, the content is centered with a white margins on all sides.
// final BorderPane pane = new BorderPane(rectangle);
// final Scene scene = new Scene(pane);
// if the stage is not resizable, it will be correctly sized.
// primaryStage.setResizable(false);
primaryStage.setScene(scene);
// workaround to fix issue.
// primaryStage.sizeToScene();
primaryStage.show();
}
}
http://stackoverflow.com/questions/20732100/javafx-why-does-stage-setresizablefalse-cause-additional-margins
----------
Test code:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import javafx.scene.Group;
public class ResizableStageAutoSizingTest extends Application {
public static void main(final String[] args) {
launch(args);
}
@Override
public void start(final Stage primaryStage) throws Exception {
final Rectangle rectangle = new Rectangle(200, 100, Color.POWDERBLUE);
// if you use a Group, the content is in the top left corner with a white margins to the right and bottom.
final Scene scene = new Scene(new Group(rectangle));
// if you use a BorderPane instead of a Group, the content is centered with a white margins on all sides.
// final BorderPane pane = new BorderPane(rectangle);
// final Scene scene = new Scene(pane);
// if the stage is not resizable, it will be correctly sized.
// primaryStage.setResizable(false);
primaryStage.setScene(scene);
// workaround to fix issue.
// primaryStage.sizeToScene();
primaryStage.show();
}
}
- duplicates
-
JDK-8089008 Win: Stage.setResizable(false) affects on component layout
- Open