java - 哪个相当于 javaFX 中的 JLayeredPane?

标签 java javafx jlayeredpane

在 swing 中我们有 JlayeredPane,这与 javafx 中的等效吗? 以这段代码为例:

    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);

如何在javafx中进行翻译?

最佳答案

Swing JLayeredPane 的等效项是 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.

其中“子列表”是指由 StackPane.getChildren() 返回的 ObservableList

关于java - 哪个相当于 javaFX 中的 JLayeredPane?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27689303/

相关文章:

java - JLayeredPane 和 GridBagConstraints

java - 哪个类继承了Java的main方法?

java - 如何设置 ListView 中项目的背景颜色

java - 如何在 JavaFX 线程之外更新 TableView 项目

java - 如何使打开的窗口必须先关闭才能返回主窗口?

java - 如何在 JavaFX 中制作 TimeSpinner?

java - 使用 MigLayout 时, `add` 的第三个 int 参数将如何影响布局?

java - JLayeredPane 中的 JScrollPane 没有重绘?

java - 错误 : androidmanifest. xml 文件丢失 --> 我错过了什么?

java - 通过 XML 与服务器和 Android 客户端通信