use of java.awt.IllegalComponentStateException in project omegat by omegat-org.
the class SegmentPropertiesArea method showContextMenu.
void showContextMenu(Point p) {
JPopupMenu menu = new JPopupMenu();
populateLocalContextMenuOptions(menu, p);
// populateGlobalContextMenuOptions(menu);
try {
menu.show(scrollPane, p.x, p.y);
} catch (IllegalComponentStateException e) {
e.printStackTrace();
}
}
use of java.awt.IllegalComponentStateException in project lwjgl by LWJGL.
the class AWTUtil method getCursorPosition.
/**
* Use the 1.5 API to get the cursor position relative to the component. Return null
* if it fails (JDK <= 1.4).
*/
public static Point getCursorPosition(Component component) {
try {
Point pointer_location = getPointerLocation(component);
if (pointer_location != null) {
Point location = component.getLocationOnScreen();
pointer_location.translate(-location.x, -location.y);
pointer_location.move(pointer_location.x, transformY(component, pointer_location.y));
return pointer_location;
}
} catch (IllegalComponentStateException e) {
LWJGLUtil.log("Failed to set cursor position: " + e);
} catch (NoClassDefFoundError e) {
// Not JDK 1.5
LWJGLUtil.log("Failed to query cursor position: " + e);
}
return null;
}
Aggregations