Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8094853

TabPane doesn't track its content size

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • 9
    • 7u6
    • javafx
    • 2.2.0b19

      Look at the code and the attached movie.

      Initially, when I create TabPane, its size respond to the size of control, which is in its tab. But, when I start to change its size, TabPane doesn't track it any more.

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.Slider;
      import javafx.scene.control.Tab;
      import javafx.scene.control.TabPane;
      import javafx.scene.layout.Pane;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class JavaApplication59 extends Application {

          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage stage) throws Exception {
              Button b = new Button("Some button");
              
              Slider slider = new Slider(0, 200, 100);
              slider.setShowTickLabels(true);
              slider.setShowTickMarks(true);
              b.minWidthProperty().bind(slider.valueProperty());
              
              Pane pane = new Pane();
              pane.setMinSize(200, 200);
              pane.setPrefSize(200, 200);
              pane.setMaxSize(200, 200);
              
              Tab tab = new Tab();
              tab.setContent(b);
              
              TabPane tp = new TabPane();
              tp.getTabs().add(tab);
              
              pane.getChildren().add(tp);
              
              VBox vb = new VBox();
              vb.getChildren().addAll(pane, slider);
              Scene scene = new Scene(vb, 300, 300);
              stage.setScene(scene);
              stage.show();
          }
      }

      On movie: I added button in tab in tabPane. I showed their widths. After that I changed width of button. But TabPane's size didn;t change.

      This lead to the situation, when I have ScrollPane in Tab in TabPane in HBox, and TabPane is compressed, because it doesn't know anything about ScrollPane's size, especially when I set size of scrollPane according to scrollPane's content size.

            msladecek Martin Sládeček
            akirov Alexander Kirov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: