-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8048109: JToggleButton does not fire actionPerformed under certain conditions #600
Conversation
👋 Welcome back trebari! A progress list of the required criteria for merging this PR into |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @psadhukhan-personal, thanks for making a comment in an OpenJDK project!
All comments and discussions in the OpenJDK Community must be made available under the OpenJDK Terms of Use. If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please Use "Add GitHub user psadhukhan-personal for the summary.
If you are not an OpenJDK Author, Committer or Reviewer, simply check the box below to accept the OpenJDK Terms of Use for your comments.
- I agree to the OpenJDK Terms of Use for all comments I make in a project in the OpenJDK GitHub organization.
Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use.
@trebari This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@prsadhuk looks like your comment was added using the wrong account. |
not wrong but different account but that doesnot make the comment invalid, I guess. |
But nobody sees it, it is hidden. |
Well, the comment was added on Oct 15 and it got hidden on Oct28 because the ac was not of github author/committer. I think the fix submitter should have seen the comment lying there for 2 weeks before it got hidden. |
I have seen the comment, it is not visible in github but its there in mailing-list. "It seems the effect is in WindowsLookAndFeel but you are fixing in Basic L&F. If the cause is in Basic L&F, then it the current fix doesn't looks correct so working on finding the correct fix. |
In case of the first attempt to bring down the popup menu the event was consumed by following code of BasicPopupMenuUI So changed PopupMenu.consumeEventOnClose to FALSE for Windows, Motif, Nimbus, and GTK LAF and |
Any idea why commenting popup.setInvoker(jtb); line in the test works even without the fix? |
In case of commenting popup.setInvoker(jtb); boolean consumeEvent =UIManager.getBoolean("PopupMenu.consumeEventOnClose"); So the event is not consumed here by me.consume() and the the issue is not seen. |
@trebari This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 1467 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
@mrserb please take a look. |
@@ -803,7 +803,7 @@ public Object createValue(UIDefaults table) { | |||
"PasswordField.font", new FontLazyValue(Region.PASSWORD_FIELD), | |||
|
|||
|
|||
"PopupMenu.consumeEventOnClose", Boolean.TRUE, | |||
"PopupMenu.consumeEventOnClose", Boolean.FALSE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This property was added to support some kind of "native" behavior.
The code from the BasicPopupMenuUI.java:
// Ask UIManager about should we consume event that closes
// popup. This made to match native apps behaviour.
boolean consumeEvent =
UIManager.getBoolean("PopupMenu.consumeEventOnClose");
// Consume the event so that normal processing stops.
if(consumeEvent && !(src instanceof MenuElement)) {
me.consume();
}
So after this fix, the mouse event that causes the popup to close will be not be dispatched to the next component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before the fix the mouse event that cause the popup to close was consumed here as the "PopupMenu.consumeEventOnClose" was true.
After the fix the mouse event that cause the popup to close will not be consumed here as "PopupMenu.consumeEventOnClose" is set to false in the fix for Windows, GTK, Nimbus and Motif LAF.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And does it match the native behavior? I mean different values of "consumeEventOnClose" weren't a bug. It was intentionally set to the appropriate value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah , i have checked in windows and ubuntu native apps and it is matching native behaviour.
The issue is seen in Motif, Nimbus, GTK and windows which sets consumeEventOnClose to true.
It is not seen in Metal And Aqua which doesn't set this variable and the value from BasicLookAndFeel.java is used which is false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you recheck that using the next usecase:
- Create menu in the frame
- Add jbutton to the frame exactly in the place where the menu popup is opened
- Open menu and click some menu item, will the jbutton be clicked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open menu and click some menu item, will the jbutton be clicked?
No, the JButton is not clicked in this use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, let's see how it will work.
/integrate |
@trebari Since your change was applied there have been 1468 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 65ca5c6. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
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
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/600/head:pull/600
$ git checkout pull/600