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

Prasanta Sadhukhan psadhukhan at openjdk.org
Mon Aug 1 11:12:43 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

This pull request has now been integrated.

Changeset: f5d1b5bd
Author:    Prasanta Sadhukhan <psadhukhan at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/f5d1b5bda27c798347ae278cbf69725ed4be895c
Stats:     64 lines in 2 files changed: 62 ins; 0 del; 2 mod

6463708: DefaultButtonModel.setMnemonic generates ChangeEvent for no change

Reviewed-by: azvegint, prr

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

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



More information about the client-libs-dev mailing list