The TableView
class of JavaFX 2.2 has a generic type S
, I am wondering how one can set this from FXML?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Normally I would agree with the replies here, but when you are using Scene Builder to develop your GUIs and then wish to import the skeleton controller parts into your code for the updates you have made it is really annoying to have to remember to go back and replace all of the [?] and [?, ?] with the actual class names. It would be nice if either the FXML spec or Scene Builder allowed you to specify the template classes.
FXML is dynamically loaded at runtime. Since generic types are erased at compile time, it doesn't make sense to define them in markup. Defining the generic in the controller class is correct.
The same happens to a ListView or ComboBox. But I think that in the FXML file you are defining the controls and you are defining a generic ListView or a ComboBox or TableView or whatever. No matter what they are going to show.
So to me it makes more sense to set the generic type in the JavaFX controller class, instead of in the FXML file.
Hope it helps.