Java 类java.awt.IllegalComponentStateException 实例源码

项目:jaer    文件:WindowSaver.java   
/**
     * This static method can be used to save the window x,y, position (but not
     * size). This statis method saves the window origin but not the size, based
     * on a classname-based key in the supplied preferences node.
     *
     * @param window the window to save for
     * @param prefs user preferences node
     * @see #restoreWindowLocation
     */
    public static void saveWindowLocation(Window window, Preferences prefs) {
        String name = window.getClass().getName();
        Point p = new Point(0, 0);
        try {
            p = window.getLocationOnScreen();
        } catch (IllegalComponentStateException e) {
            p = window.getLocation();
        }
        prefs.putInt(name + ".XPosition", (int) p.getX());
        prefs.putInt(name + ".YPosition", (int) p.getY());
//        log.info("saved location for window "+name);
    }
项目:SimBionic    文件:SB_Autocomplete.java   
public void setLocation(JTextField textField){
 Container container = textField.getParent();
 while (container != null && !(container instanceof Window))
    container = container.getParent();

 int offset = 0;
 if (container instanceof JFrame) {
    ((JFrame)container).setGlassPane(this);
    offset = 4;
 }
 else if (container instanceof JDialog)
    ((JDialog)container).setGlassPane(this);

 try{
    Point textFieldLocation = textField.getLocationOnScreen();
    Point windowLocation = container.getLocationOnScreen();
    list.setLocation(textFieldLocation.x - windowLocation.x, textFieldLocation.y - windowLocation.y + offset);
    completionList.setLocation(textFieldLocation.x - windowLocation.x, textFieldLocation.y - windowLocation.y + offset);
 }
 catch (IllegalComponentStateException ex){
    // TODO
 }
}
项目:Zettelkasten    文件:SearchResultsFrame.java   
/**
 * This method activates the fullscreen-mode, if it's not already activated yet. To have a 
 * fullscreen-window without decoration, the frame is disposed first, then the decoration
 * will be removed and the window made visible again.
 */
private void showFullScreen() {
    // check whether fullscreen is supported, and if we currently have a fullscreen-window
    if (graphicdevice.isFullScreenSupported() && null==graphicdevice.getFullScreenWindow()) {
        // dispose frame, so we can remove the decoration when setting full screen mode
        searchframe.dispose();
        // hide menubar
        searchMenuBar.setVisible(false);
        // set frame non-resizable
        searchframe.setResizable(false);
        try {
            // remove decoration
            searchframe.setUndecorated(true);
        }
        catch (IllegalComponentStateException e) {
            Constants.zknlogger.log(Level.SEVERE,e.getLocalizedMessage());
        }
        // show frame again
        searchframe.setVisible(true);
        // set fullscreen mode to this window
        graphicdevice.setFullScreenWindow(this);
    }
}
项目:Zettelkasten    文件:SearchResultsFrame.java   
/**
 * This method <i>de</i>activates the fullscreen-mode, if it's not already deactivated yet.
 */
private void quitFullScreen() {
    // check whether fullscreen is supported, and if we currently have a fullscreen-window
    if (graphicdevice.isFullScreenSupported() && graphicdevice.getFullScreenWindow()!=null) {
        // disable fullscreen-mode
        graphicdevice.setFullScreenWindow(null);
        // hide menubar
        searchMenuBar.setVisible(true);
        // make frame resizable again
        searchframe.setResizable(true);
        // dispose frame, so we can restore the decoration
        searchframe.dispose();
        try {
            // set decoration
            searchframe.setUndecorated(false);
        }
        catch (IllegalComponentStateException e) {
            Constants.zknlogger.log(Level.SEVERE,e.getLocalizedMessage());
        }
        // show frame again
        searchframe.setVisible(true);
    }
}
项目:Zettelkasten    文件:DesktopFrame.java   
/**
 * This method activates the fullscreen-mode, if it's not already activated
 * yet. To have a fullscreen-window without decoration, the frame is
 * disposed first, then the decoration will be removed and the window made
 * visible again.
 */
