Question about JavaFX layouts

I am having problems with layouts in JavaFX. Consider the following code.

Stage {
    title: "ListView test"
    scene: Scene {
        width: 400
        height: 400
        content: [
            VBox {
                content: [
                    ListView {
                        height: 200
                        width: 200
                        items: ["item1", "item2"]
                    }
                ]
            }
        ]
    }
}

I was expecting the ListView to appear at 200 x 200, but no matter how I tried to fix it, the width and height of the ListView seemed fixed. But the following code works to display a ListView, as I expected.

Stage {
    title: "ListView test"
    scene: Scene {
        width: 400
        height: 400
        content: [
            ListView {
                height: 200
                width: 200
                items: ["item1", "item2"]
            }
        ]
    }
}

, ? ListView ?

+3
2

JavaFX 1.2.x node . "" ,

ListVIew {
    layoutInfo: LayoutInfo {width: 200, height: 200}
}

, . JavaFX Composer NetBeans, , , (, ).

Ad Broken: Java FX node , , /. , 1.2 - , .

+3

. , , , , - node , . LayoutInfo layoutInfo Node.

+1

Source: https://habr.com/ru/post/1740185/


All Articles