Emax
Emax

Reputation: 1403

Which is the equivalent of JLayeredPane in javaFX?

In the swing we have the JlayeredPane, which is the equivalent in javafx? Take this code for example:

    JLayeredPane panel = new JLayeredPane();
    
    JLabel test1 = new JLabel("Test 1");
    JLabel test2 = new JLabel("Test 2");
    
    panel.setLayer(test1, 0);
    panel.add(test1);
    
    panel.setLayer(test2, 1);
    panel.add(test2);

How can be translate in javafx?

Upvotes: 2

Views: 1029

Answers (1)

eckig
eckig

Reputation: 11134

The equivalent of the Swing JLayeredPane would be the StackPane.

The z-order of the children is defined by the order of the children list with the 0th child being the bottom and last child on top. If a border and/or padding have been set, the children will be layed out within those insets.

Where "children list" means the ObservableList returned by StackPane.getChildren().

Upvotes: 3

Related Questions