1 |
/* DefaultTreeCellRenderer.java |
/* DefaultTreeCellRenderer.java |
2 |
Copyright (C) 2002, 2004 Free Software Foundation, Inc. |
Copyright (C) 2002, 2004 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
6 |
|
GNU Classpath is free software; you can redistribute it and/or modify |
7 |
|
it under the terms of the GNU General Public License as published by |
8 |
|
the Free Software Foundation; either version 2, or (at your option) |
9 |
|
any later version. |
10 |
|
|
11 |
|
GNU Classpath is distributed in the hope that it will be useful, but |
12 |
|
WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 |
|
General Public License for more details. |
15 |
|
|
16 |
|
You should have received a copy of the GNU General Public License |
17 |
|
along with GNU Classpath; see the file COPYING. If not, write to the |
18 |
|
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
19 |
|
02110-1301 USA. |
20 |
|
|
21 |
|
Linking this library statically or dynamically with other modules is |
22 |
|
making a combined work based on this library. Thus, the terms and |
23 |
|
conditions of the GNU General Public License cover the whole |
24 |
|
combination. |
25 |
|
|
26 |
|
As a special exception, the copyright holders of this library give you |
27 |
|
permission to link this library with independent modules to produce an |
28 |
|
executable, regardless of the license terms of these independent |
29 |
|
modules, and to copy and distribute the resulting executable under |
30 |
|
terms of your choice, provided that you also meet, for each linked |
31 |
|
independent module, the terms and conditions of the license of that |
32 |
|
module. An independent module is a module which is not derived from |
33 |
|
or based on this library. If you modify this library, you may extend |
34 |
|
this exception to your version of the library, but you are not |
35 |
|
obligated to do so. If you do not wish to do so, delete this |
36 |
|
exception statement from your version. */ |
37 |
|
|
|
GNU Classpath is free software; you can redistribute it and/or modify |
|
|
it under the terms of the GNU General Public License as published by |
|
|
the Free Software Foundation; either version 2, or (at your option) |
|
|
any later version. |
|
|
|
|
|
GNU Classpath is distributed in the hope that it will be useful, but |
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
General Public License for more details. |
|
|
|
|
|
You should have received a copy of the GNU General Public License |
|
|
along with GNU Classpath; see the file COPYING. If not, write to the |
|
|
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
|
02110-1301 USA. |
|
|
|
|
|
Linking this library statically or dynamically with other modules is |
|
|
making a combined work based on this library. Thus, the terms and |
|
|
conditions of the GNU General Public License cover the whole |
|
|
combination. |
|
|
|
|
|
As a special exception, the copyright holders of this library give you |
|
|
permission to link this library with independent modules to produce an |
|
|
executable, regardless of the license terms of these independent |
|
|
modules, and to copy and distribute the resulting executable under |
|
|
terms of your choice, provided that you also meet, for each linked |
|
|
independent module, the terms and conditions of the license of that |
|
|
module. An independent module is a module which is not derived from |
|
|
or based on this library. If you modify this library, you may extend |
|
|
this exception to your version of the library, but you are not |
|
|
obligated to do so. If you do not wish to do so, delete this |
|
|
exception statement from your version. */ |
|
38 |
|
|
39 |
package javax.swing.tree; |
package javax.swing.tree; |
40 |
|
|
62 |
* @author Andrew Selkirk |
* @author Andrew Selkirk |
63 |
*/ |
*/ |
64 |
public class DefaultTreeCellRenderer |
public class DefaultTreeCellRenderer |
65 |
extends JLabel |
extends JLabel |
66 |
implements TreeCellRenderer |
implements TreeCellRenderer |
67 |
{ |
{ |
68 |
// ------------------------------------------------------------- |
// ------------------------------------------------------------- |
69 |
// Variables -------------------------------------------------- |
// Variables -------------------------------------------------- |
70 |
// ------------------------------------------------------------- |
// ------------------------------------------------------------- |
71 |
|
|
72 |
/** |
/** |
73 |
* selected |
* selected |
74 |
*/ |
*/ |
75 |
protected boolean selected; |
protected boolean selected; |
76 |
|
|
77 |
/** |
/** |
78 |
* hasFocus |
* hasFocus |
79 |
*/ |
*/ |
80 |
protected boolean hasFocus; |
protected boolean hasFocus; |
81 |
|
|
82 |
/** |
/** |
83 |
* drawsFocusBorderAroundIcon |
* drawsFocusBorderAroundIcon |
84 |
*/ |
*/ |
85 |
private boolean drawsFocusBorderAroundIcon; |
private boolean drawsFocusBorderAroundIcon; |
86 |
|
|
87 |
/** |
/** |
88 |
* closedIcon |
* closedIcon |
89 |
*/ |
*/ |
90 |
protected transient Icon closedIcon; |
protected transient Icon closedIcon; |
91 |
|
|
92 |
/** |
/** |
93 |
* leafIcon |
* leafIcon |
94 |
*/ |
*/ |
95 |
protected transient Icon leafIcon; |
protected transient Icon leafIcon; |
96 |
|
|
97 |
/** |
/** |
98 |
* openIcon |
* openIcon |
99 |
*/ |
*/ |
100 |
protected transient Icon openIcon; |
protected transient Icon openIcon; |
101 |
|
|
102 |
/** |
/** |
103 |
* textSelectionColor |
* textSelectionColor |
104 |
*/ |
*/ |
105 |
protected Color textSelectionColor; |
protected Color textSelectionColor; |
106 |
|
|
107 |
/** |
/** |
108 |
* textNonSelectionColor |
* textNonSelectionColor |
109 |
*/ |
*/ |
110 |
protected Color textNonSelectionColor; |
protected Color textNonSelectionColor; |
111 |
|
|
112 |
/** |
/** |
113 |
* backgroundSelectionColor |
* backgroundSelectionColor |
114 |
*/ |
*/ |
115 |
protected Color backgroundSelectionColor; |
protected Color backgroundSelectionColor; |
116 |
|
|
117 |
/** |
/** |
118 |
* backgroundNonSelectionColor |
* backgroundNonSelectionColor |
119 |
*/ |
*/ |
120 |
protected Color backgroundNonSelectionColor; |
protected Color backgroundNonSelectionColor; |
121 |
|
|
122 |
/** |
/** |
123 |
* borderSelectionColor |
* borderSelectionColor |
124 |
*/ |
*/ |
125 |
protected Color borderSelectionColor; |
protected Color borderSelectionColor; |
126 |
|
|
127 |
|
// ------------------------------------------------------------- |
128 |
// ------------------------------------------------------------- |
// Initialization --------------------------------------------- |
129 |
// Initialization --------------------------------------------- |
// ------------------------------------------------------------- |
130 |
// ------------------------------------------------------------- |
|
131 |
|
/** |
132 |
/** |
* Constructor DefaultTreeCellRenderer |
133 |
* Constructor DefaultTreeCellRenderer |
*/ |
134 |
*/ |
public DefaultTreeCellRenderer() |
135 |
public DefaultTreeCellRenderer() |
{ |
136 |
{ |
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); |
137 |
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); |
|
138 |
|
setLeafIcon(getDefaultLeafIcon()); |
139 |
setLeafIcon(getDefaultLeafIcon()); |
setOpenIcon(getDefaultOpenIcon()); |
140 |
setOpenIcon(getDefaultOpenIcon()); |
setClosedIcon(getDefaultClosedIcon()); |
141 |
setClosedIcon(getDefaultClosedIcon()); |
|
142 |
|
setTextNonSelectionColor(defaults.getColor("Tree.textForeground")); |
143 |
setTextNonSelectionColor(defaults.getColor("Tree.textForeground")); |
setTextSelectionColor(defaults.getColor("Tree.selectionForeground")); |
144 |
setTextSelectionColor(defaults.getColor("Tree.selectionForeground")); |
setBackgroundNonSelectionColor(defaults.getColor("Tree.nonSelectionBackground")); |
145 |
setBackgroundNonSelectionColor(defaults |
setBackgroundSelectionColor(defaults.getColor("Tree.selectionBackground")); |
146 |
.getColor("Tree.nonSelectionBackground")); |
setBorderSelectionColor(defaults.getColor("Tree.selectionBorderColor")); |
147 |
setBackgroundSelectionColor(defaults |
} |
148 |
.getColor("Tree.selectionBackground")); |
|
149 |
setBorderSelectionColor(defaults |
// ------------------------------------------------------------- |
150 |
.getColor("Tree.selectionBorderColor")); |
// Methods ---------------------------------------------------- |
151 |
} |
// ------------------------------------------------------------- |
152 |
|
|
153 |
// ------------------------------------------------------------- |
/** |
154 |
// Methods ---------------------------------------------------- |
* getDefaultOpenIcon |
155 |
// ------------------------------------------------------------- |
* |
156 |
|
* @returns Icon |
157 |
/** |
*/ |
158 |
* getDefaultOpenIcon |
public Icon getDefaultOpenIcon() |
159 |
* |
{ |
160 |
* @returns Icon |
return UIManager.getLookAndFeelDefaults().getIcon("Tree.openIcon"); |
161 |
*/ |
} |
162 |
public Icon getDefaultOpenIcon() |
|
163 |
{ |
/** |
164 |
return UIManager.getLookAndFeelDefaults().getIcon("Tree.openIcon"); |
* getDefaultClosedIcon |
165 |
} |
* |
166 |
|
* @returns Icon |
167 |
/** |
*/ |
168 |
* getDefaultClosedIcon |
public Icon getDefaultClosedIcon() |
169 |
* |
{ |
170 |
* @returns Icon |
return UIManager.getLookAndFeelDefaults().getIcon("Tree.closedIcon"); |
171 |
*/ |
} |
172 |
public Icon getDefaultClosedIcon() |
|
173 |
{ |
/** |
174 |
return UIManager.getLookAndFeelDefaults().getIcon("Tree.closedIcon"); |
* getDefaultLeafIcon |
175 |
} |
* |
176 |
|
* @returns Icon |
177 |
/** |
*/ |
178 |
* getDefaultLeafIcon |
public Icon getDefaultLeafIcon() |
179 |
* |
{ |
180 |
* @returns Icon |
return UIManager.getLookAndFeelDefaults().getIcon("Tree.leafIcon"); |
181 |
*/ |
} |
182 |
public Icon getDefaultLeafIcon() |
|
183 |
{ |
/** |
184 |
return UIManager.getLookAndFeelDefaults().getIcon("Tree.leafIcon"); |
* setOpenIcon |
185 |
} |
* |
186 |
|
* @param i |
187 |
/** |
* the icon. |
188 |
* setOpenIcon |
*/ |
189 |
* |
public void setOpenIcon(Icon i) |
190 |
* @param i the icon. |
{ |
191 |
*/ |
openIcon = i; |
192 |
public void setOpenIcon(Icon i) |
} |
193 |
{ |
|
194 |
openIcon = i; |
/** |
195 |
} |
* getOpenIcon |
196 |
|
* |
197 |
/** |
* @returns Icon |
198 |
* getOpenIcon |
*/ |
199 |
* |
public Icon getOpenIcon() |
200 |
* @returns Icon |
{ |
201 |
*/ |
return openIcon; |
202 |
public Icon getOpenIcon() |
} |
203 |
{ |
|
204 |
return openIcon; |
/** |
205 |
} |
* setClosedIcon |
206 |
|
* |
207 |
/** |
* @param i |
208 |
* setClosedIcon |
* the icon. |
209 |
* |
*/ |
210 |
* @param i the icon. |
public void setClosedIcon(Icon i) |
211 |
*/ |
{ |
212 |
public void setClosedIcon(Icon i) |
closedIcon = i; |
213 |
{ |
} |
214 |
closedIcon = i; |
|
215 |
} |
/** |
216 |
|
* getClosedIcon |
217 |
/** |
* |
218 |
* getClosedIcon |
* @returns Icon |
219 |
* |
*/ |
220 |
* @returns Icon |
public Icon getClosedIcon() |
221 |
*/ |
{ |
222 |
public Icon getClosedIcon() |
return closedIcon; |
223 |
{ |
} |
224 |
return closedIcon; |
|
225 |
} |
/** |
226 |
|
* setLeafIcon |
227 |
/** |
* |
228 |
* setLeafIcon |
* @param i |
229 |
* |
* the icon. |
230 |
* @param i the icon. |
*/ |
231 |
*/ |
public void setLeafIcon(Icon i) |
232 |
public void setLeafIcon(Icon i) |
{ |
233 |
{ |
leafIcon = i; |
234 |
leafIcon = i; |
} |
235 |
} |
|
236 |
|
/** |
237 |
/** |
* getLeafIcon |
238 |
* getLeafIcon |
* |
239 |
* |
* @returns Icon |
240 |
* @returns Icon |
*/ |
241 |
*/ |
public Icon getLeafIcon() |
242 |
public Icon getLeafIcon() |
{ |
243 |
{ |
return leafIcon; |
244 |
return leafIcon; |
} |
245 |
} |
|
246 |
|
/** |
247 |
/** |
* setTextSelectionColor |
248 |
* setTextSelectionColor |
* |
249 |
* |
* @param c |
250 |
* @param c the color. |
* the color. |
251 |
*/ |
*/ |
252 |
public void setTextSelectionColor(Color c) |
public void setTextSelectionColor(Color c) |
253 |
{ |
{ |
254 |
textSelectionColor = c; |
textSelectionColor = c; |
255 |
} |
} |
256 |
|
|
257 |
/** |
/** |
258 |
* getTextSelectionColor |
* getTextSelectionColor |
259 |
* |
* |
260 |
* @returns Color |
* @returns Color |
261 |
*/ |
*/ |
262 |
public Color getTextSelectionColor() |
public Color getTextSelectionColor() |
263 |
{ |
{ |
264 |
return textSelectionColor; |
return textSelectionColor; |
265 |
} |
} |
266 |
|
|
267 |
/** |
/** |
268 |
* setTextNonSelectionColor |
* setTextNonSelectionColor |
269 |
* |
* |
270 |
* @param c the color. |
* @param c |
271 |
*/ |
* the color. |
272 |
public void setTextNonSelectionColor(Color c) |
*/ |
273 |
{ |
public void setTextNonSelectionColor(Color c) |
274 |
textNonSelectionColor = c; |
{ |
275 |
} |
textNonSelectionColor = c; |
276 |
|
} |
277 |
/** |
|
278 |
* getTextNonSelectionColor |
/** |
279 |
* |
* getTextNonSelectionColor |
280 |
* @returns Color |
* |
281 |
*/ |
* @returns Color |
282 |
public Color getTextNonSelectionColor() |
*/ |
283 |
{ |
public Color getTextNonSelectionColor() |
284 |
return textNonSelectionColor; |
{ |
285 |
} |
return textNonSelectionColor; |
286 |
|
} |
287 |
/** |
|
288 |
* setBackgroundSelectionColor |
/** |
289 |
* |
* setBackgroundSelectionColor |
290 |
* @param c the color. |
* |
291 |
*/ |
* @param c |
292 |
public void setBackgroundSelectionColor(Color c) |
* the color. |
293 |
{ |
*/ |
294 |
backgroundSelectionColor = c; |
public void setBackgroundSelectionColor(Color c) |
295 |
} |
{ |
296 |
|
backgroundSelectionColor = c; |
297 |
/** |
} |
298 |
* getBackgroundSelectionColor |
|
299 |
* |
/** |
300 |
* @returns Color |
* getBackgroundSelectionColor |
301 |
*/ |
* |
302 |
public Color getBackgroundSelectionColor() |
* @returns Color |
303 |
{ |
*/ |
304 |
return backgroundSelectionColor; |
public Color getBackgroundSelectionColor() |
305 |
} |
{ |
306 |
|
return backgroundSelectionColor; |
307 |
/** |
} |
308 |
* setBackgroundNonSelectionColor |
|
309 |
* |
/** |
310 |
* @param c the color. |
* setBackgroundNonSelectionColor |
311 |
*/ |
* |
312 |
public void setBackgroundNonSelectionColor(Color c) |
* @param c |
313 |
{ |
* the color. |
314 |
backgroundNonSelectionColor = c; |
*/ |
315 |
} |
public void setBackgroundNonSelectionColor(Color c) |
316 |
|
{ |
317 |
/** |
backgroundNonSelectionColor = c; |
318 |
* getBackgroundNonSelectionColor |
} |
319 |
* |
|
320 |
* @returns Color |
/** |
321 |
*/ |
* getBackgroundNonSelectionColor |
322 |
public Color getBackgroundNonSelectionColor() |
* |
323 |
{ |
* @returns Color |
324 |
return backgroundNonSelectionColor; |
*/ |
325 |
} |
public Color getBackgroundNonSelectionColor() |
326 |
|
{ |
327 |
/** |
return backgroundNonSelectionColor; |
328 |
* setBorderSelectionColor |
} |
329 |
* |
|
330 |
* @param c the color. |
/** |
331 |
*/ |
* setBorderSelectionColor |
332 |
public void setBorderSelectionColor(Color c) |
* |
333 |
{ |
* @param c |
334 |
borderSelectionColor = c; |
* the color. |
335 |
} |
*/ |
336 |
|
public void setBorderSelectionColor(Color c) |
337 |
/** |
{ |
338 |
* getBorderSelectionColor |
borderSelectionColor = c; |
339 |
* |
} |
340 |
* @returns Color |
|
341 |
*/ |
/** |
342 |
public Color getBorderSelectionColor() |
* getBorderSelectionColor |
343 |
{ |
* |
344 |
return borderSelectionColor; |
* @returns Color |
345 |
} |
*/ |
346 |
|
public Color getBorderSelectionColor() |
347 |
/** |
{ |
348 |
* setFont |
return borderSelectionColor; |
349 |
* |
} |
350 |
* @param f the font. |
|
351 |
*/ |
/** |
352 |
public void setFont(Font f) |
* setFont |
353 |
{ |
* |
354 |
if (f != null && f instanceof UIResource) |
* @param f |
355 |
f = null; |
* the font. |
356 |
super.setFont(f); |
*/ |
357 |
} |
public void setFont(Font f) |
358 |
|
{ |
359 |
/** |
if (f != null && f instanceof UIResource) |
360 |
* setBackground |
f = null; |
361 |
* |
super.setFont(f); |
362 |
* @param c the color. |
} |
363 |
*/ |
|
364 |
public void setBackground(Color c) |
/** |
365 |
{ |
* setBackground |
366 |
if (c != null && c instanceof UIResource) |
* |
367 |
c = null; |
* @param c |
368 |
super.setBackground(c); |
* the color. |
369 |
} |
*/ |
370 |
|
public void setBackground(Color c) |
371 |
/** |
{ |
372 |
* getTreeCellRendererComponent |
if (c != null && c instanceof UIResource) |
373 |
* |
c = null; |
374 |
* @param tree TODO |
super.setBackground(c); |
375 |
* @param val TODO |
} |
376 |
* @param selected TODO |
|
377 |
* @param expanded TODO |
/** |
378 |
* @param leaf TODO |
* getTreeCellRendererComponent |
379 |
* @param row TODO |
* |
380 |
* @param hasFocus TODO |
* @param tree |
381 |
* @returns Component |
* TODO |
382 |
*/ |
* @param val |
383 |
public Component getTreeCellRendererComponent(JTree tree, Object val, |
* TODO |
384 |
boolean selected, boolean expanded, boolean leaf, int row, |
* @param selected |
385 |
boolean hasFocus) |
* TODO |
386 |
{ |
* @param expanded |
387 |
if (leaf) |
* TODO |
388 |
setIcon(getLeafIcon()); |
* @param leaf |
389 |
else if (expanded) |
* TODO |
390 |
setIcon(getOpenIcon()); |
* @param row |
391 |
else |
* TODO |
392 |
setIcon(getClosedIcon()); |
* @param hasFocus |
393 |
|
* TODO |
394 |
setText(val.toString()); |
* @returns Component |
395 |
this.selected = selected; |
*/ |
396 |
this.hasFocus = hasFocus; |
public Component getTreeCellRendererComponent(JTree tree, Object val, |
397 |
setHorizontalAlignment(LEFT); |
boolean selected, |
398 |
setOpaque(false); |
boolean expanded, boolean leaf, |
399 |
setVerticalAlignment(TOP); |
int row, boolean hasFocus) |
400 |
setEnabled(true); |
{ |
401 |
super.setFont(UIManager.getLookAndFeelDefaults().getFont("Tree.font")); |
if (leaf) |
402 |
|
setIcon(getLeafIcon()); |
403 |
if (selected) |
else if (expanded) |
404 |
{ |
setIcon(getOpenIcon()); |
405 |
super.setBackground(getBackgroundSelectionColor()); |
else |
406 |
setForeground(getTextSelectionColor()); |
setIcon(getClosedIcon()); |
407 |
setBorderSelectionColor(UIManager.getLookAndFeelDefaults() |
|
408 |
.getColor("Tree.selectionBorderColor")); |
setText(val.toString()); |
409 |
} |
this.selected = selected; |
410 |
else |
this.hasFocus = hasFocus; |
411 |
{ |
setHorizontalAlignment(LEFT); |
412 |
super.setBackground(getBackgroundNonSelectionColor()); |
setOpaque(false); |
413 |
setForeground(getTextNonSelectionColor()); |
setVerticalAlignment(TOP); |
414 |
setBorderSelectionColor(null); |
setEnabled(true); |
415 |
} |
super.setFont(UIManager.getLookAndFeelDefaults().getFont("Tree.font")); |
416 |
|
|
417 |
return this; |
if (selected) |
418 |
} |
{ |
419 |
|
super.setBackground(getBackgroundSelectionColor()); |
420 |
/** |
setForeground(getTextSelectionColor()); |
421 |
* getFont |
setBorderSelectionColor(UIManager.getLookAndFeelDefaults().getColor( |
422 |
* |
"Tree.selectionBorderColor")); |
423 |
* @return the current Font |
} |
424 |
*/ |
else |
425 |
public Font getFont() |
{ |
426 |
{ |
super.setBackground(getBackgroundNonSelectionColor()); |
427 |
return super.getFont(); |
setForeground(getTextNonSelectionColor()); |
428 |
} |
setBorderSelectionColor(null); |
429 |
|
} |
430 |
/** |
|
431 |
* Paints the value. The background is filled based on selected. |
return this; |
432 |
* |
} |
433 |
* @param g the graphics device. |
|
434 |
*/ |
/** |
435 |
public void paint(Graphics g) |
* getFont |
436 |
{ |
* |
437 |
// paint background |
* @return the current Font |
438 |
Rectangle vr = new Rectangle(); |
*/ |
439 |
Rectangle ir = new Rectangle(); |
public Font getFont() |
440 |
Rectangle tr = new Rectangle(); |
{ |
441 |
|
return super.getFont(); |
442 |
Insets insets = new Insets(0, 0, 0, 0); |
} |
443 |
Border border = UIManager.getLookAndFeelDefaults().getBorder |
|
444 |
("Tree.selectionBorder"); |
/** |
445 |
if (border != null) |
* Paints the value. The background is filled based on selected. |
446 |
insets = border.getBorderInsets(this); |
* |
447 |
|
* @param g |
448 |
FontMetrics fm = getToolkit().getFontMetrics(getFont()); |
* the graphics device. |
449 |
SwingUtilities.layoutCompoundLabel(((JLabel) this), fm, getText(), |
*/ |
450 |
getIcon(), getVerticalAlignment(), |
public void paint(Graphics g) |
451 |
getHorizontalAlignment(), |
{ |
452 |
getVerticalTextPosition(), |
// paint background |
453 |
getHorizontalTextPosition(), vr, ir, tr, |
Rectangle vr = new Rectangle(); |
454 |
getIconTextGap()); |
Rectangle ir = new Rectangle(); |
455 |
|
Rectangle tr = new Rectangle(); |
456 |
g.setColor(super.getBackground()); |
|
457 |
g.fillRect(tr.x, tr.y, tr.width, tr.height - insets.top - |
Insets insets = new Insets(0, 0, 0, 0); |
458 |
insets.bottom); |
Border border = UIManager.getLookAndFeelDefaults().getBorder( |
459 |
|
"Tree.selectionBorder"); |
460 |
// paint border |
if (border != null) |
461 |
Color b = getBorderSelectionColor(); |
insets = border.getBorderInsets(this); |
462 |
if (b != null) |
|
463 |
{ |
FontMetrics fm = getToolkit().getFontMetrics(getFont()); |
464 |
g.setColor(b); |
SwingUtilities.layoutCompoundLabel(((JLabel) this), fm, getText(), |
465 |
g.drawRect(tr.x, tr.y, tr.width, tr.height - insets.top - |
getIcon(), getVerticalAlignment(), |
466 |
insets.bottom); |
getHorizontalAlignment(), |
467 |
} |
getVerticalTextPosition(), |
468 |
super.paint(g); |
getHorizontalTextPosition(), vr, ir, tr, |
469 |
} |
getIconTextGap()); |
470 |
|
|
471 |
/** |
g.setColor(super.getBackground()); |
472 |
* returns the preferred size of the cell. |
g.fillRect(tr.x, tr.y, tr.width, tr.height - insets.top - insets.bottom); |
473 |
* |
|
474 |
* @returns Dimension |
// paint border |
475 |
*/ |
Color b = getBorderSelectionColor(); |
476 |
public Dimension getPreferredSize() |
if (b != null) |
477 |
{ |
{ |
478 |
return null; // TODO |
g.setColor(b); |
479 |
} // getPreferredSize() |
g.drawRect(tr.x, tr.y, tr.width, tr.height - insets.top - insets.bottom); |
480 |
|
} |
481 |
/** |
super.paint(g); |
482 |
* validate |
} |
483 |
*/ |
|
484 |
public void validate() |
/** |
485 |
{ |
* returns the preferred size of the cell. |
486 |
// Overridden for performance reasons. |
* |
487 |
} // validate() |
* @returns Dimension |
488 |
|
*/ |
489 |
/** |
public Dimension getPreferredSize() |
490 |
* revalidate |
{ |
491 |
*/ |
Rectangle vr = new Rectangle(); |
492 |
public void revalidate() |
Rectangle ir = new Rectangle(); |
493 |
{ |
Rectangle tr = new Rectangle(); |
494 |
// Overridden for performance reasons. |
|
495 |
} // revalidate() |
FontMetrics fm = getToolkit().getFontMetrics(getFont()); |
496 |
|
SwingUtilities.layoutCompoundLabel(((JLabel) this), fm, getText(), |
497 |
/** |
getIcon(), getVerticalAlignment(), |
498 |
* repaint |
getHorizontalAlignment(), |
499 |
* |
getVerticalTextPosition(), |
500 |
* @param value0 TODO |
getHorizontalTextPosition(), vr, ir, tr, |
501 |
* @param value1 TODO |
getIconTextGap()); |
502 |
* @param value2 TODO |
Rectangle cr = ir.union(tr); |
503 |
* @param value3 TODO |
return new Dimension(cr.width, cr.height); |
504 |
* @param value4 TODO |
} // getPreferredSize() |
505 |
*/ |
|
506 |
public void repaint(long value0, int value1, int value2, int value3, |
/** |
507 |
int value4) |
* validate |
508 |
{ |
*/ |
509 |
// Overridden for performance reasons. |
public void validate() |
510 |
} // repaint() |
{ |
511 |
|
// Overridden for performance reasons. |
512 |
/** |
} // validate() |
513 |
* repaint |
|
514 |
* |
/** |
515 |
* @param value0 TODO |
* revalidate |
516 |
*/ |
*/ |
517 |
public void repaint(Rectangle value0) |
public void revalidate() |
518 |
{ |
{ |
519 |
// Overridden for performance reasons. |
// Overridden for performance reasons. |
520 |
} // repaint() |
} // revalidate() |
521 |
|
|
522 |
/** |
/** |
523 |
* firePropertyChange |
* repaint |
524 |
* |
* |
525 |
* @param value0 TODO |
* @param value0 |
526 |
* @param value1 TODO |
* TODO |
527 |
* @param value2 TODO |
* @param value1 |
528 |
*/ |
* TODO |
529 |
protected void firePropertyChange(String value0, Object value1, |
* @param value2 |
530 |
Object value2) |
* TODO |
531 |
{ |
* @param value3 |
532 |
// Overridden for performance reasons. |
* TODO |
533 |
} // firePropertyChange() |
* @param value4 |
534 |
|
* TODO |
535 |
/** |
*/ |
536 |
* firePropertyChange |
public void repaint(long value0, int value1, int value2, int value3, |
537 |
* |
int value4) |
538 |
* @param value0 TODO |
{ |
539 |
* @param value1 TODO |
// Overridden for performance reasons. |
540 |
* @param value2 TODO |
} // repaint() |
541 |
*/ |
|
542 |
public void firePropertyChange(String value0, byte value1, byte value2) |
/** |
543 |
{ |
* repaint |
544 |
// Overridden for performance reasons. |
* |
545 |
} // firePropertyChange() |
* @param value0 |
546 |
|
* TODO |
547 |
/** |
*/ |
548 |
* firePropertyChange |
public void repaint(Rectangle value0) |
549 |
* |
{ |
550 |
* @param value0 TODO |
// Overridden for performance reasons. |
551 |
* @param value1 TODO |
} // repaint() |
552 |
* @param value2 TODO |
|
553 |
*/ |
/** |
554 |
public void firePropertyChange(String value0, char value1, char value2) |
* firePropertyChange |
555 |
{ |
* |
556 |
// Overridden for performance reasons. |
* @param value0 |
557 |
} // firePropertyChange() |
* TODO |
558 |
|
* @param value1 |
559 |
/** |
* TODO |
560 |
* firePropertyChange |
* @param value2 |
561 |
* |
* TODO |
562 |
* @param value0 TODO |
*/ |
563 |
* @param value1 TODO |
protected void firePropertyChange(String value0, Object value1, Object value2) |
564 |
* @param value2 TODO |
{ |
565 |
*/ |
// Overridden for performance reasons. |
566 |
public void firePropertyChange(String value0, short value1, short value2) |
} // firePropertyChange() |
567 |
{ |
|
568 |
// Overridden for performance reasons. |
/** |
569 |
} // firePropertyChange() |
* firePropertyChange |
570 |
|
* |
571 |
/** |
* @param value0 |
572 |
* firePropertyChange |
* TODO |
573 |
* |
* @param value1 |
574 |
* @param value0 TODO |
* TODO |
575 |
* @param value1 TODO |
* @param value2 |
576 |
* @param value2 TODO |
* TODO |
577 |
*/ |
*/ |
578 |
public void firePropertyChange(String value0, int value1, int value2) |
public void firePropertyChange(String value0, byte value1, byte value2) |
579 |
{ |
{ |
580 |
// Overridden for performance reasons. |
// Overridden for performance reasons. |
581 |
} // firePropertyChange() |
} // firePropertyChange() |
582 |
|
|
583 |
/** |
/** |
584 |
* firePropertyChange |
* firePropertyChange |
585 |
* |
* |
586 |
* @param value0 TODO |
* @param value0 |
587 |
* @param value1 TODO |
* TODO |
588 |
* @param value2 TODO |
* @param value1 |
589 |
*/ |
* TODO |
590 |
public void firePropertyChange(String value0, long value1, long value2) |
* @param value2 |
591 |
{ |
* TODO |
592 |
// Overridden for performance reasons. |
*/ |
593 |
} // firePropertyChange() |
public void firePropertyChange(String value0, char value1, char value2) |
594 |
|
{ |
595 |
/** |
// Overridden for performance reasons. |
596 |
* firePropertyChange |
} // firePropertyChange() |
597 |
* |
|
598 |
* @param value0 TODO |
/** |
599 |
* @param value1 TODO |
* firePropertyChange |
600 |
* @param value2 TODO |
* |
601 |
*/ |
* @param value0 |
602 |
public void firePropertyChange(String value0, float value1, float value2) |
* TODO |
603 |
{ |
* @param value1 |
604 |
// Overridden for performance reasons. |
* TODO |
605 |
} // firePropertyChange() |
* @param value2 |
606 |
|
* TODO |
607 |
/** |
*/ |
608 |
* firePropertyChange |
public void firePropertyChange(String value0, short value1, short value2) |
609 |
* |
{ |
610 |
* @param value0 TODO |
// Overridden for performance reasons. |
611 |
* @param value1 TODO |
} // firePropertyChange() |
612 |
* @param value2 TODO |
|
613 |
*/ |
/** |
614 |
public void firePropertyChange(String value0, double value1, double value2) |
* firePropertyChange |
615 |
{ |
* |
616 |
// Overridden for performance reasons. |
* @param value0 |
617 |
} // firePropertyChange() |
* TODO |
618 |
|
* @param value1 |
619 |
/** |
* TODO |
620 |
* firePropertyChange |
* @param value2 |
621 |
* |
* TODO |
622 |
* @param name the property name. |
*/ |
623 |
* @param v1 the old value. |
public void firePropertyChange(String value0, int value1, int value2) |
624 |
* @param v2 the new value. |
{ |
625 |
*/ |
// Overridden for performance reasons. |
626 |
public void firePropertyChange(String name, boolean v1, boolean v2) |
} // firePropertyChange() |
627 |
{ |
|
628 |
// Overridden for performance reasons. |
/** |
629 |
} // firePropertyChange() |
* firePropertyChange |
630 |
|
* |
631 |
|
* @param value0 |
632 |
|
* TODO |
633 |
|
* @param value1 |
634 |
|
* TODO |
635 |
|
* @param value2 |
636 |
|
* TODO |
637 |
|
*/ |
638 |
|
public void firePropertyChange(String value0, long value1, long value2) |
639 |
|
{ |
640 |
|
// Overridden for performance reasons. |
641 |
|
} // firePropertyChange() |
642 |
|
|
643 |
|
/** |
644 |
|
* firePropertyChange |
645 |
|
* |
646 |
|
* @param value0 |
647 |
|
* TODO |
648 |
|
* @param value1 |
649 |
|
* TODO |
650 |
|
* @param value2 |
651 |
|
* TODO |
652 |
|
*/ |
653 |
|
public void firePropertyChange(String value0, float value1, float value2) |
654 |
|
{ |
655 |
|
// Overridden for performance reasons. |
656 |
|
} // firePropertyChange() |
657 |
|
|
658 |
|
/** |
659 |
|
* firePropertyChange |
660 |
|
* |
661 |
|
* @param value0 TODO |
662 |
|
* @param value1 TODO |
663 |
|
* @param value2 TODO |
664 |
|
*/ |
665 |
|
public void firePropertyChange(String value0, double value1, double value2) |
666 |
|
{ |
667 |
|
// Overridden for performance reasons. |
668 |
|
} // firePropertyChange() |
669 |
|
|
670 |
|
/** |
671 |
|
* firePropertyChange |
672 |
|
* |
673 |
|
* @param name the property name. |
674 |
|
* @param v1 the old value. |
675 |
|
* @param v2 the new value. |
676 |
|
*/ |
677 |
|
public void firePropertyChange(String name, boolean v1, boolean v2) |
678 |
|
{ |
679 |
|
// Overridden for performance reasons. |
680 |
|
} // firePropertyChange() |
681 |
|
|
682 |
} // DefaultTreeCellRenderer |
} // DefaultTreeCellRenderer |