• Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 7u10
    • Fix Version/s: 8
    • Component/s: javafx
    • Labels:
    • Environment:

      Ubuntu 12.10


      If I set the stage's dimensions then show it, the controls and layouts are sized appropriately to fit it.

      But if I switch the scene later, the new scene's layouts are sized at their defaults instead of the stage's current dimensions. If I resize the window with the mouse after switching the scene, the layout ends up getting adjusted to the stage's new dimensions accordingly. This seems a little inconsistent.

      The application below demonstrates this if you click the button to switch the scene:

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.TextArea;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.paint.Color;
      import javafx.stage.Stage;

      public class Main extends Application {
          public void start(final Stage primaryStage) {
              BorderPane root = new BorderPane();
              //Top of the scene.
              Button button = new Button("Click Me!");
              button.setOnAction(new EventHandler<ActionEvent>() {
                  public void handle(ActionEvent t) {
                      BorderPane root = new BorderPane();
                      TextArea textArea = new TextArea();
                      textArea.setText("Hello World!");
                      Scene scene = new Scene(root);
              TextArea textArea = new TextArea();
              textArea.setText("Hello World!");
              Scene scene = new Scene(root, 300, 250);
              primaryStage.setTitle("Hello World!");

           * The main() method is ignored in correctly deployed JavaFX application.
           * main() serves only as fallback in case the application can not be
           * launched through deployment artifacts, e.g., in IDEs with limited FX
           * support. NetBeans ignores main().
           * @param args the command line arguments
          public static void main(String[] args) {




            • Assignee:
              msladecek Martin Sládeček
              hwagnerjfx Hans Wagner (Inactive)
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: