FULL PRODUCT VERSION :
java version " 1.7.0_40-ea "
Java(TM) SE Runtime Environment (build 1.7.0_40-ea-b29)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b48, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Mac OS X 10.8.4
A DESCRIPTION OF THE PROBLEM :
First the following stack-traces showing the lock-up:
Name: AWT-EventQueue-0
State: RUNNABLE
Total blocked: 1,661 Total waited: 4,625
Stack trace:
sun.lwawt.macosx.CPlatformView.nativeIsViewUnderMouse(Native Method)
sun.lwawt.macosx.CPlatformView.isUnderMouse(CPlatformView.java:173)
sun.lwawt.macosx.CPlatformWindow.isUnderMouse(CPlatformWindow.java:869)
sun.lwawt.macosx.CMouseInfoPeer.isWindowUnderMouse(CMouseInfoPeer.java:43)
java.awt.Component.findUnderMouseInWindow(Component.java:1325)
java.awt.Component.getMousePosition(Component.java:1377)
- locked java.awt.Component$AWTTreeLock@4186b506
com.ls.cockpit.avc.uif_lite.MouseDraggingCursorInfo.display(MouseDraggingCursorInfo.java:86)
com.ls.cockpit.avc.uif_lite.MouseDraggingCursorInfo$1.eventDispatched(MouseDraggingCursorInfo.java:62)
java.awt.Toolkit$SelectiveAWTEventListener.eventDispatched(Toolkit.java:2430)
java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2322)
java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2321)
java.awt.Toolkit.notifyAWTEventListeners(Toolkit.java:2280)
java.awt.Component.dispatchEventImpl(Component.java:4757)
java.awt.Container.dispatchEventImpl(Container.java:2287)
java.awt.Component.dispatchEvent(Component.java:4687)
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:4620)
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4474)
java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
java.awt.Container.dispatchEventImpl(Container.java:2273)
java.awt.Window.dispatchEventImpl(Window.java:2719)
java.awt.Component.dispatchEvent(Component.java:4687)
java.awt.EventQueue.dispatchEventImpl(EventQueue.java:729)
java.awt.EventQueue.access$200(EventQueue.java:103)
java.awt.EventQueue$3.run(EventQueue.java:688)
java.awt.EventQueue$3.run(EventQueue.java:686)
java.security.AccessController.doPrivileged(Native Method)
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
java.awt.EventQueue$4.run(EventQueue.java:702)
java.awt.EventQueue$4.run(EventQueue.java:700)
java.security.AccessController.doPrivileged(Native Method)
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
java.awt.EventQueue.dispatchEvent(EventQueue.java:699)
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Name: AWT-AppKit
State: BLOCKED on java.awt.Component$AWTTreeLock@4186b506 owned by: AWT-EventQueue-0
Total blocked: 118 Total waited: 152
Stack trace:
java.awt.Component.getLocationOnScreen(Component.java:2018)
javax.swing.SwingUtilities.convertPointFromScreen(SwingUtilities.java:422)
sun.lwawt.macosx.CDragSourceContextPeer.dragMouseMoved(CDragSourceContextPeer.java:424)
Description of what we are doing:
In our Swing client we have 3 tables, each containing different items. By dragging on item from one table onto an item from another table, the user can invoke an action.
To make it easier for the user to realize what is going on, we show a mouse tool-tip while dragging the object. The implementation of this tool-tip looks approximately like this:
public class MouseDraggingCursorInfo
extends JComponent
{
protected int x;
protected int y;
protected String s;
private JFrame mainWindow;
public MouseDraggingCursorInfo(final JFrame mainWindow)
{
this.mainWindow = mainWindow;
JLayeredPane layeredPane = mainWindow.getRootPane().getLayeredPane();
layeredPane.add(this, JLayeredPane.DRAG_LAYER);
this.setBounds(0, 0, mainWindow.getWidth(), mainWindow.getHeight());
this.setVisible(false);
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
@Override
public void eventDispatched(AWTEvent e)
{
if (e instanceof MouseEvent) {
display(null);
}
}
}, AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
}
protected void display()
{
setVisible(true);
repaint();
}
public void display(final String string)
{
Point pos = mainWindow.getMousePosition();
if (pos != null && string != null) {
int oldx = MouseDraggingCursorInfo.this.x;
int oldy = MouseDraggingCursorInfo.this.y;
if (oldx != pos.x + 15 || oldy != pos.y || s != string) {
MouseDraggingCursorInfo.this.s = string;
MouseDraggingCursorInfo.this.x = pos.x + 15;
MouseDraggingCursorInfo.this.y = pos.y;
MouseDraggingCursorInfo.this.display();
}
} else {
setVisible(false);
}
}
@Override
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
if (s != null) {
g.setFont(g.getFont());
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
int width = g.getFontMetrics().stringWidth(s);
int hight = g.getFontMetrics().getHeight();
g.setColor(new Color(255, 255, 255, 240));
g.fillRect(x - 5, y - hight, width + 10, hight + 6);
g.setColor(Color.black);
g.drawString(s, x, y);
}
}
}
The display method is called from the TransferHandler, which makes the decision on what tool-tip text (input to the display method) should be displayed to the user.
REGRESSION. Last worked in version 7u25
REPRODUCIBILITY :
This bug can be reproduced often.