<Swing Dev> RFR: 8048109: JToggleButton does not fire actionPerformed under certain conditions
Sergey Bylokhov
serb at openjdk.java.net
Wed Oct 14 01:56:15 UTC 2020
On Mon, 12 Oct 2020 08:01:43 GMT, Tejpal Rebari <trebari at openjdk.org> wrote:
> Please review the following fix for jdk16.
>
> Issue : There is a JToggleButton that will post/take down a JPopupMenu when the button is selected. If the button is
> selected and the menu is not posted the action listener will post the menu. If the button is selected and the menu is
> displayed the action listener will take the menu down. The use case is: 1 - select button 2 - menu posted
> 3 - select button
> 4 - menu taken down
>
> With MetalLookAndFeel the above use case works fine, but with WindowsLookAndFeel the second button selection does not
> fire the actionPerformed event, button needs to be selected third time for the menu to be taken down.
> The issue is that the button must be selected twice after the menu is posted to have the actionPerformed event to fire
> when using the Windows look and feel.
> Fix : MouseGrabber is not removed while uninstalling the listeners in the BasicPopupMenuUI.
> By removing the mouseGrabber in the uninstallListeners() methods fixes this issue.
>
> Added a test to test the same in all the LookAndFeels
Changes requested by serb (Reviewer).
test/jdk/javax/swing/JPopupMenu/SetInvokerJPopupMenuTest.java line 114:
> 112: }
> 113: }
> 114: if (popup.isVisible()) {
the popup is a Swing component, should be accessed on the EDT.
test/jdk/javax/swing/JPopupMenu/SetInvokerJPopupMenuTest.java line 82:
> 80:
> 81: f = new JFrame( );
> 82: f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Please move the frame to the center of the screen.
test/jdk/javax/swing/JPopupMenu/SetInvokerJPopupMenuTest.java line 145:
> 143: public void setVisible( boolean state ) {
> 144: if( !state ) {
> 145: Exception ex = new Exception();
It is unclear what is the purpose of this method?
-------------
PR: https://git.openjdk.java.net/jdk/pull/600
More information about the swing-dev
mailing list