private void showFullScreen() {
    // check whether fullscreen is supported, and if we currently have a fullscreen-window
    if (graphicdevice.isFullScreenSupported() && null == graphicdevice.getFullScreenWindow()) {
        // dispose frame, so we can remove the decoration when setting full screen mode
        mainframe.dispose();
        // hide menubar
        jMenuBarDesktop.setVisible(false);
        // set frame non-resizable
        mainframe.setResizable(false);
        try {
            // remove decoration
            mainframe.setUndecorated(true);
        } catch (IllegalComponentStateException e) {
            Constants.zknlogger.log(Level.SEVERE, e.getLocalizedMessage());
        }
        // show frame again
        mainframe.setVisible(true);
        // set fullscreen mode to this window
        graphicdevice.setFullScreenWindow(this);
    }
}
项目:Zettelkasten    文件:DesktopFrame.java   
/**
 * This method <i>de</i>activates the fullscreen-mode, if it's not already
 * deactivated yet.
 */
private void quitFullScreen() {
    // check whether fullscreen is supported, and if we currently have a fullscreen-window
    if (graphicdevice.isFullScreenSupported() && graphicdevice.getFullScreenWindow() != null) {
        // disable fullscreen-mode
        graphicdevice.setFullScreenWindow(null);
        // hide menubar
        jMenuBarDesktop.setVisible(true);
        // make frame resizable again
        mainframe.setResizable(true);
        // dispose frame, so we can restore the decoration
        mainframe.dispose();
        try {
            // set decoration
            mainframe.setUndecorated(false);
        } catch (IllegalComponentStateException e) {
            Constants.zknlogger.log(Level.SEVERE, e.getLocalizedMessage());
        }
        // show frame again
        mainframe.setVisible(true);
    }
}
项目:OpenSDI-Manager2    文件:TransformAction.java   
@Override
public void executeAction(WorkflowContext ctx) {
    //configure a new transformer for execution
    SpelObjectTranformer t = new SpelObjectTranformer();
    if(getConfiguration() == null){
        throw new IllegalComponentStateException();
    }
    configureTransformer(t);

    TransformConfiguration config = (TransformConfiguration) getConfiguration();
    if(config !=null){
        Object input =null;
        //set input object to the configured one or with the context
        if(config.getInputObjectId()!=null){
            input = ctx.getContextElement(config.getInputObjectId());
        }else{
            input = ctx;
        }
        t.setOutputObject(ctx.getContextElement(config.getOutputObjectId()));
        Object output = t.transform(input);
        ctx.addContextElement(config.getOutputObjectId(), output);
    }
}
项目:OpenJSharp    文件:SunDisplayChanger.java   
public void notifyListeners() {
    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        log.finest("notifyListeners");
    }
// This method is implemented by making a clone of the set of listeners,
// and then iterating over the clone.  This is because during the course
// of responding to a display change, it may be appropriate for a
// DisplayChangedListener to add or remove itself from a SunDisplayChanger.
// If the set itself were iterated over, rather than a clone, it is
// trivial to get a ConcurrentModificationException by having a
// DisplayChangedListener remove itself from its list.
// Because all display change handling is done on the event thread,
// synchronization provides no protection against modifying the listener
// list while in the middle of iterating over it.  -bchristi 7/10/2001

    Set<DisplayChangedListener> cloneSet;

    synchronized(listeners) {
        cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
    }

    Iterator<DisplayChangedListener> itr = cloneSet.iterator();
    while (itr.hasNext()) {
        DisplayChangedListener current = itr.next();
        try {
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest("displayChanged for listener: " + current);
            }
            current.displayChanged();
        } catch (IllegalComponentStateException e) {
            // This DisplayChangeListener is no longer valid.  Most
            // likely, a top-level window was dispose()d, but its
            // Java objects have not yet been garbage collected.  In any
            // case, we no longer need to track this listener, though we
            // do need to remove it from the original list, not the clone.
            listeners.remove(current);
        }
    }
}
项目:OpenJSharp    文件:SunDisplayChanger.java   
public void notifyPaletteChanged() {
    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        log.finest("notifyPaletteChanged");
    }
