JavaFX suggestions from Alex Kishko

Aliaksei Kishko alexkishko at
Fri Feb 21 08:36:58 PST 2014


I allow me to express several opinions on the JavaFX:

1) JavaFX need interfaces - many controls have similar methods, but not
interface: for example ComboBox, ChoiceBox, MenuButton, Menu, ContextMenu
have the method void hide(), but no inherited interface. The ComboBox and
ChoiceBox seem similar as a list wrapper, but no common list interface.

2) The abstract class Parent has private ObservableList<Node> children and
protected ObservableList<Node> getChildren(), but ChoiceBox, ComboBox,
SplitMenuButton, GridPane, Accordion, TabPane, ScrollPane etc.  - they all
are Parent too, but don't use children and have different containers:
children, items, panes,  content etc... I would like to have one way to get

3) The class MenuItem need be Node, because has a lot of same methods.

I can't use these classes in utility methods or factory class. I must write
so long checker:

If (control instanceof ChoiceBox){
   ((ChoiceBox) control).getItems()...
} else If (control instanceof Accordion){
   ((ChoiceBox) control).getTabs()...
} ...

It is ineffectively.

4) All of Number property classes, for example IntegerProperty,
FloatProperty, DoubleProperty etc   implement Property<Number>... Why not
<Integer>, <Float>, <Double> etc.?
I can't use it in collaboration with StringConverter<Number> - I need use
accordingly StringConverter<Integer>, StringConverter<Float>,

5) Styles need get pseudo classes via setStyle(), for example:
menuItem.setStyle(":focused {-fx-background-color: yellow;}");

6) Custom properties need be realized in easier manner as pseudo classes
and StyleableProperty inheritance. In my prototype I use my own wrapper,
but I think that it need be a part of JavaFX.

I have some more suggestions, if it is interesting I write further.

More information about the openjfx-dev mailing list