java.awt.IllegalComponentStateException Java Examples
The following examples show how to use
java.awt.IllegalComponentStateException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MyMainWindowManager.java From IBC with GNU General Public License v3.0 | 6 votes |
@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); }
Example #2
Source File: Util.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static void waitTillShownEx(final Component comp) throws InterruptedException { while (true) { try { Thread.sleep(100); comp.getLocationOnScreen(); break; } catch (IllegalComponentStateException e) {} } }
Example #3
Source File: SunDisplayChanger.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #4
Source File: SunDisplayChanger.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #5
Source File: Util.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void waitTillShownEx(final Component comp) throws InterruptedException { while (true) { try { Thread.sleep(100); comp.getLocationOnScreen(); break; } catch (IllegalComponentStateException e) {} } }
Example #6
Source File: SunDisplayChanger.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #7
Source File: SunDisplayChanger.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #8
Source File: Util.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static void waitTillShownEx(final Component comp) throws InterruptedException { while (true) { try { Thread.sleep(100); comp.getLocationOnScreen(); break; } catch (IllegalComponentStateException e) {} } }
Example #9
Source File: Util.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void waitTillShownEx(final Component comp) throws InterruptedException { while (true) { try { Thread.sleep(100); comp.getLocationOnScreen(); break; } catch (IllegalComponentStateException e) {} } }
Example #10
Source File: SunDisplayChanger.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #11
Source File: SunDisplayChanger.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #12
Source File: SunDisplayChanger.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #13
Source File: SunDisplayChanger.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #14
Source File: Util.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void waitTillShownEx(final Component comp) throws InterruptedException { while (true) { try { Thread.sleep(100); comp.getLocationOnScreen(); break; } catch (IllegalComponentStateException e) {} } }
Example #15
Source File: SunDisplayChanger.java From Bytecoder with Apache License 2.0 | 5 votes |
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); } } }
Example #16
Source File: SunDisplayChanger.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #17
Source File: Util.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static void waitTillShownEx(final Component comp) throws InterruptedException { while (true) { try { Thread.sleep(100); comp.getLocationOnScreen(); break; } catch (IllegalComponentStateException e) {} } }
Example #18
Source File: SunDisplayChanger.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #19
Source File: SunDisplayChanger.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #20
Source File: SunDisplayChanger.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #21
Source File: Util.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void waitTillShownEx(final Component comp) throws InterruptedException { while (true) { try { Thread.sleep(100); comp.getLocationOnScreen(); break; } catch (IllegalComponentStateException e) {} } }
Example #22
Source File: Flag.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void waitTillShown(final Component comp) throws InterruptedException { while (true) { try { Thread.sleep(100); comp.getLocationOnScreen(); break; } catch (IllegalComponentStateException e) {} } }
Example #23
Source File: Util.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void waitTillShownEx(final Component comp) throws InterruptedException { while (true) { try { Thread.sleep(100); comp.getLocationOnScreen(); break; } catch (IllegalComponentStateException e) {} } }
Example #24
Source File: bug6219960.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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; }
Example #25
Source File: SunDisplayChanger.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #26
Source File: SunDisplayChanger.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #27
Source File: SunDisplayChanger.java From hottub with GNU General Public License v2.0 | 5 votes |
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); } } }
Example #28
Source File: Util.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void waitTillShownEx(final Component comp) throws InterruptedException { while (true) { try { Thread.sleep(100); comp.getLocationOnScreen(); break; } catch (IllegalComponentStateException e) {} } }
Example #29
Source File: Frame.java From Logisim with GNU General Public License v3.0 | 5 votes |
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()); }
Example #30
Source File: SunDisplayChanger.java From hottub with GNU General Public License v2.0 | 5 votes |
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); } } }