// This method is implemented by making a clone of the set of listeners,
// and then iterating over the clone.  This is because during the course
// of responding to a display change, it may be appropriate for a
// DisplayChangedListener to add or remove itself from a SunDisplayChanger.
// If the set itself were iterated over, rather than a clone, it is
// trivial to get a ConcurrentModificationException by having a
// DisplayChangedListener remove itself from its list.
// Because all display change handling is done on the event thread,
// synchronization provides no protection against modifying the listener
// list while in the middle of iterating over it.  -bchristi 7/10/2001

    Set<DisplayChangedListener> cloneSet;

    synchronized (listeners) {
        cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
    }
    Iterator<DisplayChangedListener> itr = cloneSet.iterator();
    while (itr.hasNext()) {
        DisplayChangedListener current = itr.next();
        try {
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest("paletteChanged for listener: " + current);
            }
            current.paletteChanged();
        } catch (IllegalComponentStateException e) {
            // This DisplayChangeListener is no longer valid.  Most
            // likely, a top-level window was dispose()d, but its
            // Java objects have not yet been garbage collected.  In any
            // case, we no longer need to track this listener, though we
            // do need to remove it from the original list, not the clone.
            listeners.remove(current);
        }
    }
}
项目:jdk8u-jdk    文件:SunDisplayChanger.java   
public void notifyListeners() {
    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        log.finest("notifyListeners");
    }
// This method is implemented by making a clone of the set of listeners,
// and then iterating over the clone.  This is because during the course
// of responding to a display change, it may be appropriate for a
// DisplayChangedListener to add or remove itself from a SunDisplayChanger.
// If the set itself were iterated over, rather than a clone, it is
// trivial to get a ConcurrentModificationException by having a
// DisplayChangedListener remove itself from its list.
// Because all display change handling is done on the event thread,
// synchronization provides no protection against modifying the listener
// list while in the middle of iterating over it.  -bchristi 7/10/2001

    Set<DisplayChangedListener> cloneSet;

    synchronized(listeners) {
        cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
    }

    Iterator<DisplayChangedListener> itr = cloneSet.iterator();
    while (itr.hasNext()) {
        DisplayChangedListener current = itr.next();
        try {
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest("displayChanged for listener: " + current);
            }
            current.displayChanged();
        } catch (IllegalComponentStateException e) {
            // This DisplayChangeListener is no longer valid.  Most
            // likely, a top-level window was dispose()d, but its
            // Java objects have not yet been garbage collected.  In any
            // case, we no longer need to track this listener, though we
            // do need to remove it from the original list, not the clone.
            listeners.remove(current);
        }
    }
}
项目:jdk8u-jdk    文件:SunDisplayChanger.java   
public void notifyPaletteChanged() {
    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        log.finest("notifyPaletteChanged");
    }
// This method is implemented by making a clone of the set of listeners,
// and then iterating over the clone.  This is because during the course
// of responding to a display change, it may be appropriate for a
// DisplayChangedListener to add or remove itself from a SunDisplayChanger.
// If the set itself were iterated over, rather than a clone, it is
// trivial to get a ConcurrentModificationException by having a
// DisplayChangedListener remove itself from its list.
// Because all display change handling is done on the event thread,
// synchronization provides no protection against modifying the listener
// list while in the middle of iterating over it.  -bchristi 7/10/2001

    Set<DisplayChangedListener> cloneSet;

    synchronized (listeners) {
        cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
    }
    Iterator<DisplayChangedListener> itr = cloneSet.iterator();
    while (itr.hasNext()) {
        DisplayChangedListener current = itr.next();
        try {
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest("paletteChanged for listener: " + current);
            }
            current.paletteChanged();
        } catch (IllegalComponentStateException e) {
            // This DisplayChangeListener is no longer valid.  Most
            // likely, a top-level window was dispose()d, but its
            // Java objects have not yet been garbage collected.  In any
            // case, we no longer need to track this listener, though we
            // do need to remove it from the original list, not the clone.
            listeners.remove(current);
        }
    }
}
项目:jdk8u-jdk    文件:Util.java   
public static void waitTillShownEx(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
项目:openjdk-jdk10    文件:SunDisplayChanger.java   
public void notifyListeners() {
    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        log.finest("notifyListeners");
    }
// This method is implemented by making a clone of the set of listeners,
// and then iterating over the clone.  This is because during the course
// of responding to a display change, it may be appropriate for a
// DisplayChangedListener to add or remove itself from a SunDisplayChanger.
// If the set itself were iterated over, rather than a clone, it is
// trivial to get a ConcurrentModificationException by having a
// DisplayChangedListener remove itself from its list.
// Because all display change handling is done on the event thread,
// synchronization provides no protection against modifying the listener
// list while in the middle of iterating over it.  -bchristi 7/10/2001

    Set<DisplayChangedListener> cloneSet;

    synchronized(listeners) {
        cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
    }

    Iterator<DisplayChangedListener> itr = cloneSet.iterator();
    while (itr.hasNext()) {
        DisplayChangedListener current = itr.next();
        try {
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest("displayChanged for listener: " + current);
            }
            current.displayChanged();
        } catch (IllegalComponentStateException e) {
            // This DisplayChangeListener is no longer valid.  Most
            // likely, a top-level window was dispose()d, but its
            // Java objects have not yet been garbage collected.  In any
            // case, we no longer need to track this listener, though we
            // do need to remove it from the original list, not the clone.
            listeners.remove(current);
        }
    }
}
项目:openjdk-jdk10    文件:SunDisplayChanger.java   
public void notifyPaletteChanged() {
    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        log.finest("notifyPaletteChanged");
    }
