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

TitledPane not rendered appropriately when added on none first Tab

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 8
    • 8
    • javafx
    • None

      When adding a TitledPane which has to grow when the window is resized it looks like its clip is not updated appropriately and so hiding parts of its content.

      package at.bestsolution.efxclipse.runtime.examples.swt;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Tab;
      import javafx.scene.control.TabPane;
      import javafx.scene.control.TextField;
      import javafx.scene.control.TitledPane;
      import javafx.scene.layout.HBox;
      import javafx.scene.layout.Priority;
      import javafx.stage.Stage;

      public class SimpleApp extends Application {

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

      @Override
      public void start(Stage primaryStage) throws Exception {
      TabPane tb = new TabPane();

      {
      Tab ti = new Tab();
      ti.setText("B1");
      ti.setClosable(false);
      tb.getTabs().add(ti);

      HBox hb = new HBox();
      {
      TitledPane tp = new TitledPane();
      tp.setText("T1");
      HBox.setHgrow(tp, Priority.ALWAYS);
      hb.getChildren().add(tp);

      HBox internal = new HBox();
      TextField tf = new TextField("Bla Bla");
      HBox.setHgrow(tf, Priority.ALWAYS);
      internal.getChildren().add(tf);
      tp.setContent(internal);
      }

      TitledPane tp2 = new TitledPane();
      tp2.setText("T2");
      hb.getChildren().add(tp2);

      ti.setContent(hb);
      }

      {
      Tab ti = new Tab();
      ti.setText("B2");
      ti.setClosable(false);
      tb.getTabs().add(ti);

      HBox hb = new HBox();
      {
      TitledPane tp = new TitledPane();
      tp.setText("T1");
      HBox.setHgrow(tp, Priority.ALWAYS);
      hb.getChildren().add(tp);

      HBox internal = new HBox();
      TextField tf = new TextField("Bla Bla");
      HBox.setHgrow(tf, Priority.ALWAYS);
      internal.getChildren().add(tf);
      tp.setContent(internal);
      }

      TitledPane tp2 = new TitledPane();
      tp2.setText("T2");
      hb.getChildren().add(tp2);

      ti.setContent(hb);
      }

      Scene s = new Scene(tb, 400, 400);
      primaryStage.setScene(s);
      primaryStage.show();
      }

      }


      To see the effect. Switch on the 2nd Tab and enlarge the window (same code on 1st Tab works as expected!)

            jgiles Jonathan Giles
            tschindl Tom Schindl
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: