JavaFX layouts question.
- by Jhonghee
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?