RFR: 6463708: DefaultButtonModel.setMnemonic generates ChangeEvent for no change

Phil Race prr at openjdk.org
Fri Jul 22 19:04:02 UTC 2022


On Mon, 18 Jul 2022 08:42:06 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

> For a DefaultButtonModel, setMnemonic() generates a ChangeEvent even if the new value is the same as the old value (that is, even if nothing has changed). 
> Fix is to fire StateChange event only if the value has changed. 
> 
> This is consistent with other places like 
> https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/colorchooser/DefaultColorSelectionModel.java#L103
> https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/DefaultSingleSelectionModel.java#L79
> https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/DefaultBoundedRangeModel.java#L309

Marked as reviewed by prr (Reviewer).

-------------

PR: https://git.openjdk.org/jdk/pull/9536



More information about the client-libs-dev mailing list