src/macosx/classes/com/apple/laf/ScreenMenu.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -30,10 +30,11 @@
import java.awt.peer.MenuComponentPeer;
import java.util.Hashtable;
import javax.swing.*;
+import sun.awt.SunToolkit;
import sun.lwawt.LWToolkit;
import sun.lwawt.macosx.*;
class ScreenMenu extends Menu implements ContainerListener, ComponentListener, ScreenMenuPropertyHandler {
static {
@@ -142,11 +143,11 @@
invoker.setSelected(true);
invoker.validate();
updateItems();
fItemBounds = new Rectangle[invoker.getMenuComponentCount()];
}
- }, null);
+ }, invoker);
} catch (final Exception e) {
System.err.println(e);
e.printStackTrace();
}
}
@@ -170,11 +171,11 @@
}
}
fItemBounds = null;
}
- }, null);
+ }, invoker);
} catch (final Exception e) {
e.printStackTrace();
}
}
@@ -198,11 +199,11 @@
*/
public void handleMouseEvent(final int kind, final int x, final int y, final int modifiers, final long when) {
if (kind == 0) return;
if (fItemBounds == null) return;
- SwingUtilities.invokeLater(new Runnable() {
+ SunToolkit.executeOnEventHandlerThread(fInvoker, new Runnable() {
@Override
public void run() {
Component target = null;
Rectangle targetRect = null;
for (int i = 0; i < fItemBounds.length; i++) {