-
Bug
-
Resolution: Unresolved
-
P4
-
9
please run the attached code; the output will be (Win. 7 + JDK9 b115):
JLabel: bound = true
>>> LISTENER: icon changed
BasicComboBoxRenderer: bound = true
>>> LISTENER: icon changed
DefaultListCellRenderer: bound = true
DefaultTableCellRenderer: bound = true
DefaultTreeCellRenderer: bound = true
At a 1st glance this looks confusing (reflection says that 'setIcon' is 'bound' for all the classes, but the listener doesn't receive events for the latter 3 classes); but then, looking into sources more carefully, one can find overriden ("for performance reasons") protected 'firePropertyChange' methods which filter out some chosen properties for the latter classes.
Shouldn't this JLabel's 'setIcon()' method be overriden explicitly in the child classes (calling the super's one) having the proper '@BeanProperty' annotation (having false 'bound' field)?
Otherwise we have some contradiction with reflection here.
(of course the example isn't limited with the icon property only. the same for other bound properties, like 'opaque', 'alignmentX', 'alignmentY' etc. so cleaning that out may be a boring procedure)
JLabel: bound = true
>>> LISTENER: icon changed
BasicComboBoxRenderer: bound = true
>>> LISTENER: icon changed
DefaultListCellRenderer: bound = true
DefaultTableCellRenderer: bound = true
DefaultTreeCellRenderer: bound = true
At a 1st glance this looks confusing (reflection says that 'setIcon' is 'bound' for all the classes, but the listener doesn't receive events for the latter 3 classes); but then, looking into sources more carefully, one can find overriden ("for performance reasons") protected 'firePropertyChange' methods which filter out some chosen properties for the latter classes.
Shouldn't this JLabel's 'setIcon()' method be overriden explicitly in the child classes (calling the super's one) having the proper '@BeanProperty' annotation (having false 'bound' field)?
Otherwise we have some contradiction with reflection here.
(of course the example isn't limited with the icon property only. the same for other bound properties, like 'opaque', 'alignmentX', 'alignmentY' etc. so cleaning that out may be a boring procedure)
- relates to
-
JDK-8156844 @BeanProperty: PropertyChangeEvent is not sent when changing JComponent's alignmentX and alignmentY bound properties
-
- Open
-
-
JDK-8156778 do not recieve PropertyChangeEvent for JTabbedPane's 'iconAt' and 'disabledIconAt' bound properties
-
- Open
-