author | xdono |
Mon, 15 Dec 2008 16:55:25 -0800 | |
changeset 1639 | a97859015238 |
parent 1289 | 43d45f4159b6 |
child 4225 | 57ec8171fcd5 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
1639 | 2 |
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Sun designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Sun in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 |
* have any questions. |
|
24 |
*/ |
|
25 |
||
26 |
package javax.swing.plaf.basic; |
|
27 |
||
28 |
import sun.swing.SwingUtilities2; |
|
29 |
import sun.swing.DefaultLookup; |
|
30 |
import sun.swing.UIAction; |
|
31 |
import javax.swing.*; |
|
32 |
import javax.swing.plaf.*; |
|
33 |
import javax.swing.text.View; |
|
34 |
||
35 |
import java.awt.event.ActionEvent; |
|
36 |
import java.awt.event.ActionListener; |
|
37 |
import java.awt.event.KeyEvent; |
|
38 |
import java.awt.Component; |
|
39 |
import java.awt.Container; |
|
40 |
import java.awt.Dimension; |
|
41 |
import java.awt.Rectangle; |
|
42 |
import java.awt.Insets; |
|
43 |
import java.awt.Color; |
|
44 |
import java.awt.Graphics; |
|
45 |
import java.awt.Font; |
|
46 |
import java.awt.FontMetrics; |
|
47 |
import java.beans.PropertyChangeEvent; |
|
48 |
import java.beans.PropertyChangeListener; |
|
49 |
||
50 |
/** |
|
51 |
* A Windows L&F implementation of LabelUI. This implementation |
|
52 |
* is completely static, i.e. there's only one UIView implementation |
|
53 |
* that's shared by all JLabel objects. |
|
54 |
* |
|
55 |
* @author Hans Muller |
|
56 |
*/ |
|
57 |
public class BasicLabelUI extends LabelUI implements PropertyChangeListener |
|
58 |
{ |
|
59 |
/** |
|
60 |
* The default <code>BasicLabelUI</code> instance. This field might |
|
61 |
* not be used. To change the default instance use a subclass which |
|
62 |
* overrides the <code>createUI</code> method, and place that class |
|
63 |
* name in defaults table under the key "LabelUI". |
|
64 |
*/ |
|
65 |
protected static BasicLabelUI labelUI = new BasicLabelUI(); |
|
66 |
private final static BasicLabelUI SAFE_BASIC_LABEL_UI = new BasicLabelUI(); |
|
67 |
||
1289
43d45f4159b6
6727829: BasicLabelUI rendering fails if multiple AppContexts exist in same java JVM
mlapshin
parents:
2
diff
changeset
|
68 |
private Rectangle paintIconR = new Rectangle(); |
43d45f4159b6
6727829: BasicLabelUI rendering fails if multiple AppContexts exist in same java JVM
mlapshin
parents:
2
diff
changeset
|
69 |
private Rectangle paintTextR = new Rectangle(); |
43d45f4159b6
6727829: BasicLabelUI rendering fails if multiple AppContexts exist in same java JVM
mlapshin
parents:
2
diff
changeset
|
70 |
|
2 | 71 |
static void loadActionMap(LazyActionMap map) { |
72 |
map.put(new Actions(Actions.PRESS)); |
|
73 |
map.put(new Actions(Actions.RELEASE)); |
|
74 |
} |
|
75 |
||
76 |
/** |
|
77 |
* Forwards the call to SwingUtilities.layoutCompoundLabel(). |
|
78 |
* This method is here so that a subclass could do Label specific |
|
79 |
* layout and to shorten the method name a little. |
|
80 |
* |
|
81 |
* @see SwingUtilities#layoutCompoundLabel |
|
82 |
*/ |
|
83 |
protected String layoutCL( |
|
84 |
JLabel label, |
|
85 |
FontMetrics fontMetrics, |
|
86 |
String text, |
|
87 |
Icon icon, |
|
88 |
Rectangle viewR, |
|
89 |
Rectangle iconR, |
|
90 |
Rectangle textR) |
|
91 |
{ |
|
92 |
return SwingUtilities.layoutCompoundLabel( |
|
93 |
(JComponent) label, |
|
94 |
fontMetrics, |
|
95 |
text, |
|
96 |
icon, |
|
97 |
label.getVerticalAlignment(), |
|
98 |
label.getHorizontalAlignment(), |
|
99 |
label.getVerticalTextPosition(), |
|
100 |
label.getHorizontalTextPosition(), |
|
101 |
viewR, |
|
102 |
iconR, |
|
103 |
textR, |
|
104 |
label.getIconTextGap()); |
|
105 |
} |
|
106 |
||
107 |
/** |
|
108 |
* Paint clippedText at textX, textY with the labels foreground color. |
|
109 |
* |
|
110 |
* @see #paint |
|
111 |
* @see #paintDisabledText |
|
112 |
*/ |
|
113 |
protected void paintEnabledText(JLabel l, Graphics g, String s, int textX, int textY) |
|
114 |
{ |
|
115 |
int mnemIndex = l.getDisplayedMnemonicIndex(); |
|
116 |
g.setColor(l.getForeground()); |
|
117 |
SwingUtilities2.drawStringUnderlineCharAt(l, g, s, mnemIndex, |
|
118 |
textX, textY); |
|
119 |
} |
|
120 |
||
121 |
||
122 |
/** |
|
123 |
* Paint clippedText at textX, textY with background.lighter() and then |
|
124 |
* shifted down and to the right by one pixel with background.darker(). |
|
125 |
* |
|
126 |
* @see #paint |
|
127 |
* @see #paintEnabledText |
|
128 |
*/ |
|
129 |
protected void paintDisabledText(JLabel l, Graphics g, String s, int textX, int textY) |
|
130 |
{ |
|
131 |
int accChar = l.getDisplayedMnemonicIndex(); |
|
132 |
Color background = l.getBackground(); |
|
133 |
g.setColor(background.brighter()); |
|
134 |
SwingUtilities2.drawStringUnderlineCharAt(l, g, s, accChar, |
|
135 |
textX + 1, textY + 1); |
|
136 |
g.setColor(background.darker()); |
|
137 |
SwingUtilities2.drawStringUnderlineCharAt(l, g, s, accChar, |
|
138 |
textX, textY); |
|
139 |
} |
|
140 |
||
141 |
/** |
|
142 |
* Paint the label text in the foreground color, if the label |
|
143 |
* is opaque then paint the entire background with the background |
|
144 |
* color. The Label text is drawn by paintEnabledText() or |
|
145 |
* paintDisabledText(). The locations of the label parts are computed |
|
146 |
* by layoutCL. |
|
147 |
* |
|
148 |
* @see #paintEnabledText |
|
149 |
* @see #paintDisabledText |
|
150 |
* @see #layoutCL |
|
151 |
*/ |
|
152 |
public void paint(Graphics g, JComponent c) |
|
153 |
{ |
|
154 |
JLabel label = (JLabel)c; |
|
155 |
String text = label.getText(); |
|
156 |
Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon(); |
|
157 |
||
158 |
if ((icon == null) && (text == null)) { |
|
159 |
return; |
|
160 |
} |
|
161 |
||
162 |
FontMetrics fm = SwingUtilities2.getFontMetrics(label, g); |
|
163 |
String clippedText = layout(label, fm, c.getWidth(), c.getHeight()); |
|
164 |
||
165 |
if (icon != null) { |
|
166 |
icon.paintIcon(c, g, paintIconR.x, paintIconR.y); |
|
167 |
} |
|
168 |
||
169 |
if (text != null) { |
|
170 |
View v = (View) c.getClientProperty(BasicHTML.propertyKey); |
|
171 |
if (v != null) { |
|
172 |
v.paint(g, paintTextR); |
|
173 |
} else { |
|
174 |
int textX = paintTextR.x; |
|
175 |
int textY = paintTextR.y + fm.getAscent(); |
|
176 |
||
177 |
if (label.isEnabled()) { |
|
178 |
paintEnabledText(label, g, clippedText, textX, textY); |
|
179 |
} |
|
180 |
else { |
|
181 |
paintDisabledText(label, g, clippedText, textX, textY); |
|
182 |
} |
|
183 |
} |
|
184 |
} |
|
185 |
} |
|
186 |
||
187 |
private String layout(JLabel label, FontMetrics fm, |
|
188 |
int width, int height) { |
|
1289
43d45f4159b6
6727829: BasicLabelUI rendering fails if multiple AppContexts exist in same java JVM
mlapshin
parents:
2
diff
changeset
|
189 |
Insets insets = label.getInsets(null); |
2 | 190 |
String text = label.getText(); |
191 |
Icon icon = (label.isEnabled()) ? label.getIcon() : |
|
192 |
label.getDisabledIcon(); |
|
1289
43d45f4159b6
6727829: BasicLabelUI rendering fails if multiple AppContexts exist in same java JVM
mlapshin
parents:
2
diff
changeset
|
193 |
Rectangle paintViewR = new Rectangle(); |
2 | 194 |
paintViewR.x = insets.left; |
195 |
paintViewR.y = insets.top; |
|
196 |
paintViewR.width = width - (insets.left + insets.right); |
|
197 |
paintViewR.height = height - (insets.top + insets.bottom); |
|
198 |
paintIconR.x = paintIconR.y = paintIconR.width = paintIconR.height = 0; |
|
199 |
paintTextR.x = paintTextR.y = paintTextR.width = paintTextR.height = 0; |
|
200 |
return layoutCL(label, fm, text, icon, paintViewR, paintIconR, |
|
201 |
paintTextR); |
|
202 |
} |
|
203 |
||
204 |
public Dimension getPreferredSize(JComponent c) |
|
205 |
{ |
|
206 |
JLabel label = (JLabel)c; |
|
207 |
String text = label.getText(); |
|
208 |
Icon icon = (label.isEnabled()) ? label.getIcon() : |
|
209 |
label.getDisabledIcon(); |
|
1289
43d45f4159b6
6727829: BasicLabelUI rendering fails if multiple AppContexts exist in same java JVM
mlapshin
parents:
2
diff
changeset
|
210 |
Insets insets = label.getInsets(null); |
2 | 211 |
Font font = label.getFont(); |
212 |
||
213 |
int dx = insets.left + insets.right; |
|
214 |
int dy = insets.top + insets.bottom; |
|
215 |
||
216 |
if ((icon == null) && |
|
217 |
((text == null) || |
|
218 |
((text != null) && (font == null)))) { |
|
219 |
return new Dimension(dx, dy); |
|
220 |
} |
|
221 |
else if ((text == null) || ((icon != null) && (font == null))) { |
|
222 |
return new Dimension(icon.getIconWidth() + dx, |
|
223 |
icon.getIconHeight() + dy); |
|
224 |
} |
|
225 |
else { |
|
226 |
FontMetrics fm = label.getFontMetrics(font); |
|
1289
43d45f4159b6
6727829: BasicLabelUI rendering fails if multiple AppContexts exist in same java JVM
mlapshin
parents:
2
diff
changeset
|
227 |
Rectangle iconR = new Rectangle(); |
43d45f4159b6
6727829: BasicLabelUI rendering fails if multiple AppContexts exist in same java JVM
mlapshin
parents:
2
diff
changeset
|
228 |
Rectangle textR = new Rectangle(); |
43d45f4159b6
6727829: BasicLabelUI rendering fails if multiple AppContexts exist in same java JVM
mlapshin
parents:
2
diff
changeset
|
229 |
Rectangle viewR = new Rectangle(); |
2 | 230 |
|
231 |
iconR.x = iconR.y = iconR.width = iconR.height = 0; |
|
232 |
textR.x = textR.y = textR.width = textR.height = 0; |
|
233 |
viewR.x = dx; |
|
234 |
viewR.y = dy; |
|
235 |
viewR.width = viewR.height = Short.MAX_VALUE; |
|
236 |
||
237 |
layoutCL(label, fm, text, icon, viewR, iconR, textR); |
|
238 |
int x1 = Math.min(iconR.x, textR.x); |
|
239 |
int x2 = Math.max(iconR.x + iconR.width, textR.x + textR.width); |
|
240 |
int y1 = Math.min(iconR.y, textR.y); |
|
241 |
int y2 = Math.max(iconR.y + iconR.height, textR.y + textR.height); |
|
242 |
Dimension rv = new Dimension(x2 - x1, y2 - y1); |
|
243 |
||
244 |
rv.width += dx; |
|
245 |
rv.height += dy; |
|
246 |
return rv; |
|
247 |
} |
|
248 |
} |
|
249 |
||
250 |
||
251 |
/** |
|
252 |
* @return getPreferredSize(c) |
|
253 |
*/ |
|
254 |
public Dimension getMinimumSize(JComponent c) { |
|
255 |
Dimension d = getPreferredSize(c); |
|
256 |
View v = (View) c.getClientProperty(BasicHTML.propertyKey); |
|
257 |
if (v != null) { |
|
258 |
d.width -= v.getPreferredSpan(View.X_AXIS) - v.getMinimumSpan(View.X_AXIS); |
|
259 |
} |
|
260 |
return d; |
|
261 |
} |
|
262 |
||
263 |
/** |
|
264 |
* @return getPreferredSize(c) |
|
265 |
*/ |
|
266 |
public Dimension getMaximumSize(JComponent c) { |
|
267 |
Dimension d = getPreferredSize(c); |
|
268 |
View v = (View) c.getClientProperty(BasicHTML.propertyKey); |
|
269 |
if (v != null) { |
|
270 |
d.width += v.getMaximumSpan(View.X_AXIS) - v.getPreferredSpan(View.X_AXIS); |
|
271 |
} |
|
272 |
return d; |
|
273 |
} |
|
274 |
||
275 |
/** |
|
276 |
* Returns the baseline. |
|
277 |
* |
|
278 |
* @throws NullPointerException {@inheritDoc} |
|
279 |
* @throws IllegalArgumentException {@inheritDoc} |
|
280 |
* @see javax.swing.JComponent#getBaseline(int, int) |
|
281 |
* @since 1.6 |
|
282 |
*/ |
|
283 |
public int getBaseline(JComponent c, int width, int height) { |
|
284 |
super.getBaseline(c, width, height); |
|
285 |
JLabel label = (JLabel)c; |
|
286 |
String text = label.getText(); |
|
287 |
if (text == null || "".equals(text) || label.getFont() == null) { |
|
288 |
return -1; |
|
289 |
} |
|
290 |
FontMetrics fm = label.getFontMetrics(label.getFont()); |
|
291 |
layout(label, fm, width, height); |
|
292 |
return BasicHTML.getBaseline(label, paintTextR.y, fm.getAscent(), |
|
293 |
paintTextR.width, paintTextR.height); |
|
294 |
} |
|
295 |
||
296 |
/** |
|
297 |
* Returns an enum indicating how the baseline of the component |
|
298 |
* changes as the size changes. |
|
299 |
* |
|
300 |
* @throws NullPointerException {@inheritDoc} |
|
301 |
* @see javax.swing.JComponent#getBaseline(int, int) |
|
302 |
* @since 1.6 |
|
303 |
*/ |
|
304 |
public Component.BaselineResizeBehavior getBaselineResizeBehavior( |
|
305 |
JComponent c) { |
|
306 |
super.getBaselineResizeBehavior(c); |
|
307 |
if (c.getClientProperty(BasicHTML.propertyKey) != null) { |
|
308 |
return Component.BaselineResizeBehavior.OTHER; |
|
309 |
} |
|
310 |
switch(((JLabel)c).getVerticalAlignment()) { |
|
311 |
case JLabel.TOP: |
|
312 |
return Component.BaselineResizeBehavior.CONSTANT_ASCENT; |
|
313 |
case JLabel.BOTTOM: |
|
314 |
return Component.BaselineResizeBehavior.CONSTANT_DESCENT; |
|
315 |
case JLabel.CENTER: |
|
316 |
return Component.BaselineResizeBehavior.CENTER_OFFSET; |
|
317 |
} |
|
318 |
return Component.BaselineResizeBehavior.OTHER; |
|
319 |
} |
|
320 |
||
321 |
||
322 |
public void installUI(JComponent c) { |
|
323 |
installDefaults((JLabel)c); |
|
324 |
installComponents((JLabel)c); |
|
325 |
installListeners((JLabel)c); |
|
326 |
installKeyboardActions((JLabel)c); |
|
327 |
} |
|
328 |
||
329 |
||
330 |
public void uninstallUI(JComponent c) { |
|
331 |
uninstallDefaults((JLabel)c); |
|
332 |
uninstallComponents((JLabel)c); |
|
333 |
uninstallListeners((JLabel)c); |
|
334 |
uninstallKeyboardActions((JLabel)c); |
|
335 |
} |
|
336 |
||
337 |
protected void installDefaults(JLabel c){ |
|
338 |
LookAndFeel.installColorsAndFont(c, "Label.background", "Label.foreground", "Label.font"); |
|
339 |
LookAndFeel.installProperty(c, "opaque", Boolean.FALSE); |
|
340 |
} |
|
341 |
||
342 |
protected void installListeners(JLabel c){ |
|
343 |
c.addPropertyChangeListener(this); |
|
344 |
} |
|
345 |
||
346 |
protected void installComponents(JLabel c){ |
|
347 |
BasicHTML.updateRenderer(c, c.getText()); |
|
348 |
c.setInheritsPopupMenu(true); |
|
349 |
} |
|
350 |
||
351 |
protected void installKeyboardActions(JLabel l) { |
|
352 |
int dka = l.getDisplayedMnemonic(); |
|
353 |
Component lf = l.getLabelFor(); |
|
354 |
if ((dka != 0) && (lf != null)) { |
|
355 |
LazyActionMap.installLazyActionMap(l, BasicLabelUI.class, |
|
356 |
"Label.actionMap"); |
|
357 |
InputMap inputMap = SwingUtilities.getUIInputMap |
|
358 |
(l, JComponent.WHEN_IN_FOCUSED_WINDOW); |
|
359 |
if (inputMap == null) { |
|
360 |
inputMap = new ComponentInputMapUIResource(l); |
|
361 |
SwingUtilities.replaceUIInputMap(l, |
|
362 |
JComponent.WHEN_IN_FOCUSED_WINDOW, inputMap); |
|
363 |
} |
|
364 |
inputMap.clear(); |
|
365 |
inputMap.put(KeyStroke.getKeyStroke(dka, ActionEvent.ALT_MASK, |
|
366 |
false), "press"); |
|
367 |
} |
|
368 |
else { |
|
369 |
InputMap inputMap = SwingUtilities.getUIInputMap |
|
370 |
(l, JComponent.WHEN_IN_FOCUSED_WINDOW); |
|
371 |
if (inputMap != null) { |
|
372 |
inputMap.clear(); |
|
373 |
} |
|
374 |
} |
|
375 |
} |
|
376 |
||
377 |
protected void uninstallDefaults(JLabel c){ |
|
378 |
} |
|
379 |
||
380 |
protected void uninstallListeners(JLabel c){ |
|
381 |
c.removePropertyChangeListener(this); |
|
382 |
} |
|
383 |
||
384 |
protected void uninstallComponents(JLabel c){ |
|
385 |
BasicHTML.updateRenderer(c, ""); |
|
386 |
} |
|
387 |
||
388 |
protected void uninstallKeyboardActions(JLabel c) { |
|
389 |
SwingUtilities.replaceUIInputMap(c, JComponent.WHEN_FOCUSED, null); |
|
390 |
SwingUtilities.replaceUIInputMap(c, JComponent.WHEN_IN_FOCUSED_WINDOW, |
|
391 |
null); |
|
392 |
SwingUtilities.replaceUIActionMap(c, null); |
|
393 |
} |
|
394 |
||
395 |
public static ComponentUI createUI(JComponent c) { |
|
396 |
if (System.getSecurityManager() != null) { |
|
397 |
return SAFE_BASIC_LABEL_UI; |
|
398 |
} else { |
|
399 |
return labelUI; |
|
400 |
} |
|
401 |
} |
|
402 |
||
403 |
public void propertyChange(PropertyChangeEvent e) { |
|
404 |
String name = e.getPropertyName(); |
|
405 |
if (name == "text" || "font" == name || "foreground" == name) { |
|
406 |
// remove the old html view client property if one |
|
407 |
// existed, and install a new one if the text installed |
|
408 |
// into the JLabel is html source. |
|
409 |
JLabel lbl = ((JLabel) e.getSource()); |
|
410 |
String text = lbl.getText(); |
|
411 |
BasicHTML.updateRenderer(lbl, text); |
|
412 |
} |
|
413 |
else if (name == "labelFor" || name == "displayedMnemonic") { |
|
414 |
installKeyboardActions((JLabel) e.getSource()); |
|
415 |
} |
|
416 |
} |
|
417 |
||
418 |
// When the accelerator is pressed, temporarily make the JLabel |
|
419 |
// focusTraversable by registering a WHEN_FOCUSED action for the |
|
420 |
// release of the accelerator. Then give it focus so it can |
|
421 |
// prevent unwanted keyTyped events from getting to other components. |
|
422 |
private static class Actions extends UIAction { |
|
423 |
private static final String PRESS = "press"; |
|
424 |
private static final String RELEASE = "release"; |
|
425 |
||
426 |
Actions(String key) { |
|
427 |
super(key); |
|
428 |
} |
|
429 |
||
430 |
public void actionPerformed(ActionEvent e) { |
|
431 |
JLabel label = (JLabel)e.getSource(); |
|
432 |
String key = getName(); |
|
433 |
if (key == PRESS) { |
|
434 |
doPress(label); |
|
435 |
} |
|
436 |
else if (key == RELEASE) { |
|
437 |
doRelease(label); |
|
438 |
} |
|
439 |
} |
|
440 |
||
441 |
private void doPress(JLabel label) { |
|
442 |
Component labelFor = label.getLabelFor(); |
|
443 |
if (labelFor != null && labelFor.isEnabled()) { |
|
444 |
InputMap inputMap = SwingUtilities.getUIInputMap(label, JComponent.WHEN_FOCUSED); |
|
445 |
if (inputMap == null) { |
|
446 |
inputMap = new InputMapUIResource(); |
|
447 |
SwingUtilities.replaceUIInputMap(label, JComponent.WHEN_FOCUSED, inputMap); |
|
448 |
} |
|
449 |
int dka = label.getDisplayedMnemonic(); |
|
450 |
inputMap.put(KeyStroke.getKeyStroke(dka, ActionEvent.ALT_MASK, true), RELEASE); |
|
451 |
// Need this if ALT is released before the accelerator |
|
452 |
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ALT, 0, true), RELEASE); |
|
453 |
label.requestFocus(); |
|
454 |
} |
|
455 |
} |
|
456 |
||
457 |
private void doRelease(JLabel label) { |
|
458 |
Component labelFor = label.getLabelFor(); |
|
459 |
if (labelFor != null && labelFor.isEnabled()) { |
|
460 |
InputMap inputMap = SwingUtilities.getUIInputMap(label, JComponent.WHEN_FOCUSED); |
|
461 |
if (inputMap != null) { |
|
462 |
// inputMap should never be null. |
|
463 |
inputMap.remove(KeyStroke.getKeyStroke(label.getDisplayedMnemonic(), ActionEvent.ALT_MASK, true)); |
|
464 |
inputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ALT, 0, true)); |
|
465 |
} |
|
466 |
if (labelFor instanceof Container && |
|
467 |
((Container) labelFor).isFocusCycleRoot()) { |
|
468 |
labelFor.requestFocus(); |
|
469 |
} else { |
|
470 |
SwingUtilities2.compositeRequestFocus(labelFor); |
|
471 |
} |
|
472 |
} |
|
473 |
} |
|
474 |
} |
|
475 |
} |