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!)
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!)
- duplicates
-
JDK-8118469 Node clipNode changes not detected appropriately
- Resolved