-
Bug
-
Resolution: Unresolved
-
P4
-
8u20
If I set a Node, which is managed==false, as the graphic of a Tab and later setManaged(true), it doesn't show up as the graphic of the Tab.
Run the code and click the button, which sets managed(true) and visible(true) on the graphic.
Nonetheless nothing happens.
It only works, if the graphic is managed==true, when it is added, but then the total place for the invisible graphic is reserved, which I am trying to avoid.
Tested with 8u40-ea.
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.Tab;
import javafx.scene.control.TabPane;
import javafx.stage.Stage;
public class TestApp2 extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(final Stage stage) throws Exception {
Button graphic = new Button("XXX");
graphic.setVisible(false);
graphic.setManaged(false);
TabPane tabPane = new TabPane();
Tab tab = new Tab("Test Tab");
tab.setGraphic(graphic);
Button button = new Button("Click me, to show graphic");
button.setOnAction(event -> {
graphic.setVisible(true);
graphic.setManaged(true);
// Expected behavior here: The button shows up as the Tab graphic.
});
tab.setContent(button);
tabPane.getTabs().add(tab);
Scene scene = new Scene(tabPane);
stage.setScene(scene);
stage.show();
}
}
Run the code and click the button, which sets managed(true) and visible(true) on the graphic.
Nonetheless nothing happens.
It only works, if the graphic is managed==true, when it is added, but then the total place for the invisible graphic is reserved, which I am trying to avoid.
Tested with 8u40-ea.
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.Tab;
import javafx.scene.control.TabPane;
import javafx.stage.Stage;
public class TestApp2 extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(final Stage stage) throws Exception {
Button graphic = new Button("XXX");
graphic.setVisible(false);
graphic.setManaged(false);
TabPane tabPane = new TabPane();
Tab tab = new Tab("Test Tab");
tab.setGraphic(graphic);
Button button = new Button("Click me, to show graphic");
button.setOnAction(event -> {
graphic.setVisible(true);
graphic.setManaged(true);
// Expected behavior here: The button shows up as the Tab graphic.
});
tab.setContent(button);
tabPane.getTabs().add(tab);
Scene scene = new Scene(tabPane);
stage.setScene(scene);
stage.show();
}
}