// This method is implemented by making a clone of the set of listeners,
// and then iterating over the clone.  This is because during the course
// of responding to a display change, it may be appropriate for a
// DisplayChangedListener to add or remove itself from a SunDisplayChanger.
// If the set itself were iterated over, rather than a clone, it is
// trivial to get a ConcurrentModificationException by having a
// DisplayChangedListener remove itself from its list.
// Because all display change handling is done on the event thread,
// synchronization provides no protection against modifying the listener
// list while in the middle of iterating over it.  -bchristi 7/10/2001

    Set<DisplayChangedListener> cloneSet;

    synchronized (listeners) {
        cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
    }
    Iterator<DisplayChangedListener> itr = cloneSet.iterator();
    while (itr.hasNext()) {
        DisplayChangedListener current = itr.next();
        try {
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest("paletteChanged for listener: " + current);
            }
            current.paletteChanged();
        } catch (IllegalComponentStateException e) {
            // This DisplayChangeListener is no longer valid.  Most
            // likely, a top-level window was dispose()d, but its
            // Java objects have not yet been garbage collected.  In any
            // case, we no longer need to track this listener, though we
            // do need to remove it from the original list, not the clone.
            listeners.remove(current);
        }
    }
}
项目:openjdk-jdk10    文件:Flag.java   
public static void waitTillShown(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
项目:openjdk-jdk10    文件:Util.java   
public static void waitTillShownEx(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
项目:openjdk-jdk10    文件:bug6219960.java   
private static boolean pressOK(Component comp) {

        JInternalFrame internalFrame
                = findModalInternalFrame(comp, QUESTION);

        if (internalFrame == null) {
            return false;
        }

        JButton button = (JButton) findButton(internalFrame);

        if (button == null) {
            return false;
        }

        try {
            Robot robot = new Robot();
            Point location = button.getLocationOnScreen();
            Rectangle bounds = button.getBounds();
            int centerX = (int) (location.getX() + bounds.getWidth() / 2);
            int centerY = (int) (location.getY() + bounds.getHeight() / 2);
            robot.mouseMove(centerX, centerY);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
        } catch (IllegalComponentStateException ignore) {
            return false;
        } catch (AWTException e) {
            throw new RuntimeException(e);
        }
        return true;
    }
项目:Logisim    文件:Frame.java   
public void savePreferences() {
    AppPreferences.TICK_FREQUENCY.set(Double.valueOf(proj.getSimulator().getTickFrequency()));
    AppPreferences.LAYOUT_SHOW_GRID.setBoolean(layoutZoomModel.getShowGrid());
    AppPreferences.LAYOUT_ZOOM.set(Double.valueOf(layoutZoomModel.getZoomFactor()));
    if (appearance != null) {
        ZoomModel aZoom = appearance.getZoomModel();
        AppPreferences.APPEARANCE_SHOW_GRID.setBoolean(aZoom.getShowGrid());
        AppPreferences.APPEARANCE_ZOOM.set(Double.valueOf(aZoom.getZoomFactor()));
    }
    int state = getExtendedState() & ~java.awt.Frame.ICONIFIED;
    AppPreferences.WINDOW_STATE.set(Integer.valueOf(state));
    Dimension dim = getSize();
    AppPreferences.WINDOW_WIDTH.set(Integer.valueOf(dim.width));
    AppPreferences.WINDOW_HEIGHT.set(Integer.valueOf(dim.height));
    Point loc;
    try {
        loc = getLocationOnScreen();
    } catch (IllegalComponentStateException e) {
        loc = Projects.getLocation(this);
    }
    if (loc != null) {
        AppPreferences.WINDOW_LOCATION.set(loc.x + "," + loc.y);
    }
    AppPreferences.WINDOW_LEFT_SPLIT.set(Double.valueOf(leftRegion.getFraction()));
    AppPreferences.WINDOW_MAIN_SPLIT.set(Double.valueOf(mainRegion.getFraction()));
    AppPreferences.DIALOG_DIRECTORY.set(JFileChoosers.getCurrentDirectory());
}
项目:openjdk9    文件:SunDisplayChanger.java   
public void notifyListeners() {
    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        log.finest("notifyListeners");
    }
// This method is implemented by making a clone of the set of listeners,
// and then iterating over the clone.  This is because during the course
// of responding to a display change, it may be appropriate for a
// DisplayChangedListener to add or remove itself from a SunDisplayChanger.
// If the set itself were iterated over, rather than a clone, it is
// trivial to get a ConcurrentModificationException by having a
// DisplayChangedListener remove itself from its list.
// Because all display change handling is done on the event thread,
// synchronization provides no protection against modifying the listener
// list while in the middle of iterating over it.  -bchristi 7/10/2001

    Set<DisplayChangedListener> cloneSet;

    synchronized(listeners) {
        cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
    }

    Iterator<DisplayChangedListener> itr = cloneSet.iterator();
    while (itr.hasNext()) {
        DisplayChangedListener current = itr.next();
        try {
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest("displayChanged for listener: " + current);
            }
            current.displayChanged();
        } catch (IllegalComponentStateException e) {
            // This DisplayChangeListener is no longer valid.  Most
            // likely, a top-level window was dispose()d, but its
            // Java objects have not yet been garbage collected.  In any
            // case, we no longer need to track this listener, though we
            // do need to remove it from the original list, not the clone.
            listeners.remove(current);
        }
    }
}
项目:openjdk9    文件:SunDisplayChanger.java   
public void notifyPaletteChanged() {
    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        log.finest("notifyPaletteChanged");
    }
