Search in sources :

Example 6 with IllegalComponentStateException

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();
    }
}
Also used : IllegalComponentStateException(java.awt.IllegalComponentStateException) JPopupMenu(javax.swing.JPopupMenu)

Example 7 with IllegalComponentStateException

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;
}
Also used : Point(java.awt.Point) IllegalComponentStateException(java.awt.IllegalComponentStateException)

Aggregations

IllegalComponentStateException (java.awt.IllegalComponentStateException)7 Point (java.awt.Point)4 JPopupMenu (javax.swing.JPopupMenu)3 JMenuItem (javax.swing.JMenuItem)2 JSeparator (javax.swing.JSeparator)2 BasicZoomModel (com.cburch.logisim.gui.generic.BasicZoomModel)1 ZoomModel (com.cburch.logisim.gui.generic.ZoomModel)1 LightScrollPane (com.jsql.view.swing.scrollpane.LightScrollPane)1 TabHeader (com.jsql.view.swing.tab.TabHeader)1 Dimension (java.awt.Dimension)1 Clipboard (java.awt.datatransfer.Clipboard)1 StringSelection (java.awt.datatransfer.StringSelection)1 ActionEvent (java.awt.event.ActionEvent)1 FocusAdapter (java.awt.event.FocusAdapter)1 FocusEvent (java.awt.event.FocusEvent)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 IOException (java.io.IOException)1 EmptyStackException (java.util.EmptyStackException)1 Locale (java.util.Locale)1