JavaFX layouts question.

Posted by Jhonghee on Stack Overflow See other posts from Stack Overflow or by Jhonghee
Published on 2010-04-07T15:48:11Z Indexed on 2010/04/11 10:13 UTC
Read the original article Hit count: 358

Filed under:
|
|
|
|

I am having some problem understanding layouts in JavaFX. Consider 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 ListView showing up in 200 x 200 dimension but no matter how I tried to fix this, the width and height of ListView seemed fixed. But following code works for showing ListView as I intended.

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

So, what is the problem here? I cannot use ListView within layouts?

© Stack Overflow or respective owner

Related posts about javafx

Related posts about listview