< prev index next >

src/java.desktop/share/classes/java/awt/Window.java

Print this page

        

*** 1475,1495 **** */ public Window[] getOwnedWindows() { return getOwnedWindows_NoClientCode(); } final Window[] getOwnedWindows_NoClientCode() { ! Window realCopy[]; synchronized(ownedWindowList) { // Recall that ownedWindowList is actually a Vector of // WeakReferences and calling get() on one of these references // may return null. Make two arrays-- one the size of the // Vector (fullCopy with size fullSize), and one the size of // all non-null get()s (realCopy with size realSize). int fullSize = ownedWindowList.size(); int realSize = 0; ! Window fullCopy[] = new Window[fullSize]; for (int i = 0; i < fullSize; i++) { fullCopy[realSize] = ownedWindowList.elementAt(i).get(); if (fullCopy[realSize] != null) { --- 1475,1495 ---- */ public Window[] getOwnedWindows() { return getOwnedWindows_NoClientCode(); } final Window[] getOwnedWindows_NoClientCode() { ! Window[] realCopy; synchronized(ownedWindowList) { // Recall that ownedWindowList is actually a Vector of // WeakReferences and calling get() on one of these references // may return null. Make two arrays-- one the size of the // Vector (fullCopy with size fullSize), and one the size of // all non-null get()s (realCopy with size realSize). int fullSize = ownedWindowList.size(); int realSize = 0; ! Window[] fullCopy = new Window[fullSize]; for (int i = 0; i < fullSize; i++) { fullCopy[realSize] = ownedWindowList.elementAt(i).get(); if (fullCopy[realSize] != null) {
*** 1553,1570 **** } } private static Window[] getWindows(AppContext appContext) { synchronized (Window.class) { ! Window realCopy[]; @SuppressWarnings("unchecked") Vector<WeakReference<Window>> windowList = (Vector<WeakReference<Window>>)appContext.get(Window.class); if (windowList != null) { int fullSize = windowList.size(); int realSize = 0; ! Window fullCopy[] = new Window[fullSize]; for (int i = 0; i < fullSize; i++) { Window w = windowList.get(i).get(); if (w != null) { fullCopy[realSize++] = w; } --- 1553,1570 ---- } } private static Window[] getWindows(AppContext appContext) { synchronized (Window.class) { ! Window[] realCopy; @SuppressWarnings("unchecked") Vector<WeakReference<Window>> windowList = (Vector<WeakReference<Window>>)appContext.get(Window.class); if (windowList != null) { int fullSize = windowList.size(); int realSize = 0; ! Window[] fullCopy = new Window[fullSize]; for (int i = 0; i < fullSize; i++) { Window w = windowList.get(i).get(); if (w != null) { fullCopy[realSize++] = w; }
< prev index next >