// This method is implemented by making a clone of the set of listeners,
// and then iterating over the clone.  This is because during the course
// of responding to a display change, it may be appropriate for a
// DisplayChangedListener to add or remove itself from a SunDisplayChanger.
// If the set itself were iterated over, rather than a clone, it is
// trivial to get a ConcurrentModificationException by having a
// DisplayChangedListener remove itself from its list.
// Because all display change handling is done on the event thread,
// synchronization provides no protection against modifying the listener
// list while in the middle of iterating over it.  -bchristi 7/10/2001

    Set<DisplayChangedListener> cloneSet;

    synchronized (listeners) {
        cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
    }
    Iterator<DisplayChangedListener> itr = cloneSet.iterator();
    while (itr.hasNext()) {
        DisplayChangedListener current = itr.next();
        try {
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest("paletteChanged for listener: " + current);
            }
            current.paletteChanged();
        } catch (IllegalComponentStateException e) {
            // This DisplayChangeListener is no longer valid.  Most
            // likely, a top-level window was dispose()d, but its
            // Java objects have not yet been garbage collected.  In any
            // case, we no longer need to track this listener, though we
            // do need to remove it from the original list, not the clone.
            listeners.remove(current);
        }
    }
}
项目:openjdk9    文件:Flag.java   
public static void waitTillShown(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
项目:openjdk9    文件:Util.java   
public static void waitTillShownEx(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
项目:openjdk9    文件:bug6219960.java   
private static boolean pressOK(Component comp) {

        JInternalFrame internalFrame
                = findModalInternalFrame(comp, QUESTION);

        if (internalFrame == null) {
            return false;
        }

        JButton button = (JButton) findButton(internalFrame);

        if (button == null) {
            return false;
        }

        try {
            Robot robot = new Robot();
            Point location = button.getLocationOnScreen();
            Rectangle bounds = button.getBounds();
            int centerX = (int) (location.getX() + bounds.getWidth() / 2);
            int centerY = (int) (location.getY() + bounds.getHeight() / 2);
            robot.mouseMove(centerX, centerY);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
        } catch (IllegalComponentStateException ignore) {
            return false;
        } catch (AWTException e) {
            throw new RuntimeException(e);
        }
        return true;
    }
项目:SimBionic    文件:SB_GlassPane.java   
public void setLocation(JComponent editingComponent){
    Container container = editingComponent.getParent();
    while (container != null && !(container instanceof Window))
        container = container.getParent();

    int verticalOffset = 0;
    int horizontalOffset = 0;
    if (editingComponent instanceof JTextArea) {
        JTextArea textArea = (JTextArea)editingComponent;
        if ( textArea.getCaret()!=null && textArea.getCaret().getMagicCaretPosition()!=null) {
            verticalOffset = textArea.getCaret().getMagicCaretPosition().y;
            horizontalOffset = textArea.getCaret().getMagicCaretPosition().x;
        }
    }


    if (container instanceof JFrame) {
        ((JFrame)container).setGlassPane(this);
        verticalOffset += 4;
    }
    else if (container instanceof JDialog)
        ((JDialog)container).setGlassPane(this);

    try{
        Point textFieldLocation = editingComponent.getLocationOnScreen();

        Point windowLocation = container.getLocationOnScreen();
        completionList.setLocation(textFieldLocation.x - windowLocation.x + horizontalOffset, textFieldLocation.y - windowLocation.y + verticalOffset);
    }
    catch (IllegalComponentStateException ex){
        // TODO
    }
}
项目:UniBasel-Erweiterte-GdP    文件:ImageWindow.java   
/**
 * Returns the mouse coordinates relative to the image.<br> 
 * If the ImageWindow is not open -1,-1 is returned
 * @return java.awt.Point
 */
public Point getMousePos() {
    try {
        Point mousePoint=MouseInfo.getPointerInfo().getLocation();
        Point componentPoint=this.getLocationOnScreen();
        Point p = new Point(mousePoint.x-componentPoint.x,mousePoint.y-componentPoint.y);
        return p;
    } catch (IllegalComponentStateException e) {
        return new Point (-1,-1);
    }
}
项目:UniBasel-Erweiterte-GdP    文件:ImageWindow.java   
/**
 * Returns the mouse coordinates relative to the image.<br> 
 * If the ImageWindow is not open -1,-1 is returned
 * @return java.awt.Point
 */
public Point getMousePos() {
    try {
        Point mousePoint=MouseInfo.getPointerInfo().getLocation();
        Point componentPoint=this.getLocationOnScreen();
        Point p = new Point(mousePoint.x-componentPoint.x,mousePoint.y-componentPoint.y);
        return p;
    } catch (IllegalComponentStateException e) {
        return new Point (-1,-1);
    }
}
项目:UniBasel-Erweiterte-GdP    文件:ImageWindow.java   
/**
 * Returns the mouse coordinates relative to the image.<br> 
 * If the ImageWindow is not open -1,-1 is returned
 * @return java.awt.Point
 */
public Point getMousePos() {
    try {
        Point mousePoint=MouseInfo.getPointerInfo().getLocation();
        Point componentPoint=this.getLocationOnScreen();
        Point p = new Point(mousePoint.x-componentPoint.x,mousePoint.y-componentPoint.y);
        return p;
    } catch (IllegalComponentStateException e) {
        return new Point (-1,-1);
    }
}
项目:UniBasel-Erweiterte-GdP    文件:ImageWindow.java   
/**
 * Returns the mouse coordinates relative to the image.<br> 
 * If the ImageWindow is not open -1,-1 is returned
 * @return java.awt.Point
 */
public Point getMousePos() {
    try {
        Point mousePoint=MouseInfo.getPointerInfo().getLocation();
        Point componentPoint=this.getLocationOnScreen();
        Point p = new Point(mousePoint.x-componentPoint.x,mousePoint.y-componentPoint.y);
        return p;
    } catch (IllegalComponentStateException e) {
        return new Point (-1,-1);
    }
}
项目:UniBasel-Erweiterte-GdP    文件:ImageWindow.java   
/**
 * Returns the mouse coordinates relative to the image.<br> 
 * If the ImageWindow is not open -1,-1 is returned
 * @return java.awt.Point
 */
public Point getMousePos() {
    try {
        Point mousePoint=MouseInfo.getPointerInfo().getLocation();
        Point componentPoint=this.getLocationOnScreen();
        Point p = new Point(mousePoint.x-componentPoint.x,mousePoint.y-componentPoint.y);
        return p;
    } catch (IllegalComponentStateException e) {
        return new Point (-1,-1);
    }
}
项目:PhET    文件:AWTUtil.java   
public static void setCursorPosition(Component component, Robot robot, int x, int y) {
    if (robot != null) {
        try {
            Point location = component.getLocationOnScreen();
            int transformed_x = location.x + x;
            int transformed_y = location.y + transformY(component, y);
            robot.mouseMove(transformed_x, transformed_y);
        } catch (IllegalComponentStateException e) {
            LWJGLUtil.log("Failed to set cursor position: " + e);
        }
    }
}
项目:jdk8u_jdk    文件:SunDisplayChanger.java   
private void notifyChanged(Consumer<DisplayChangedListener> callback, String callbackName) {
    // This method is implemented by making a clone of the set of listeners,
    // and then iterating over the clone.  This is because during the course
    // of responding to a display change, it may be appropriate for a
    // DisplayChangedListener to add or remove itself from a SunDisplayChanger.
    // If the set itself were iterated over, rather than a clone, it is
    // trivial to get a ConcurrentModificationException by having a
    // DisplayChangedListener remove itself from its list.
    // Because all display change handling is done on the event thread,
    // synchronization provides no protection against modifying the listener
    // list while in the middle of iterating over it.  -bchristi 7/10/2001

    // Preserve "weakness" of the original map to avoid OOME.
    WeakHashMap<DisplayChangedListener, Void> cloneMap;

    synchronized(listeners) {
        cloneMap = new WeakHashMap<>(listeners);
    }

    for (DisplayChangedListener current : cloneMap.keySet()) {
        try {
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest(callbackName + " for listener: " + current);
            }
            callback.accept(current);
        } catch (IllegalComponentStateException e) {
            // This DisplayChangeListener is no longer valid.  Most
            // likely, a top-level window was dispose()d, but its
            // Java objects have not yet been garbage collected.  In any
            // case, we no longer need to track this listener, though we
            // do need to remove it from the original list, not the clone.
            listeners.remove(current);
        }
    }
}
项目:jdk8u_jdk    文件:Util.java   
public static void waitTillShownEx(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:SunDisplayChanger.java   
public void notifyListeners() {
    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        log.finest("notifyListeners");
    }
// This method is implemented by making a clone of the set of listeners,
// and then iterating over the clone.  This is because during the course
// of responding to a display change, it may be appropriate for a
// DisplayChangedListener to add or remove itself from a SunDisplayChanger.
// If the set itself were iterated over, rather than a clone, it is
// trivial to get a ConcurrentModificationException by having a
// DisplayChangedListener remove itself from its list.
// Because all display change handling is done on the event thread,
// synchronization provides no protection against modifying the listener
// list while in the middle of iterating over it.  -bchristi 7/10/2001

    Set<DisplayChangedListener> cloneSet;

    synchronized(listeners) {
        cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
    }

    Iterator<DisplayChangedListener> itr = cloneSet.iterator();
    while (itr.hasNext()) {
        DisplayChangedListener current = itr.next();
        try {
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest("displayChanged for listener: " + current);
            }
            current.displayChanged();
        } catch (IllegalComponentStateException e) {
            // This DisplayChangeListener is no longer valid.  Most
            // likely, a top-level window was dispose()d, but its
            // Java objects have not yet been garbage collected.  In any
            // case, we no longer need to track this listener, though we
            // do need to remove it from the original list, not the clone.
            listeners.remove(current);
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:SunDisplayChanger.java   
public void notifyPaletteChanged() {
    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        log.finest("notifyPaletteChanged");
    }
// This method is implemented by making a clone of the set of listeners,
// and then iterating over the clone.  This is because during the course
// of responding to a display change, it may be appropriate for a
// DisplayChangedListener to add or remove itself from a SunDisplayChanger.
// If the set itself were iterated over, rather than a clone, it is
// trivial to get a ConcurrentModificationException by having a
// DisplayChangedListener remove itself from its list.
// Because all display change handling is done on the event thread,
// synchronization provides no protection against modifying the listener
// list while in the middle of iterating over it.  -bchristi 7/10/2001

    Set<DisplayChangedListener> cloneSet;

    synchronized (listeners) {
        cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
    }
    Iterator<DisplayChangedListener> itr = cloneSet.iterator();
    while (itr.hasNext()) {
        DisplayChangedListener current = itr.next();
        try {
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest("paletteChanged for listener: " + current);
            }
            current.paletteChanged();
        } catch (IllegalComponentStateException e) {
            // This DisplayChangeListener is no longer valid.  Most
            // likely, a top-level window was dispose()d, but its
            // Java objects have not yet been garbage collected.  In any
            // case, we no longer need to track this listener, though we
            // do need to remove it from the original list, not the clone.
            listeners.remove(current);
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Util.java   
public static void waitTillShownEx(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
项目:j2se_for_android    文件:MouseEvent.java   
public MouseEvent(Component source, int id, long when, int modifiers,
                  int x, int y, int clickCount, boolean popupTrigger,
                  int button)
{
    this(source, id, when, modifiers, x, y, 0, 0, clickCount, popupTrigger, button);
    Point eventLocationOnScreen = new Point(0, 0);
    try {
      eventLocationOnScreen = source.getLocationOnScreen();
      this.xAbs = eventLocationOnScreen.x + x;
      this.yAbs = eventLocationOnScreen.y + y;
    } catch (IllegalComponentStateException e){
      this.xAbs = 0;
      this.yAbs = 0;
    }
}
项目:javify    文件:JInternalFrame.java   
/**
 * This method sets the JLayeredPane to use with this JInternalFrame.
 *
 * @param layered The JLayeredPane to use as a layeredPane.
 */
public void setLayeredPane(JLayeredPane layered)
{
  if (layered == null)
    throw new IllegalComponentStateException("LayeredPane must not be null");

  if (layered != getLayeredPane())
    {
      JLayeredPane old = getLayeredPane();
      getRootPane().setLayeredPane(layered);
      firePropertyChange(LAYERED_PANE_PROPERTY, old, layered);
    }
}
项目:javify    文件:JRootPane.java   
/**
 * Sets the JRootPane's content pane.  The content pane should typically be
 * opaque for painting to work properly.  This method also
 * removes the old content pane from the layered pane.
 *
 * @param p the Container that will be the content pane
 * @throws IllegalComponentStateException if p is null
 */
public void setContentPane(Container p)
{
  if (p == null)
    throw new IllegalComponentStateException ("cannot " +
          "have a null content pane");
  else
    {
      if (contentPane != null && contentPane.getParent() == layeredPane)
        layeredPane.remove(contentPane);
      contentPane = p;
      getLayeredPane().add(contentPane, JLayeredPane.FRAME_CONTENT_LAYER);
    }
}
项目:javify    文件:JRootPane.java   
/**
 * Set the layered pane for the root pane.
 *
 * @param f The JLayeredPane to be used.
 *
 * @throws IllegalComponentStateException if JLayeredPane
 * parameter is null.
 */
public void setLayeredPane(JLayeredPane f)
{
  if (f == null)
    throw new IllegalComponentStateException();

  if (layeredPane != null)
    remove(layeredPane);

  layeredPane = f;
  add(f, -1);
}
项目:javify    文件:ImageIcon.java   
/**
 * Returns the locale of this object.  To match the reference
 * implementation, this method always returns <code>null</code>.
 *
 * @return <code>null</code>.
 */
public Locale getLocale()
  throws IllegalComponentStateException
{
  // refer to Sun's bug report 4269253
  return null;
}