equal
deleted
inserted
replaced
86 private JMenuBar lastMenuBar; |
86 private JMenuBar lastMenuBar; |
87 |
87 |
88 /** |
88 /** |
89 * Registers the specified component. |
89 * Registers the specified component. |
90 */ |
90 */ |
91 synchronized static void register(JComponent c) { |
91 static synchronized void register(JComponent c) { |
92 if (c == null) { |
92 if (c == null) { |
93 // Exception is thrown as convenience for callers that are |
93 // Exception is thrown as convenience for callers that are |
94 // typed to throw an NPE. |
94 // typed to throw an NPE. |
95 throw new NullPointerException("JComponent must be non-null"); |
95 throw new NullPointerException("JComponent must be non-null"); |
96 } |
96 } |
98 } |
98 } |
99 |
99 |
100 /** |
100 /** |
101 * Unregisters the specified component. |
101 * Unregisters the specified component. |
102 */ |
102 */ |
103 synchronized static void unregister(JComponent c) { |
103 static synchronized void unregister(JComponent c) { |
104 for (int counter = components.size() - 1; counter >= 0; counter--) { |
104 for (int counter = components.size() - 1; counter >= 0; counter--) { |
105 // Search for the component, removing any flushed references |
105 // Search for the component, removing any flushed references |
106 // along the way. |
106 // along the way. |
107 JComponent target = components.get(counter).get(); |
107 JComponent target = components.get(counter).get(); |
108 |
108 |
114 |
114 |
115 /** |
115 /** |
116 * Finds a previously registered component of class <code>target</code> |
116 * Finds a previously registered component of class <code>target</code> |
117 * that shares the JRootPane ancestor of <code>from</code>. |
117 * that shares the JRootPane ancestor of <code>from</code>. |
118 */ |
118 */ |
119 synchronized static Object findRegisteredComponentOfType(JComponent from, |
119 static synchronized Object findRegisteredComponentOfType(JComponent from, |
120 Class<?> target) { |
120 Class<?> target) { |
121 JRootPane rp = SwingUtilities.getRootPane(from); |
121 JRootPane rp = SwingUtilities.getRootPane(from); |
122 if (rp != null) { |
122 if (rp != null) { |
123 for (int counter = components.size() - 1; counter >= 0; counter--){ |
123 for (int counter = components.size() - 1; counter >= 0; counter--){ |
124 Object component = ((WeakReference)components.get(counter)). |
124 Object component = ((WeakReference)components.get(counter)). |