类java.awt.IllegalComponentStateException源码实例Demo

下面列出了怎么用java.awt.IllegalComponentStateException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: IBC   文件: MyMainWindowManager.java
@Override
public void setMainWindow(JFrame window) {
    super.setMainWindow(window);
    
    try {
        if (!GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().isWindowTranslucencySupported(TRANSLUCENT)) return;
    } catch (IllegalComponentStateException e) {
        return;
    }

    window.setOpacity(0.80f);
    
    SimpleClock clock = new SimpleClock();
    window.setGlassPane(clock);
    clock.setVisible(true);
}
 
源代码2 项目: dragonwell8_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);
        }
    }
}
 
源代码3 项目: dragonwell8_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);
        }
    }
}
 
源代码4 项目: dragonwell8_jdk   文件: Util.java
public static void waitTillShownEx(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
 
源代码5 项目: TencentKona-8   文件: 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);
        }
    }
}
 
源代码6 项目: TencentKona-8   文件: 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);
        }
    }
}
 
源代码7 项目: TencentKona-8   文件: Util.java
public static void waitTillShownEx(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
 
源代码8 项目: jdk8u60   文件: 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);
        }
    }
}
 
源代码9 项目: jdk8u60   文件: 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);
        }
    }
}
 
源代码10 项目: jdk8u60   文件: Util.java
public static void waitTillShownEx(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
 
源代码11 项目: EnchantmentCracker   文件: FixedTextField.java
@Deprecated
@Override
public Rectangle modelToView(int pos) throws BadLocationException {
	// Hack-fix for #9 - Enchantment Cracker sometimes crashes if you go from second tab to first tab
	// We have to hack-fix because it's a Java bug (JDK-8179665)
	try {
		getLocationOnScreen();
	} catch (IllegalComponentStateException e) {
		throw new BadLocationException(null, 0);
	}
	return super.modelToView(pos);
}
 
源代码12 项目: lizzie   文件: BasicLizziePaneUI.java
protected void floatAt(Point position, Point origin) {
  if (lizziePane.isFloatable()) {
    try {
      Point offset = dragWindow.getOffset();
      if (offset == null) {
        offset = position;
        dragWindow.setOffset(offset);
      }
      Point global = new Point(origin.x + position.x, origin.y + position.y);
      setFloatingLocation(global.x - offset.x, global.y - offset.y);
      if (dockingSource != null) {
        Point dockingPosition = dockingSource.getLocationOnScreen();
        Point comparisonPoint =
            new Point(global.x - dockingPosition.x, global.y - dockingPosition.y);
        if (canDock(dockingSource, comparisonPoint)) {
          setFloating(false, comparisonPoint);
        } else {
          setFloating(true, null);
        }
      } else {
        setFloating(true, null);
      }
      dragWindow.setOffset(null);
    } catch (IllegalComponentStateException e) {
    }
  }
}
 
源代码13 项目: lizzie   文件: BasicLizziePaneUI.java
public void toWindow(Point position, Dimension size) {
  if (lizziePane.isFloatable()) {
    try {
      originSize = size;
      if (dragWindow == null) dragWindow = createDragWindow(lizziePane);
      if (dockingSource == null) dockingSource = lizziePane.getParent();
      constraintBeforeFloating = calculateConstraint();
      setFloatingLocation(position.x, position.y);
      setFloating(true, null);
    } catch (IllegalComponentStateException e) {
    }
  }
}
 
源代码14 项目: openjdk-jdk8u   文件: 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);
        }
    }
}
 
源代码15 项目: openjdk-jdk8u   文件: 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);
        }
    }
}
 
源代码16 项目: openjdk-jdk8u   文件: Util.java
public static void waitTillShownEx(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
 
源代码17 项目: openjdk-jdk8u-backup   文件: 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);
        }
    }
}
 
源代码18 项目: openjdk-jdk8u-backup   文件: 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);
        }
    }
}
 
源代码19 项目: openjdk-jdk8u-backup   文件: Util.java
public static void waitTillShownEx(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
 
源代码20 项目: Bytecoder   文件: 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);
        }
    }
}
 
源代码21 项目: jdk8u-dev-jdk   文件: Util.java
public static void waitTillShownEx(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
 
源代码22 项目: openjdk-jdk9   文件: 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);
        }
    }
}
 
源代码23 项目: openjdk-jdk9   文件: Flag.java
public static void waitTillShown(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
 
源代码24 项目: openjdk-jdk9   文件: Util.java
public static void waitTillShownEx(final Component comp) throws InterruptedException {
    while (true) {
        try {
            Thread.sleep(100);
            comp.getLocationOnScreen();
            break;
        } catch (IllegalComponentStateException e) {}
    }
}
 
源代码25 项目: openjdk-jdk9   文件: 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;
    }
 
源代码26 项目: 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);
        }
    }
}
 
源代码27 项目: 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);
        }
    }
}
 
源代码28 项目: 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) {}
    }
}
 
源代码29 项目: 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());
}
 
源代码30 项目: hottub   文件: 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);
        }
    }
}
 
 类所在包
 同包方法