-
Bug
-
Resolution: Fixed
-
P4
-
7u11, 8, 9
-
b70
-
x86
-
linux
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8135910 | emb-9 | Unassigned | P4 | Resolved | Fixed | team |
JDK-8086936 | 8u65 | Anton Nashatyrev | P4 | Resolved | Fixed | b01 |
JDK-8081418 | 8u60 | Anton Nashatyrev | P4 | Resolved | Fixed | b18 |
JDK-8138024 | emb-8u65 | Unassigned | P4 | Resolved | Fixed | b01 |
JDK-8086217 | emb-8u60 | Anton Nashatyrev | P4 | Resolved | Fixed | team |
1.7.0_11-b21
ADDITIONAL OS VERSION INFORMATION :
Linux 2.6.32-5-amd64.
A DESCRIPTION OF THE PROBLEM :
Buttons on Linux do not release their 'pressed' state if the mouse button is released away from the button after using the mouse wheel.
From monitoring events, it seems that on Linux if you use the scroll wheel while the mouse is pressed then the mouse released event is sent to the component the mouse is over rather than the component it was pressed on. On Windows the event goes to the component the mouse was pressed on.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Note that these reproduction steps require that user monitors the console as this application prints via System.out.println.
1. Compile and run the simple UI attached.
2. Click on the 'JButton' and hold the left mouse button down, note that the application printed via System.out.println 'Currently pressed' per an override in the button UI.
3. Drag the mouse over another part of the UI, making sure to leave the button region.
4. Use the mouse wheel
5. Release the left mouse button
6. Notice the application never prints 'not pressed' as it would had you not used the mouse wheel in step #4.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Button releases, as it does on other platforms.
ACTUAL -
Button stays pressed
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.FlowLayout;
import java.awt.Graphics;
public class TestButton {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
/// Configure a JFrame with a JButton, with 'button pressed state' tracking.
JFrame frame = new JFrame();
frame.setLayout(new FlowLayout());
final JButton jButton = new JButton("JButton");
// Install UI as one solution to track 'button pressed' and 'button released' states.
jButton.setUI(new BasicButtonUI() {
@Override
public void paint(Graphics g, JComponent c) {
super.paint(g, c);
if (jButton.getModel().isPressed()) {
System.out.println("Currently pressed");
} else {
System.out.println("Not pressed");
}
}
});
frame.add(jButton);
frame.setVisible(true);
frame.pack();
}
});
}
}
---------- END SOURCE ----------
- backported by
-
JDK-8081418 JButtons stay pressed after they have lost focus if you use the mouse wheel
-
- Resolved
-
-
JDK-8086217 JButtons stay pressed after they have lost focus if you use the mouse wheel
-
- Resolved
-
-
JDK-8086936 JButtons stay pressed after they have lost focus if you use the mouse wheel
-
- Resolved
-
-
JDK-8135910 JButtons stay pressed after they have lost focus if you use the mouse wheel
-
- Resolved
-
-
JDK-8138024 JButtons stay pressed after they have lost focus if you use the mouse wheel
-
- Resolved
-
- duplicates
-
JDK-8074495 JButtons stay pressed after they have lost focus if you use the mouse wheel
-
- Closed
-
-
JDK-8081035 Dispatch contract for MOUSE_DRAGGED events violated using mouse wheel on
-
- Closed
-
- relates to
-
JDK-8130471 [Regression] Test java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java fails
-
- Resolved
-