Merge from mainline (killloop-merge-20051122).
[official-gcc.git] / libjava / classpath / javax / swing / plaf / metal / MetalIconFactory.java
blobbcb86e6104779574968696462b7733163b1edd4e
1 /* MetalIconFactory.java --
2 Copyright (C) 2005 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
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.
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.
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.
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.
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. */
39 package javax.swing.plaf.metal;
41 import java.awt.Color;
42 import java.awt.Component;
43 import java.awt.Graphics;
44 import java.io.Serializable;
46 import javax.swing.AbstractButton;
47 import javax.swing.Icon;
48 import javax.swing.JCheckBox;
49 import javax.swing.JCheckBoxMenuItem;
50 import javax.swing.JFileChooser;
51 import javax.swing.JInternalFrame;
52 import javax.swing.JRadioButton;
53 import javax.swing.JRadioButtonMenuItem;
54 import javax.swing.JSlider;
55 import javax.swing.SwingConstants;
56 import javax.swing.UIManager;
57 import javax.swing.plaf.UIResource;
60 /**
61 * Creates icons for the {@link MetalLookAndFeel}.
63 public class MetalIconFactory implements Serializable
66 /** A constant representing "dark". */
67 public static final boolean DARK = false;
69 /** A constant representing "light". */
70 public static final boolean LIGHT = true;
72 /**
73 * An icon displayed for {@link JCheckBoxMenuItem} components.
75 private static class CheckBoxMenuItemIcon implements Icon, Serializable
77 /**
78 * Creates a new icon instance.
80 public CheckBoxMenuItemIcon()
82 // Nothing to do here.
85 /**
86 * Returns the width of the icon, in pixels.
88 * @return The width of the icon (10 pixels).
90 public int getIconWidth()
92 return 10;
95 /**
96 * Returns the height of the icon, in pixels.
98 * @return The height of the icon (10 pixels).
100 public int getIconHeight()
102 return 10;
106 * Paints the icon.
108 * @param c the component.
109 * @param g the graphics device.
110 * @param x the x-coordinate.
111 * @param y the y-coordinate.
113 public void paintIcon(Component c, Graphics g, int x, int y)
115 JCheckBoxMenuItem item = (JCheckBoxMenuItem) c;
117 if (item.isArmed())
118 g.setColor(MetalLookAndFeel.getBlack());
119 else
120 g.setColor(MetalLookAndFeel.getControlDarkShadow());
121 g.drawLine(x, y, x + 8, y);
122 g.drawLine(x, y + 1, x, y + 8);
123 g.drawLine(x + 2, y + 8, x + 8, y + 8);
124 g.drawLine(x + 8, y + 2, x + 8, y + 7);
126 g.setColor(MetalLookAndFeel.getWhite());
127 g.drawLine(x + 1, y + 1, x + 7, y + 1);
128 g.drawLine(x + 1, y + 2, x + 1, y + 7);
129 g.drawLine(x + 1, y + 9, x + 9, y + 9);
130 g.drawLine(x + 9, y + 1, x + 9, y + 8);
132 // if the item is selected, we should draw a tick
133 if (item.isSelected())
135 g.setColor(MetalLookAndFeel.getBlack());
136 g.fillRect(x + 2, y + 2, 2, 5);
137 for (int i = 0; i < 6; i++)
138 g.drawLine(x + 8 - i, y + i, x + 9 - i, y + i);
145 * An icon used for the "detail view" button on a {@link JFileChooser} under
146 * the {@link MetalLookAndFeel}.
148 * @see MetalIconFactory#getFileChooserDetailViewIcon()
150 private static class FileChooserDetailViewIcon implements Icon, Serializable
154 * Creates a new icon.
156 public FileChooserDetailViewIcon()
158 // Nothing to do here.
162 * Returns the width of the icon, in pixels.
164 * @return The width of the icon.
166 public int getIconWidth()
168 return 18;
172 * Returns the height of the icon, in pixels.
174 * @return The height of the icon.
176 public int getIconHeight()
178 return 18;
182 * Paints the icon using colors from the {@link MetalLookAndFeel}.
184 * @param c the component (ignored).
185 * @param g the graphics device.
186 * @param x the x-coordinate for the top-left of the icon.
187 * @param y the y-coordinate for the top-left of the icon.
189 public void paintIcon(Component c, Graphics g, int x, int y)
191 Color savedColor = g.getColor();
192 g.setColor(MetalLookAndFeel.getBlack());
194 // file 1 outline
195 g.drawLine(x + 2, y + 2, x + 5, y + 2);
196 g.drawLine(x + 6, y + 3, x + 6, y + 7);
197 g.drawLine(x + 2, y + 7, x + 6, y + 7);
198 g.drawLine(x + 2, y + 2, x + 2, y + 7);
200 // file 2 outline
201 g.drawLine(x + 2, y + 10, x + 5, y + 10);
202 g.drawLine(x + 6, y + 11, x + 6, y + 15);
203 g.drawLine(x + 2, y + 15, x + 6, y + 15);
204 g.drawLine(x + 2, y + 10, x + 2, y + 15);
206 // detail lines
207 g.drawLine(x + 8, y + 5, x + 15, y + 5);
208 g.drawLine(x + 8, y + 13, x + 15, y + 13);
210 // fill files
211 g.setColor(MetalLookAndFeel.getPrimaryControl());
212 g.fillRect(x + 3, y + 3, 3, 4);
213 g.fillRect(x + 3, y + 11, 3, 4);
215 // highlight files
216 g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
217 g.drawLine(x + 4, y + 4, x + 4, y + 5);
218 g.drawLine(x + 4, y + 12, x + 4, y + 13);
220 g.setColor(savedColor);
225 * An icon used for the "home folder" button on a {@link JFileChooser} under
226 * the {@link MetalLookAndFeel}.
228 * @see MetalIconFactory#getFileChooserHomeFolderIcon()
230 private static class FileChooserHomeFolderIcon implements Icon, Serializable
234 * Creates a new icon.
236 public FileChooserHomeFolderIcon()
238 // Nothing to do here.
242 * Returns the width of the icon, in pixels.
244 * @return The width of the icon.
246 public int getIconWidth()
248 return 18;
252 * Returns the height of the icon, in pixels.
254 * @return The height of the icon.
256 public int getIconHeight()
258 return 18;
262 * Paints the icon using colors from the {@link MetalLookAndFeel}.
264 * @param c the component (ignored).
265 * @param g the graphics device.
266 * @param x the x-coordinate for the top-left of the icon.
267 * @param y the y-coordinate for the top-left of the icon.
269 public void paintIcon(Component c, Graphics g, int x, int y)
271 Color savedColor = g.getColor();
272 g.setColor(MetalLookAndFeel.getBlack());
274 // roof
275 g.drawLine(x + 1, y + 8, x + 8, y + 1);
276 g.drawLine(x + 8, y + 1, x + 15, y + 8);
278 // base of house
279 g.drawLine(x + 3, y + 6, x + 3, y + 15);
280 g.drawLine(x + 3, y + 15, x + 13, y + 15);
281 g.drawLine(x + 13, y + 6, x + 13, y + 15);
283 // door frame
284 g.drawLine(x + 6, y + 9, x + 6, y + 15);
285 g.drawLine(x + 6, y + 9, x + 10, y + 9);
286 g.drawLine(x + 10, y + 9, x + 10, y + 15);
288 // chimney
289 g.drawLine(x + 11, y + 2, x + 11, y + 4);
290 g.drawLine(x + 12, y + 2, x + 12, y + 5);
292 g.setColor(MetalLookAndFeel.getControlDarkShadow());
294 // roof paint
295 int xx = x + 8;
296 for (int i = 0; i < 4; i++)
297 g.drawLine(xx - i, y + 2 + i, xx + i, y + 2 + i);
298 g.fillRect(x + 4, y + 6, 9, 2);
300 // door knob
301 g.drawLine(x + 9, y + 12, x + 9, y + 12);
303 // house paint
304 g.setColor(MetalLookAndFeel.getPrimaryControl());
305 g.drawLine(x + 4, y + 8, x + 12, y + 8);
306 g.fillRect(x + 4, y + 9, 2, 6);
307 g.fillRect(x + 11, y + 9, 2, 6);
309 g.setColor(savedColor);
314 * An icon used for the "list view" button on a {@link JFileChooser} under
315 * the {@link MetalLookAndFeel}.
317 * @see MetalIconFactory#getFileChooserListViewIcon()
319 private static class FileChooserListViewIcon implements Icon, Serializable
322 * Creates a new icon.
324 public FileChooserListViewIcon()
326 // Nothing to do here.
330 * Returns the width of the icon, in pixels.
332 * @return The width of the icon.
334 public int getIconWidth()
336 return 18;
340 * Returns the height of the icon, in pixels.
342 * @return The height of the icon.
344 public int getIconHeight()
346 return 18;
350 * Paints the icon using colors from the {@link MetalLookAndFeel}.
352 * @param c the component (ignored).
353 * @param g the graphics device.
354 * @param x the x-coordinate for the top-left of the icon.
355 * @param y the y-coordinate for the top-left of the icon.
357 public void paintIcon(Component c, Graphics g, int x, int y)
359 Color savedColor = g.getColor();
360 g.setColor(MetalLookAndFeel.getBlack());
362 // file 1 outline
363 g.drawLine(x + 2, y + 2, x + 5, y + 2);
364 g.drawLine(x + 6, y + 3, x + 6, y + 7);
365 g.drawLine(x + 2, y + 7, x + 6, y + 7);
366 g.drawLine(x + 2, y + 2, x + 2, y + 7);
368 // file 2 outline
369 g.drawLine(x + 2, y + 10, x + 5, y + 10);
370 g.drawLine(x + 6, y + 11, x + 6, y + 15);
371 g.drawLine(x + 2, y + 15, x + 6, y + 15);
372 g.drawLine(x + 2, y + 10, x + 2, y + 15);
374 // file 3 outline
375 g.drawLine(x + 10, y + 2, x + 13, y + 2);
376 g.drawLine(x + 14, y + 3, x + 14, y + 7);
377 g.drawLine(x + 10, y + 7, x + 14, y + 7);
378 g.drawLine(x + 10, y + 2, x + 10, y + 7);
380 // file 4 outline
381 g.drawLine(x + 10, y + 10, x + 13, y + 10);
382 g.drawLine(x + 14, y + 11, x + 14, y + 15);
383 g.drawLine(x + 10, y + 15, x + 14, y + 15);
384 g.drawLine(x + 10, y + 10, x + 10, y + 15);
386 g.drawLine(x + 8, y + 5, x + 8, y + 5);
387 g.drawLine(x + 8, y + 13, x + 8, y + 13);
388 g.drawLine(x + 16, y + 5, x + 16, y + 5);
389 g.drawLine(x + 16, y + 13, x + 16, y + 13);
391 // fill files
392 g.setColor(MetalLookAndFeel.getPrimaryControl());
393 g.fillRect(x + 3, y + 3, 3, 4);
394 g.fillRect(x + 3, y + 11, 3, 4);
395 g.fillRect(x + 11, y + 3, 3, 4);
396 g.fillRect(x + 11, y + 11, 3, 4);
398 // highlight files
399 g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
400 g.drawLine(x + 4, y + 4, x + 4, y + 5);
401 g.drawLine(x + 4, y + 12, x + 4, y + 13);
402 g.drawLine(x + 12, y + 4, x + 12, y + 5);
403 g.drawLine(x + 12, y + 12, x + 12, y + 13);
405 g.setColor(savedColor);
410 * An icon used for the "new folder" button on a {@link JFileChooser} under
411 * the {@link MetalLookAndFeel}.
413 * @see MetalIconFactory#getFileChooserNewFolderIcon()
415 private static class FileChooserNewFolderIcon implements Icon, Serializable
417 /**
418 * Creates a new icon.
420 public FileChooserNewFolderIcon()
422 // Nothing to do here.
426 * Returns the width of the icon, in pixels.
428 * @return The width of the icon.
430 public int getIconWidth()
432 return 18;
436 * Returns the height of the icon, in pixels.
438 * @return The height of the icon.
440 public int getIconHeight()
442 return 18;
446 * Paints the icon using colors from the {@link MetalLookAndFeel}.
448 * @param c the component (ignored).
449 * @param g the graphics device.
450 * @param x the x-coordinate for the top-left of the icon.
451 * @param y the y-coordinate for the top-left of the icon.
453 public void paintIcon(Component c, Graphics g, int x, int y)
455 Color savedColor = g.getColor();
456 g.setColor(MetalLookAndFeel.getBlack());
458 g.drawLine(x + 2, y + 5, x + 9, y + 5);
459 g.drawLine(x + 10, y + 6, x + 15, y + 6);
460 g.drawLine(x + 15, y + 5, x + 15, y + 14);
461 g.drawLine(x + 2, y + 14, x + 15, y + 14);
462 g.drawLine(x + 1, y + 6, x + 1, y + 14);
464 g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
465 g.drawLine(x + 11, y + 3, x + 15, y + 3);
466 g.drawLine(x + 10, y + 4, x + 15, y + 4);
468 g.setColor(MetalLookAndFeel.getPrimaryControl());
469 g.fillRect(x + 3, y + 7, 7, 7);
470 g.fillRect(x + 10, y + 8, 5, 6);
471 g.drawLine(x + 10, y + 5, x + 14, y + 5);
473 g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
474 g.drawLine(x + 10, y + 7, x + 14, y + 7);
475 g.drawLine(x + 2, y + 6, x + 9, y + 6);
476 g.drawLine(x + 2, y + 6, x + 2, y + 13);
477 g.setColor(savedColor);
482 * An icon used for the "up folder" button on a {@link JFileChooser} under
483 * the {@link MetalLookAndFeel}.
485 * @see MetalIconFactory#getFileChooserNewFolderIcon()
487 private static class FileChooserUpFolderIcon extends FileChooserNewFolderIcon
488 implements Icon, Serializable
491 * Creates a new icon.
493 public FileChooserUpFolderIcon()
495 // Nothing to do here.
499 * Paints the icon using colors from the {@link MetalLookAndFeel}.
501 * @param c the component (ignored).
502 * @param g the graphics device.
503 * @param x the x-coordinate for the top-left of the icon.
504 * @param y the y-coordinate for the top-left of the icon.
506 public void paintIcon(Component c, Graphics g, int x, int y)
508 Color savedColor = g.getColor();
510 // draw the folder
511 super.paintIcon(c, g, x, y);
513 // now draw the up arrow
514 g.setColor(MetalLookAndFeel.getBlack());
515 g.drawLine(x + 8, y + 9, x + 8, y + 16);
516 int xx = x + 8;
517 for (int i = 0; i < 4; i++)
518 g.drawLine(xx - i, y + 9 + i, xx + i, y + 9 + i);
519 g.setColor(savedColor);
524 * An icon representing a file (drawn as a piece of paper with the top-right
525 * corner turned down).
527 public static class FileIcon16 implements Icon, Serializable
530 * Returns the width of the icon, in pixels.
532 * @return The width of the icon.
534 public int getIconWidth()
536 return 16;
540 * Returns the height of the icon, in pixels. The height returned is
541 * <code>16</code> plus the value returned by
542 * {@link #getAdditionalHeight()}.
544 * @return The height of the icon.
546 public int getIconHeight()
548 return 16 + getAdditionalHeight();
552 * Paints the icon at the location (x, y).
554 * @param c the component.
555 * @param g the graphics context.
556 * @param x the x coordinate.
557 * @param y the y coordinate.
559 public void paintIcon(Component c, Graphics g, int x, int y)
561 // TODO: pick up appropriate UI colors
562 g.setColor(Color.black);
563 g.drawLine(x, y, x + 9, y);
564 g.drawLine(x, y + 1, x, y + 15);
565 g.drawLine(x, y + 15, x + 12, y + 15);
566 g.drawLine(x + 12, y + 15, x + 12, y + 6);
567 g.drawLine(x + 12, y + 6, x + 9, y);
569 g.drawLine(x + 7, y + 2, x + 11, y + 6);
570 g.drawLine(x + 8, y + 1, x + 9, y + 1);
572 g.setColor(new Color(204, 204, 255));
573 g.drawLine(x + 1, y + 1, x + 7, y + 1);
574 g.drawLine(x + 1, y + 1, x + 1, y + 14);
575 g.drawLine(x + 1, y + 14, x + 11, y + 14);
576 g.drawLine(x + 11, y + 14, x + 11, y + 7);
577 g.drawLine(x + 8, y + 2, x + 10, y + 4);
581 * Returns the additional height for the icon. The
582 * {@link #getIconHeight()} method adds this value to the icon height it
583 * returns. Subclasses can override this method to adjust the icon height.
585 * @return The additional height (<code>0</code> unless overridden).
587 public int getAdditionalHeight()
589 return 0;
593 * Returns the shift (???).
595 * @return The shift.
597 public int getShift()
599 return 0;
605 * An icon representing a folder.
607 public static class FolderIcon16 implements Icon, Serializable
610 * Returns the width of the icon, in pixels.
612 * @return The width of the icon.
614 public int getIconWidth() {
615 return 16;
619 * Returns the height of the icon, in pixels. The height returned is
620 * <code>16</code> plus the value returned by
621 * {@link #getAdditionalHeight()}.
623 * @return The height of the icon.
625 public int getIconHeight()
627 return 16 + getAdditionalHeight();
631 * Paints the icon at the location (x, y).
633 * @param c the component.
634 * @param g the graphics device.
635 * @param x the x coordinate.
636 * @param y the y coordinate.
638 public void paintIcon(Component c, Graphics g, int x, int y)
640 // TODO: pick up appropriate UI colors
641 g.setColor(Color.black);
642 g.drawLine(x, y + 3, x, y + 12);
643 g.drawLine(x, y + 12, x + 15, y + 12);
644 g.drawLine(x + 15, y + 12, x + 15, y + 2);
645 g.drawLine(x + 14, y + 3, x + 9, y + 3);
646 g.drawLine(x + 8, y + 2, x + 1, y + 2);
647 g.setColor(new Color(204, 204, 255));
648 g.fillRect(x + 2, y + 4, 7, 8);
649 g.fillRect(x + 9, y + 5, 6, 7);
650 g.setColor(new Color(102, 102, 153));
651 g.drawLine(x + 9, y + 2, x + 14, y + 2);
652 g.setColor(new Color(50, 50, 120));
653 g.drawLine(x + 9, y + 1, x + 15, y + 1);
654 g.drawLine(x + 10, y, x + 15, y);
658 * Returns the additional height for the icon. The
659 * {@link #getIconHeight()} method adds this value to the icon height it
660 * returns. Subclasses can override this method to adjust the icon height.
662 * @return The additional height (<code>0</code> unless overridden).
664 public int getAdditionalHeight()
666 return 0;
670 * Returns the shift (???).
672 * @return The shift.
674 public int getShift()
676 return 0;
682 * An icon used by the {@link MetalInternalFrameUI} class when the frame
683 * is displayed as a palette.
685 * @since 1.3
687 public static class PaletteCloseIcon
688 implements Icon, Serializable, UIResource
691 * Returns the width of the icon, in pixels.
693 * @return The width of the icon.
695 public int getIconWidth()
697 return 7;
701 * Returns the height of the icon, in pixels.
703 * @return The height of the icon.
705 public int getIconHeight()
707 return 7;
711 * Paints the icon using colors from the {@link MetalLookAndFeel}.
713 * @param c the component (ignored).
714 * @param g the graphics device.
715 * @param x the x-coordinate for the top-left of the icon.
716 * @param y the y-coordinate for the top-left of the icon.
718 public void paintIcon(Component c, Graphics g, int x, int y)
720 Color savedColor = g.getColor();
721 AbstractButton button = (AbstractButton) c;
722 if (button.getModel().isPressed())
723 g.setColor(MetalLookAndFeel.getBlack());
724 else
725 g.setColor(MetalLookAndFeel.getControlDarkShadow());
726 g.fillRect(x + 2, y + 2, 3, 3);
727 g.drawLine(x + 1, y, x + 1, y + 2);
728 g.drawLine(x, y + 1, x + 2, y + 1);
729 g.drawLine(x + 5, y, x + 5, y + 2);
730 g.drawLine(x + 4, y + 1, x + 6, y + 1);
731 g.drawLine(x + 1, y + 4, x + 1, y + 6);
732 g.drawLine(x, y + 5, x + 2, y + 5);
733 g.drawLine(x + 5, y + 4, x + 5, y + 6);
734 g.drawLine(x + 4, y + 5, x + 6, y + 5);
735 g.setColor(MetalLookAndFeel.getControlHighlight());
736 g.drawLine(x + 2, y + 6, x + 3, y + 5);
737 g.drawLine(x + 5, y + 3, x + 6, y + 2);
738 g.drawLine(x + 6, y + 6, x + 6, y + 6);
739 g.setColor(savedColor);
744 * An {@link Icon} implementation for {@link JCheckBox}es in the
745 * Metal Look &amp; Feel.
747 * @author Roman Kennke (roman@kennke.org)
749 static class RadioButtonIcon implements Icon, UIResource, Serializable
753 * Returns the width of the icon in pixels.
755 * @return the width of the icon in pixels
757 public int getIconWidth()
759 return 13;
763 * Returns the height of the icon in pixels.
765 * @return the height of the icon in pixels
767 public int getIconHeight()
769 return 13;
773 * Paints the icon, taking into account whether or not the component is
774 * enabled, selected and/or armed.
776 * @param c the Component to draw on (must be an instance of
777 * {@link JRadioButton})
778 * @param g the Graphics context to draw with
779 * @param x the X position
780 * @param y the Y position
782 public void paintIcon(Component c, Graphics g, int x, int y)
784 if (UIManager.get("RadioButton.gradient") != null)
785 MetalUtils.paintGradient(g, x, y, getIconWidth(), getIconHeight(),
786 SwingConstants.VERTICAL, "RadioButton.gradient");
788 Color savedColor = g.getColor();
789 JRadioButton b = (JRadioButton) c;
791 // draw outer circle
792 if (b.isEnabled())
793 g.setColor(MetalLookAndFeel.getControlDarkShadow());
794 else
795 g.setColor(MetalLookAndFeel.getControlDisabled());
796 g.drawLine(x + 2, y + 1, x + 3, y + 1);
797 g.drawLine(x + 4, y, x + 7, y);
798 g.drawLine(x + 8, y + 1, x + 9, y + 1);
799 g.drawLine(x + 10, y + 2, x + 10, y + 3);
800 g.drawLine(x + 11, y + 4, x + 11, y + 7);
801 g.drawLine(x + 10, y + 8, x + 10, y + 9);
802 g.drawLine(x + 8, y + 10, x + 9, y + 10);
803 g.drawLine(x + 4, y + 11, x + 7, y + 11);
804 g.drawLine(x + 2, y + 10, x + 3, y + 10);
805 g.drawLine(x + 1, y + 9, x + 1, y + 8);
806 g.drawLine(x, y + 7, x, y + 4);
807 g.drawLine(x + 1, y + 2, x + 1, y + 3);
809 if (b.getModel().isArmed())
811 g.setColor(MetalLookAndFeel.getControlShadow());
812 g.drawLine(x + 4, y + 1, x + 7, y + 1);
813 g.drawLine(x + 4, y + 10, x + 7, y + 10);
814 g.drawLine(x + 1, y + 4, x + 1, y + 7);
815 g.drawLine(x + 10, y + 4, x + 10, y + 7);
816 g.fillRect(x + 2, y + 2, 8, 8);
818 else
820 // only draw inner highlight if not filled
821 if (b.isEnabled())
823 g.setColor(MetalLookAndFeel.getWhite());
825 g.drawLine(x + 2, y + 8, x + 2, y + 9);
826 g.drawLine(x + 1, y + 4, x + 1, y + 7);
827 g.drawLine(x + 2, y + 2, x + 2, y + 3);
828 g.drawLine(x + 3, y + 2, x + 3, y + 2);
829 g.drawLine(x + 4, y + 1, x + 7, y + 1);
830 g.drawLine(x + 8, y + 2, x + 9, y + 2);
834 // draw outer highlight
835 if (b.isEnabled())
837 g.setColor(MetalLookAndFeel.getWhite());
839 // outer
840 g.drawLine(x + 10, y + 1, x + 10, y + 1);
841 g.drawLine(x + 11, y + 2, x + 11, y + 3);
842 g.drawLine(x + 12, y + 4, x + 12, y + 7);
843 g.drawLine(x + 11, y + 8, x + 11, y + 9);
844 g.drawLine(x + 10, y + 10, x + 10, y + 10);
845 g.drawLine(x + 8, y + 11, x + 9, y + 11);
846 g.drawLine(x + 4, y + 12, x + 7, y + 12);
847 g.drawLine(x + 2, y + 11, x + 3, y + 11);
850 if (b.isSelected())
852 if (b.isEnabled())
853 g.setColor(MetalLookAndFeel.getBlack());
854 else
855 g.setColor(MetalLookAndFeel.getControlDisabled());
856 g.drawLine(x + 4, y + 3, x + 7, y + 3);
857 g.fillRect(x + 3, y + 4, 6, 4);
858 g.drawLine(x + 4, y + 8, x + 7, y + 8);
860 g.setColor(savedColor);
865 * An icon displayed for {@link JRadioButtonMenuItem} components.
867 private static class RadioButtonMenuItemIcon implements Icon, Serializable
870 * Creates a new icon instance.
872 public RadioButtonMenuItemIcon()
874 // Nothing to do here.
878 * Returns the width of the icon, in pixels.
880 * @return The width of the icon.
882 public int getIconWidth()
884 return 10;
888 * Returns the height of the icon, in pixels.
890 * @return The height of the icon.
892 public int getIconHeight()
894 return 10;
898 * Paints the icon.
900 * @param c the component.
901 * @param g the graphics device.
902 * @param x the x-coordinate.
903 * @param y the y-coordinate.
905 public void paintIcon(Component c, Graphics g, int x, int y)
907 Color savedColor = g.getColor();
908 JRadioButtonMenuItem item = (JRadioButtonMenuItem) c;
909 g.setColor(MetalLookAndFeel.getBlack());
910 g.drawLine(x + 2, y, x + 6, y);
911 g.drawLine(x + 7, y + 1, x + 7, y + 1);
912 g.drawLine(x + 8, y + 2, x + 8, y + 6);
913 g.drawLine(x + 7, y + 7, x + 7, y + 7);
914 g.drawLine(x + 2, y + 8, x + 6, y + 8);
915 g.drawLine(x + 1, y + 7, x + 1, y + 7);
916 g.drawLine(x, y + 2, x, y + 6);
917 g.drawLine(x + 1, y + 1, x + 1, y + 1);
919 if (item.isSelected())
921 g.drawLine(x + 3, y + 2, x + 5, y + 2);
922 g.fillRect(x + 2, y + 3, 5, 3);
923 g.drawLine(x + 3, y + 6, x + 5, y + 6);
926 // highlight
927 g.setColor(MetalLookAndFeel.getControlHighlight());
928 g.drawLine(x + 3, y + 1, x + 6, y + 1);
929 g.drawLine(x + 8, y + 1, x + 8, y + 1);
930 g.drawLine(x + 9, y + 2, x + 9, y + 7);
931 g.drawLine(x + 8, y + 8, x + 8, y + 8);
932 g.drawLine(x + 2, y + 9, x + 7, y + 9);
933 g.drawLine(x + 1, y + 8, x + 1, y + 8);
934 g.drawLine(x + 1, y + 3, x + 1, y + 6);
935 g.drawLine(x + 2, y + 2, x + 2, y + 2);
936 g.setColor(savedColor);
941 * The icon used to display the thumb control on a horizontally oriented
942 * {@link JSlider} component.
944 private static class HorizontalSliderThumbIcon implements Icon, Serializable
948 * Creates a new instance.
950 public HorizontalSliderThumbIcon()
952 // Nothing to do here.
956 * Returns the width of the icon, in pixels.
958 * @return The width of the icon.
960 public int getIconWidth()
962 return 15;
966 * Returns the height of the icon, in pixels.
968 * @return The height of the icon.
970 public int getIconHeight()
972 return 16;
976 * Paints the icon, taking into account whether or not the component has
977 * the focus.
979 * @param c the component.
980 * @param g the graphics device.
981 * @param x the x-coordinate.
982 * @param y the y-coordinate.
984 public void paintIcon(Component c, Graphics g, int x, int y)
986 boolean enabled = false;
987 boolean focus = false;
988 if (c != null)
990 enabled = c.isEnabled();
991 focus = c.hasFocus();
994 // draw the outline
995 if (enabled)
996 g.setColor(MetalLookAndFeel.getBlack());
997 else
998 g.setColor(MetalLookAndFeel.getControlDarkShadow());
999 g.drawLine(x + 1, y, x + 13, y);
1000 g.drawLine(x + 14, y + 1, x + 14, y + 7);
1001 g.drawLine(x + 14, y + 8, x + 7, y + 15);
1002 g.drawLine(x + 6, y + 14, x, y + 8);
1003 g.drawLine(x, y + 7, x, y + 1);
1005 // fill the icon
1006 if (focus)
1007 g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1008 else
1009 g.setColor(MetalLookAndFeel.getControl());
1010 g.fillRect(x + 1, y + 2, 13, 7);
1011 g.drawLine(x + 2, y + 9, x + 12, y + 9);
1012 g.drawLine(x + 3, y + 10, x + 11, y + 10);
1013 g.drawLine(x + 4, y + 11, x + 10, y + 11);
1014 g.drawLine(x + 5, y + 12, x + 9, y + 12);
1015 g.drawLine(x + 6, y + 13, x + 8, y + 13);
1016 g.drawLine(x + 7, y + 14, x + 7, y + 14);
1018 // if the slider is enabled, draw dots and highlights
1019 if (c.isEnabled())
1021 if (focus)
1022 g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1023 else
1024 g.setColor(MetalLookAndFeel.getBlack());
1025 g.drawLine(x + 3, y + 3, x + 3, y + 3);
1026 g.drawLine(x + 7, y + 3, x + 7, y + 3);
1027 g.drawLine(x + 11, y + 3, x + 11, y + 3);
1029 g.drawLine(x + 5, y + 5, x + 5, y + 5);
1030 g.drawLine(x + 9, y + 5, x + 9, y + 5);
1032 g.drawLine(x + 3, y + 7, x + 3, y + 7);
1033 g.drawLine(x + 7, y + 7, x + 7, y + 7);
1034 g.drawLine(x + 11, y + 7, x + 11, y + 7);
1036 // draw highlights
1037 if (focus)
1038 g.setColor(MetalLookAndFeel.getPrimaryControl());
1039 else
1040 g.setColor(MetalLookAndFeel.getWhite());
1041 g.drawLine(x + 1, y + 1, x + 13, y + 1);
1042 g.drawLine(x + 1, y + 2, x + 1, y + 8);
1043 g.drawLine(x + 2, y + 2, x + 2, y + 2);
1044 g.drawLine(x + 6, y + 2, x + 6, y + 2);
1045 g.drawLine(x + 10, y + 2, x + 10, y + 2);
1047 g.drawLine(x + 4, y + 4, x + 4, y + 4);
1048 g.drawLine(x + 8, y + 4, x + 8, y + 4);
1050 g.drawLine(x + 2, y + 6, x + 2, y + 6);
1051 g.drawLine(x + 6, y + 6, x + 6, y + 6);
1052 g.drawLine(x + 10, y + 6, x + 10, y + 6);
1059 * An icon used for the 'close' button in the title frame of a
1060 * {@link JInternalFrame}.
1062 private static class InternalFrameCloseIcon implements Icon, Serializable
1064 /** The icon size in pixels. */
1065 private int size;
1068 * Creates a new icon.
1070 * @param size the icon size (width and height) in pixels.
1072 public InternalFrameCloseIcon(int size)
1074 this.size = size;
1078 * Returns the width of the icon, in pixels.
1080 * @return The width of the icon.
1082 public int getIconWidth()
1084 return size;
1088 * Returns the height of the icon, in pixels.
1090 * @return The height of the icon.
1092 public int getIconHeight()
1094 return size;
1098 * Paints the icon.
1100 * @param c the component (an {@link JInternalFrame} is expected).
1101 * @param g the graphics device.
1102 * @param x the x-coordinate.
1103 * @param y the y-coordinate.
1105 public void paintIcon(Component c, Graphics g, int x, int y)
1107 Color savedColor = g.getColor();
1108 AbstractButton b = (AbstractButton) c;
1110 // fill the interior
1111 if (b.getModel().isPressed())
1112 // FIXME: also need to take into account whether the internal frame is
1113 // selected
1114 g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1115 else
1116 g.setColor(MetalLookAndFeel.getPrimaryControl());
1117 g.fillRect(x + 2, y + 2, 10, 10);
1119 // draw the outline box and the cross
1120 if (b.getModel().isPressed())
1121 g.setColor(MetalLookAndFeel.getBlack());
1122 else
1124 // FIXME: also need to take into account whether the internal frame is
1125 // selected
1126 boolean selected = true;
1127 if (selected)
1128 g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1129 else
1130 g.setColor(MetalLookAndFeel.getControlDarkShadow());
1132 g.drawLine(x + 1, y + 1, x + 13, y + 1);
1133 g.drawLine(x + 1, y + 2, x + 1, y + 12);
1134 g.drawLine(x + 1, y + 13, x + 13, y + 13);
1135 g.drawLine(x + 13, y + 2, x + 13, y + 12);
1136 g.drawLine(x + 2, y + 12, x + 2, y + 12);
1137 g.drawLine(x + 12, y + 2, x + 12, y + 2);
1139 g.fillRect(x + 4, y + 4, 2, 2);
1140 g.fillRect(x + 5, y + 5, 4, 4);
1141 g.drawLine(x + 9, y + 4, x + 10, y + 4);
1142 g.drawLine(x + 9, y + 4, x + 9, y + 5);
1143 g.drawLine(x + 4, y + 9, x + 4, y + 10);
1144 g.drawLine(x + 4, y + 9, x + 5, y + 9);
1145 g.drawLine(x + 9, y + 8, x + 9, y + 10);
1146 g.drawLine(x + 8, y + 9, x + 10, y + 9);
1148 g.setColor(MetalLookAndFeel.getBlack());
1149 g.drawLine(x, y, x + 13, y);
1150 g.drawLine(x, y + 1, x, y + 13);
1151 g.drawLine(x + 3, y + 4, x + 4, y + 3);
1152 g.drawLine(x + 3, y + 9, x + 5, y + 7);
1153 g.drawLine(x + 7, y + 5, x + 9, y + 3);
1155 g.drawLine(x + 12, y + 3, x + 12, y + 11);
1156 g.drawLine(x + 3, y + 12, x + 12, y + 12);
1158 g.setColor(MetalLookAndFeel.getWhite());
1159 g.drawLine(x + 1, y + 14, x + 14, y + 14);
1160 g.drawLine(x + 14, y + 1, x + 14, y + 14);
1162 if (!b.getModel().isPressed())
1164 g.drawLine(x + 5, y + 10, x + 5, y + 10);
1165 g.drawLine(x + 6, y + 9, x + 7, y + 9);
1166 g.drawLine(x + 10, y + 5, x + 10, y + 5);
1167 g.drawLine(x + 9, y + 6, x + 9, y + 7);
1168 g.drawLine(x + 10, y + 10, x + 11, y + 10);
1169 g.drawLine(x + 10, y + 11, x + 10, y + 11);
1171 g.setColor(savedColor);
1176 * The icon displayed at the top-left corner of a {@link JInternalFrame}.
1178 private static class InternalFrameDefaultMenuIcon
1179 implements Icon, Serializable
1183 * Creates a new instance.
1185 public InternalFrameDefaultMenuIcon()
1187 // Nothing to do here.
1191 * Returns the width of the icon, in pixels.
1193 * @return The width of the icon.
1195 public int getIconWidth()
1197 return 16;
1201 * Returns the height of the icon, in pixels.
1203 * @return The height of the icon.
1205 public int getIconHeight()
1207 return 16;
1211 * Paints the icon at the specified location.
1213 * @param c the component.
1214 * @param g the graphics device.
1215 * @param x the x coordinate.
1216 * @param y the y coordinate.
1218 public void paintIcon(Component c, Graphics g, int x, int y)
1220 g.setColor(new Color(102, 102, 153));
1221 g.fillRect(x + 1, y, 14, 2);
1222 g.fillRect(x, y + 1, 2, 14);
1223 g.fillRect(x + 1, y + 14, 14, 2);
1224 g.fillRect(x + 14, y + 1, 2, 14);
1225 g.drawLine(x + 2, y + 5, x + 14, y + 5);
1227 g.setColor(new Color(204, 204, 255));
1228 g.fillRect(x + 2, y + 2, 12, 3);
1230 g.setColor(new Color(102, 102, 153));
1231 g.drawLine(x + 3, y + 3, x + 3, y + 3);
1232 g.drawLine(x + 6, y + 3, x + 6, y + 3);
1233 g.drawLine(x + 9, y + 3, x + 9, y + 3);
1234 g.drawLine(x + 12, y + 3, x + 12, y + 3);
1236 g.setColor(Color.white);
1237 g.fillRect(x + 2, y + 6, 12, 8);
1238 g.drawLine(x + 2, y + 2, x + 2, y + 2);
1239 g.drawLine(x + 5, y + 2, x + 5, y + 2);
1240 g.drawLine(x + 8, y + 2, x + 8, y + 2);
1241 g.drawLine(x + 11, y + 2, x + 11, y + 2);
1246 * An icon used in the title frame of a {@link JInternalFrame}. When you
1247 * maximise an internal frame, this icon will replace the 'maximise' icon to
1248 * provide a 'restore' option.
1250 private static class InternalFrameAltMaximizeIcon
1251 implements Icon, Serializable
1253 /** The icon size in pixels. */
1254 private int size;
1257 * Creates a new icon.
1259 * @param size the icon size in pixels.
1261 public InternalFrameAltMaximizeIcon(int size)
1263 this.size = size;
1267 * Returns the width of the icon, in pixels.
1269 * @return The width of the icon.
1271 public int getIconWidth()
1273 return size;
1277 * Returns the height of the icon, in pixels.
1279 * @return The height of the icon.
1281 public int getIconHeight()
1283 return size;
1287 * Paints the icon at the specified location.
1289 * @param c the component.
1290 * @param g the graphics device.
1291 * @param x the x coordinate.
1292 * @param y the y coordinate.
1294 public void paintIcon(Component c, Graphics g, int x, int y)
1296 Color savedColor = g.getColor();
1298 AbstractButton b = (AbstractButton) c;
1300 // fill the small box interior
1301 if (b.getModel().isPressed())
1302 g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1303 else
1304 g.setColor(MetalLookAndFeel.getPrimaryControl());
1305 g.fillRect(x + 2, y + 6, 7, 7);
1308 if (b.getModel().isPressed())
1309 g.setColor(MetalLookAndFeel.getBlack());
1310 else
1311 g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1313 g.drawLine(x + 12, y + 1, x + 13, y + 1);
1314 g.drawLine(x + 11, y + 2, x + 12, y + 2);
1315 g.drawLine(x + 10, y + 3, x + 11, y + 3);
1316 g.drawLine(x + 8, y + 2, x + 8, y + 3);
1317 g.fillRect(x + 8, y + 4, 3, 3);
1318 g.drawLine(x + 11, y + 6, x + 12, y + 6);
1320 g.drawLine(x + 1, y + 5, x + 5, y + 5);
1321 g.drawLine(x + 1, y + 6, x + 1, y + 12);
1322 g.drawLine(x + 9, y + 9, x + 9, y + 12);
1323 g.drawLine(x + 1, y + 13, x + 9, y + 13);
1325 g.drawLine(x + 2, y + 12, x + 2, y + 12);
1327 g.setColor(MetalLookAndFeel.getBlack());
1328 g.drawLine(x + 12, y, x + 9, y + 3);
1329 g.drawLine(x + 7, y + 1, x + 8, y + 1);
1330 g.drawLine(x + 7, y + 2, x + 7, y + 6);
1331 g.drawLine(x + 11, y + 5, x + 12, y + 5);
1332 g.drawLine(x, y + 4, x + 5, y + 4);
1333 g.drawLine(x, y + 5, x, y + 13);
1334 g.drawLine(x + 3, y + 12, x + 8, y + 12);
1335 g.drawLine(x + 8, y + 8, x + 8, y + 11);
1336 g.drawLine(x + 9, y + 8, x + 9, y + 8);
1338 g.setColor(MetalLookAndFeel.getWhite());
1339 g.drawLine(x + 9, y + 2, x + 9, y + 2);
1340 g.drawLine(x + 11, y + 4, x + 13, y + 2);
1341 g.drawLine(x + 13, y + 6, x + 13, y + 6);
1342 g.drawLine(x + 8, y + 7, x + 13, y + 7);
1343 g.drawLine(x + 6, y + 5, x + 6, y + 5);
1344 g.drawLine(x + 10, y + 8, x + 10, y + 13);
1345 g.drawLine(x + 1, y + 14, x + 10, y + 14);
1347 if (!b.getModel().isPressed())
1349 g.drawLine(x + 2, y + 6, x + 6, y + 6);
1350 g.drawLine(x + 2, y + 6, x + 2, y + 11);
1353 g.setColor(savedColor);
1358 * An icon used for the 'maximize' button in the title frame of a
1359 * {@link JInternalFrame}.
1361 private static class InternalFrameMaximizeIcon implements Icon, Serializable
1365 * Creates a new instance.
1367 public InternalFrameMaximizeIcon()
1369 // Nothing to do here.
1373 * Returns the width of the icon, in pixels.
1375 * @return The width of the icon.
1377 public int getIconWidth()
1379 return 16;
1383 * Returns the height of the icon, in pixels.
1385 * @return The height of the icon.
1387 public int getIconHeight()
1389 return 16;
1393 * Paints the icon at the specified location.
1395 * @param c the component.
1396 * @param g the graphics device.
1397 * @param x the x coordinate.
1398 * @param y the y coordinate.
1400 public void paintIcon(Component c, Graphics g, int x, int y)
1402 Color savedColor = g.getColor();
1404 AbstractButton b = (AbstractButton) c;
1406 // fill the interior
1407 if (b.getModel().isPressed())
1408 g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1409 else
1410 g.setColor(MetalLookAndFeel.getPrimaryControl());
1411 g.fillRect(x + 2, y + 6, 7, 7);
1413 if (b.getModel().isPressed())
1414 g.setColor(MetalLookAndFeel.getBlack());
1415 else
1416 g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1418 g.drawLine(x + 9, y + 1, x + 10, y + 1);
1419 g.fillRect(x + 11, y + 1, 3, 3);
1420 g.fillRect(x + 12, y + 4, 2, 2);
1421 g.drawLine(x + 10, y + 3, x + 10, y + 3);
1422 g.drawLine(x + 9, y + 4, x + 10, y + 4);
1423 g.drawLine(x + 1, y + 5, x + 9, y + 5);
1424 g.drawLine(x + 1, y + 6, x + 1, y + 12);
1425 g.drawLine(x + 9, y + 6, x + 9, y + 12);
1426 g.drawLine(x + 1, y + 13, x + 9, y + 13);
1428 // fill
1429 g.drawLine(x + 7, y + 6, x + 8, y + 6);
1430 g.drawLine(x + 6, y + 7, x + 8, y + 7);
1431 g.drawLine(x + 5, y + 8, x + 6, y + 8);
1432 g.drawLine(x + 4, y + 9, x + 5, y + 9);
1433 g.drawLine(x + 3, y + 10, x + 4, y + 10);
1434 g.drawLine(x + 2, y + 11, x + 3, y + 11);
1435 g.drawLine(x + 2, y + 12, x + 4, y + 12);
1436 g.drawLine(x + 8, y + 8, x + 8, y + 8);
1438 // draw black
1439 g.setColor(MetalLookAndFeel.getBlack());
1440 g.drawLine(x + 8, y, x + 13, y);
1441 g.drawLine(x + 8, y + 1, x + 8, y + 1);
1442 g.drawLine(x + 10, y + 2, x + 9, y + 3);
1443 g.drawLine(x, y + 4, x + 8, y + 4);
1444 g.drawLine(x, y + 5, x, y + 13);
1446 g.drawLine(x + 2, y + 10, x + 6, y + 6);
1447 g.drawLine(x + 8, y + 9, x + 8, y + 11);
1448 g.drawLine(x + 5, y + 12, x + 8, y + 12);
1450 // draw white
1451 g.setColor(MetalLookAndFeel.getWhite());
1452 if (!b.getModel().isPressed())
1454 g.drawLine(x + 2, y + 6, x + 5, y + 6);
1455 g.drawLine(x + 2, y + 7, x + 2, y + 9);
1456 g.drawLine(x + 4, y + 11, x + 7, y + 8);
1459 g.drawLine(x + 1, y + 14, x + 10, y + 14);
1460 g.drawLine(x + 10, y + 5, x + 10, y + 13);
1462 g.drawLine(x + 9, y + 2, x + 9, y + 2);
1463 g.drawLine(x + 11, y + 4, x + 11, y + 5);
1464 g.drawLine(x + 13, y + 6, x + 14, y + 6);
1465 g.drawLine(x + 14, y + 1, x + 14, y + 5);
1466 g.setColor(savedColor);
1471 * An icon used in the title frame of a {@link JInternalFrame}.
1473 private static class InternalFrameMinimizeIcon implements Icon, Serializable
1477 * Creates a new instance.
1479 public InternalFrameMinimizeIcon()
1481 // Nothing to do here.
1485 * Returns the width of the icon, in pixels.
1487 * @return The width of the icon.
1489 public int getIconWidth()
1491 return 16;
1495 * Returns the height of the icon, in pixels.
1497 * @return The height of the icon.
1499 public int getIconHeight()
1501 return 16;
1505 * Paints the icon at the specified location.
1507 * @param c the component.
1508 * @param g the graphics device.
1509 * @param x the x coordinate.
1510 * @param y the y coordinate.
1512 public void paintIcon(Component c, Graphics g, int x, int y)
1514 Color savedColor = g.getColor();
1516 AbstractButton b = (AbstractButton) c;
1518 if (b.getModel().isPressed())
1519 g.setColor(MetalLookAndFeel.getBlack());
1520 else
1521 // FIXME: here the color depends on whether or not the internal frame
1522 // is selected
1523 g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1525 g.drawLine(x + 12, y + 1, x + 13, y + 1);
1526 g.drawLine(x + 11, y + 2, x + 12, y + 2);
1527 g.drawLine(x + 10, y + 3, x + 11, y + 3);
1528 g.drawLine(x + 8, y + 2, x + 8, y + 3);
1529 g.fillRect(x + 8, y + 4, 3, 3);
1530 g.drawLine(x + 11, y + 6, x + 12, y + 6);
1532 g.drawLine(x + 1, y + 8, x + 6, y + 8);
1533 g.drawLine(x + 1, y + 9, x + 1, y + 12);
1534 g.drawLine(x + 6, y + 9, x + 6, y + 12);
1535 g.drawLine(x + 1, y + 13, x + 6, y + 13);
1537 g.drawLine(x + 5, y + 9, x + 5, y + 9);
1538 g.drawLine(x + 2, y + 12, x + 2, y + 12);
1540 g.setColor(MetalLookAndFeel.getBlack());
1541 g.drawLine(x + 12, y, x + 9, y + 3);
1542 g.drawLine(x + 7, y + 1, x + 8, y + 1);
1543 g.drawLine(x + 7, y + 2, x + 7, y + 6);
1544 g.drawLine(x, y + 7, x + 6, y + 7);
1545 g.drawLine(x, y + 8, x, y + 13);
1546 g.drawLine(x + 3, y + 12, x + 5, y + 12);
1547 g.drawLine(x + 5, y + 10, x + 5, y + 11);
1548 g.drawLine(x + 11, y + 5, x + 12, y + 5);
1550 g.setColor(MetalLookAndFeel.getWhite());
1551 g.drawLine(x + 9, y + 2, x + 9, y + 2);
1552 g.drawLine(x + 11, y + 4, x + 13, y + 2);
1553 g.drawLine(x + 13, y + 6, x + 13, y + 6);
1554 g.drawLine(x + 8, y + 7, x + 13, y + 7);
1555 g.drawLine(x + 7, y + 9, x + 7, y + 13);
1556 g.drawLine(x + 1, y + 14, x + 7, y + 14);
1558 if (b.getModel().isPressed())
1560 g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1561 g.fillRect(x + 2, y + 9, 3, 3);
1563 else
1565 g.drawLine(x + 2, y + 9, x + 4, y + 9);
1566 g.drawLine(x + 2, y + 10, x + 2, y + 11);
1569 g.setColor(savedColor);
1574 * The icon used to display the thumb control on a horizontally oriented
1575 * {@link JSlider} component.
1577 private static class VerticalSliderThumbIcon implements Icon, Serializable
1580 * Creates a new instance.
1582 public VerticalSliderThumbIcon()
1584 // Nothing to do here.
1588 * Returns the width of the icon, in pixels.
1590 * @return The width of the icon.
1592 public int getIconWidth()
1594 return 16;
1598 * Returns the height of the icon, in pixels.
1600 * @return The height of the icon.
1602 public int getIconHeight()
1604 return 15;
1608 * Paints the icon taking into account whether the slider control has the
1609 * focus or not.
1611 * @param c the slider (must be a non-<code>null</code> instance of
1612 * {@link JSlider}.
1613 * @param g the graphics device.
1614 * @param x the x-coordinate.
1615 * @param y the y-coordinate.
1617 public void paintIcon(Component c, Graphics g, int x, int y)
1619 boolean enabled = false;
1620 boolean focus = false;
1621 if (c != null)
1623 enabled = c.isEnabled();
1624 focus = c.hasFocus();
1627 // draw the outline
1628 if (enabled)
1629 g.setColor(MetalLookAndFeel.getBlack());
1630 else
1631 g.setColor(MetalLookAndFeel.getControlDarkShadow());
1632 g.drawLine(x + 1, y, x + 7, y);
1633 g.drawLine(x + 8, y, x + 15, y + 7);
1634 g.drawLine(x + 14, y + 8, x + 8, y + 14);
1635 g.drawLine(x + 8, y + 14, x + 1, y + 14);
1636 g.drawLine(x, y + 13, x, y + 1);
1638 // fill the icon
1639 if (focus)
1640 g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1641 else
1642 g.setColor(MetalLookAndFeel.getControl());
1643 g.fillRect(x + 2, y + 1, 7, 13);
1644 g.drawLine(x + 9, y + 2, x + 9, y + 12);
1645 g.drawLine(x + 10, y + 3, x + 10, y + 11);
1646 g.drawLine(x + 11, y + 4, x + 11, y + 10);
1647 g.drawLine(x + 12, y + 5, x + 12, y + 9);
1648 g.drawLine(x + 13, y + 6, x + 13, y + 8);
1649 g.drawLine(x + 14, y + 7, x + 14, y + 7);
1651 // if the slider is enabled, draw dots and highlights
1652 if (enabled)
1654 if (focus)
1655 g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1656 else
1657 g.setColor(MetalLookAndFeel.getBlack());
1658 g.drawLine(x + 3, y + 3, x + 3, y + 3);
1659 g.drawLine(x + 3, y + 7, x + 3, y + 7);
1660 g.drawLine(x + 3, y + 11, x + 3, y + 11);
1662 g.drawLine(x + 5, y + 5, x + 5, y + 5);
1663 g.drawLine(x + 5, y + 9, x + 5, y + 9);
1665 g.drawLine(x + 7, y + 3, x + 7, y + 3);
1666 g.drawLine(x + 7, y + 7, x + 7, y + 7);
1667 g.drawLine(x + 7, y + 11, x + 7, y + 11);
1669 // draw highlights
1670 if (focus)
1671 g.setColor(MetalLookAndFeel.getPrimaryControl());
1672 else
1673 g.setColor(MetalLookAndFeel.getWhite());
1674 g.drawLine(x + 1, y + 1, x + 8, y + 1);
1675 g.drawLine(x + 1, y + 2, x + 1, y + 13);
1676 g.drawLine(x + 2, y + 2, x + 2, y + 2);
1677 g.drawLine(x + 2, y + 6, x + 2, y + 6);
1678 g.drawLine(x + 2, y + 10, x + 2, y + 10);
1680 g.drawLine(x + 4, y + 4, x + 4, y + 4);
1681 g.drawLine(x + 4, y + 8, x + 4, y + 8);
1683 g.drawLine(x + 6, y + 2, x + 6, y + 2);
1684 g.drawLine(x + 6, y + 6, x + 6, y + 6);
1685 g.drawLine(x + 6, y + 10, x + 6, y + 10);
1692 * A tree control icon. This icon can be in one of two states: expanded and
1693 * collapsed.
1695 public static class TreeControlIcon implements Icon, Serializable
1698 /** ???. */
1699 protected boolean isLight;
1701 /** A flag that controls whether or not the icon is collapsed. */
1702 private boolean collapsed;
1705 * Creates a new icon.
1707 * @param isCollapsed a flag that controls whether the icon is in the
1708 * collapsed state or the expanded state.
1710 public TreeControlIcon(boolean isCollapsed)
1712 collapsed = isCollapsed;
1716 * Returns the width of the icon, in pixels.
1718 * @return The width of the icon.
1720 public int getIconWidth()
1722 return 18;
1725 * Returns the height of the icon, in pixels.
1727 * @return The height of the icon.
1729 public int getIconHeight()
1731 return 18;
1735 * Paints the icon at the location (x, y).
1737 * @param c the component.
1738 * @param g the graphics device.
1739 * @param x the x coordinate.
1740 * @param y the y coordinate.
1742 public void paintIcon(Component c, Graphics g, int x, int y)
1744 x = x + 5;
1745 y = y + 5;
1746 if (collapsed)
1748 // TODO: pick up appropriate UI colors
1749 g.setColor(Color.black);
1750 g.drawLine(x + 2, y, x + 5, y);
1751 g.drawLine(x + 6, y + 1, x + 7, y + 2);
1752 g.fillRect(x + 7, y + 3, 5, 2);
1753 g.drawLine(x + 7, y + 5, x + 6, y + 6);
1754 g.drawLine(x + 1, y + 1, x + 1, y + 1);
1755 g.drawLine(x, y + 2, x, y + 5);
1756 g.drawLine(x + 1, y + 6, x + 1, y + 6);
1757 g.drawLine(x + 2, y + 7, x + 5, y + 7);
1758 g.fillRect(x + 3, y + 3, 2, 2);
1760 g.setColor(new Color(204, 204, 255));
1761 g.drawLine(x + 3, y + 2, x + 4, y + 2);
1762 g.drawLine(x + 2, y + 3, x + 2, y + 4);
1763 g.drawLine(x + 3, y + 5, x + 3, y + 5);
1764 g.drawLine(x + 5, y + 3, x + 5, y + 3);
1766 g.setColor(new Color(153, 153, 204));
1767 g.drawLine(x + 2, y + 2, x + 2, y + 2);
1768 g.drawLine(x + 2, y + 5, x + 2, y + 5);
1769 g.drawLine(x + 2, y + 6, x + 5, y + 6);
1770 g.drawLine(x + 5, y + 2, x + 5, y + 2);
1771 g.drawLine(x + 6, y + 2, x + 6, y + 5);
1773 g.setColor(new Color(102, 102, 153));
1774 g.drawLine(x + 2, y + 1, x + 5, y + 1);
1775 g.drawLine(x + 1, y + 2, x + 1, y + 5);
1777 else
1779 // TODO: pick up appropriate UI colors
1780 g.setColor(Color.black);
1781 g.drawLine(x + 2, y, x + 5, y);
1782 g.drawLine(x + 6, y + 1, x + 7, y + 2);
1783 g.drawLine(x + 7, y + 2, x + 7, y + 5);
1784 g.fillRect(x + 3, y + 7, 2, 5);
1785 g.drawLine(x + 7, y + 5, x + 6, y + 6);
1786 g.drawLine(x + 1, y + 1, x + 1, y + 1);
1787 g.drawLine(x, y + 2, x, y + 5);
1788 g.drawLine(x + 1, y + 6, x + 1, y + 6);
1789 g.drawLine(x + 2, y + 7, x + 5, y + 7);
1790 g.fillRect(x + 3, y + 3, 2, 2);
1792 g.setColor(new Color(204, 204, 255));
1793 g.drawLine(x + 3, y + 2, x + 4, y + 2);
1794 g.drawLine(x + 2, y + 3, x + 2, y + 4);
1795 g.drawLine(x + 3, y + 5, x + 3, y + 5);
1796 g.drawLine(x + 5, y + 3, x + 5, y + 3);
1798 g.setColor(new Color(153, 153, 204));
1799 g.drawLine(x + 2, y + 2, x + 2, y + 2);
1800 g.drawLine(x + 2, y + 5, x + 2, y + 5);
1801 g.drawLine(x + 2, y + 6, x + 5, y + 6);
1802 g.drawLine(x + 5, y + 2, x + 5, y + 2);
1803 g.drawLine(x + 6, y + 2, x + 6, y + 5);
1805 g.setColor(new Color(102, 102, 153));
1806 g.drawLine(x + 2, y + 1, x + 5, y + 1);
1807 g.drawLine(x + 1, y + 2, x + 1, y + 5);
1812 * Simply calls {@link #paintIcon(Component, Graphics, int, int)}.
1814 * @param c the component.
1815 * @param g the graphics device.
1816 * @param x the x coordinate.
1817 * @param y the y coordinate.
1819 public void paintMe(Component c, Graphics g, int x, int y)
1821 paintIcon(c, g, x, y);
1826 * A tree folder icon.
1828 public static class TreeFolderIcon extends FolderIcon16
1831 * Creates a new instance.
1833 public TreeFolderIcon()
1835 // Nothing to do here.
1839 * Returns the additional height for this icon, in this case <code>2</code>
1840 * pixels.
1842 * @return <code>2</code>.
1844 public int getAdditionalHeight()
1846 return 2;
1850 * Returns the shift (???).
1852 * @return The shift.
1854 public int getShift()
1856 return -1;
1861 * A tree leaf icon.
1863 public static class TreeLeafIcon extends FileIcon16
1866 * Creates a new instance.
1868 public TreeLeafIcon()
1870 // Nothing to do here.
1874 * Returns the additional height for this icon, in this case <code>4</code>
1875 * pixels.
1877 * @return <code>4</code>.
1879 public int getAdditionalHeight()
1881 return 4;
1885 * Returns the shift (???).
1887 * @return The shift.
1889 public int getShift()
1891 return 2;
1896 * An icon representing a hard disk.
1898 * @see MetalIconFactory#getTreeHardDriveIcon()
1900 private static class TreeHardDriveIcon implements Icon, Serializable
1904 * Creates a new icon instance.
1906 public TreeHardDriveIcon()
1908 // Nothing to do here.
1912 * Returns the width of the icon, in pixels.
1914 * @return <code>16</code>.
1916 public int getIconWidth()
1918 return 16;
1922 * Returns the height of the icon, in pixels.
1924 * @return <code>16</code>.
1926 public int getIconHeight()
1928 return 16;
1932 * Paints the icon at the specified location, using colors from the
1933 * current theme.
1935 * @param c the component (ignored).
1936 * @param g the graphics device.
1937 * @param x the x-coordinate for the top-left of the icon.
1938 * @param y the y-coordinate for the top-left of the icon.
1940 public void paintIcon(Component c, Graphics g, int x, int y)
1942 Color saved = g.getColor();
1943 g.setColor(MetalLookAndFeel.getBlack());
1944 g.drawLine(x + 1, y + 4, x + 1, y + 5);
1945 g.drawLine(x + 14, y + 4, x + 14, y + 5);
1946 g.drawLine(x + 1, y + 7, x + 1, y + 8);
1947 g.drawLine(x + 14, y + 7, x + 14, y + 8);
1948 g.drawLine(x + 1, y + 10, x + 1, y + 11);
1949 g.drawLine(x + 14, y + 10, x + 14, y + 11);
1951 g.drawLine(x + 2, y + 3, x + 3, y + 3);
1952 g.drawLine(x + 12, y + 3, x + 13, y + 3);
1953 g.drawLine(x + 2, y + 6, x + 3, y + 6);
1954 g.drawLine(x + 12, y + 6, x + 13, y + 6);
1955 g.drawLine(x + 2, y + 9, x + 3, y + 9);
1956 g.drawLine(x + 12, y + 9, x + 13, y + 9);
1957 g.drawLine(x + 2, y + 12, x + 3, y + 12);
1958 g.drawLine(x + 12, y + 12, x + 13, y + 12);
1960 g.drawLine(x + 4, y + 2, x + 11, y + 2);
1961 g.drawLine(x + 4, y + 7, x + 11, y + 7);
1962 g.drawLine(x + 4, y + 10, x + 11, y + 10);
1963 g.drawLine(x + 4, y + 13, x + 11, y + 13);
1965 g.setColor(MetalLookAndFeel.getWhite());
1966 g.fillRect(x + 4, y + 3, 2, 2);
1967 g.drawLine(x + 6, y + 4, x + 6, y + 4);
1968 g.drawLine(x + 7, y + 3, x + 9, y + 3);
1969 g.drawLine(x + 8, y + 4, x + 8, y + 4);
1970 g.drawLine(x + 11, y + 3, x + 11, y + 3);
1971 g.fillRect(x + 2, y + 4, 2, 2);
1972 g.fillRect(x + 2, y + 7, 2, 2);
1973 g.fillRect(x + 2, y + 10, 2, 2);
1974 g.drawLine(x + 4, y + 6, x + 4, y + 6);
1975 g.drawLine(x + 4, y + 9, x + 4, y + 9);
1976 g.drawLine(x + 4, y + 12, x + 4, y + 12);
1978 g.setColor(MetalLookAndFeel.getControlShadow());
1979 g.drawLine(x + 13, y + 4, x + 13, y + 4);
1980 g.drawLine(x + 12, y + 5, x + 13, y + 5);
1981 g.drawLine(x + 13, y + 7, x + 13, y + 7);
1982 g.drawLine(x + 12, y + 8, x + 13, y + 8);
1983 g.drawLine(x + 13, y + 10, x + 13, y + 10);
1984 g.drawLine(x + 12, y + 11, x + 13, y + 11);
1986 g.drawLine(x + 10, y + 5, x + 10, y + 5);
1987 g.drawLine(x + 7, y + 6, x + 7, y + 6);
1988 g.drawLine(x + 9, y + 6, x + 9, y + 6);
1989 g.drawLine(x + 11, y + 6, x + 11, y + 6);
1991 g.drawLine(x + 10, y + 8, x + 10, y + 8);
1992 g.drawLine(x + 7, y + 9, x + 7, y + 9);
1993 g.drawLine(x + 9, y + 9, x + 9, y + 9);
1994 g.drawLine(x + 11, y + 9, x + 11, y + 9);
1996 g.drawLine(x + 10, y + 11, x + 10, y + 11);
1997 g.drawLine(x + 7, y + 12, x + 7, y + 12);
1998 g.drawLine(x + 9, y + 12, x + 9, y + 12);
1999 g.drawLine(x + 11, y + 12, x + 11, y + 12);
2001 g.setColor(saved);
2006 * An icon representing a floppy disk.
2008 * @see MetalIconFactory#getTreeFloppyDriveIcon()
2010 private static class TreeFloppyDriveIcon implements Icon, Serializable
2014 * Creates a new icon instance.
2016 public TreeFloppyDriveIcon()
2018 // Nothing to do here.
2022 * Returns the width of the icon, in pixels.
2024 * @return <code>16</code>.
2026 public int getIconWidth()
2028 return 16;
2032 * Returns the height of the icon, in pixels.
2034 * @return <code>16</code>.
2036 public int getIconHeight()
2038 return 16;
2042 * Paints the icon at the specified location, using colors from the
2043 * current theme.
2045 * @param c the component (ignored).
2046 * @param g the graphics device.
2047 * @param x the x-coordinate for the top-left of the icon.
2048 * @param y the y-coordinate for the top-left of the icon.
2050 public void paintIcon(Component c, Graphics g, int x, int y)
2052 Color saved = g.getColor();
2054 g.setColor(MetalLookAndFeel.getBlack());
2055 g.drawLine(x + 1, y + 1, x + 13, y + 1);
2056 g.drawLine(x + 1, y + 1, x + 1, y + 14);
2057 g.drawLine(x + 1, y + 14, x + 14, y + 14);
2058 g.drawLine(x + 14, y + 2, x + 14, y + 14);
2060 g.setColor(MetalLookAndFeel.getPrimaryControl());
2061 g.fillRect(x + 2, y + 2, 12, 12);
2063 g.setColor(MetalLookAndFeel.getControlShadow());
2064 g.fillRect(x + 5, y + 2, 6, 5);
2065 g.drawLine(x + 4, y + 8, x + 11, y + 8);
2066 g.drawLine(x + 3, y + 9, x + 3, y + 13);
2067 g.drawLine(x + 12, y + 9, x + 12, y + 13);
2069 g.setColor(MetalLookAndFeel.getWhite());
2070 g.fillRect(x + 8, y + 3, 2, 3);
2071 g.fillRect(x + 4, y + 9, 8, 5);
2073 g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
2074 g.drawLine(x + 5, y + 10, x + 9, y + 10);
2075 g.drawLine(x + 5, y + 12, x + 8, y + 12);
2077 g.setColor(saved);
2082 * An icon representing a computer.
2084 * @see MetalIconFactory#getTreeComputerIcon()
2086 private static class TreeComputerIcon implements Icon, Serializable
2090 * Creates a new icon instance.
2092 public TreeComputerIcon()
2094 // Nothing to do here.
2098 * Returns the width of the icon, in pixels.
2100 * @return <code>16</code>.
2102 public int getIconWidth()
2104 return 16;
2108 * Returns the height of the icon, in pixels.
2110 * @return <code>16</code>.
2112 public int getIconHeight()
2114 return 16;
2118 * Paints the icon at the specified location, using colors from the
2119 * current theme.
2121 * @param c the component (ignored).
2122 * @param g the graphics device.
2123 * @param x the x-coordinate for the top-left of the icon.
2124 * @param y the y-coordinate for the top-left of the icon.
2126 public void paintIcon(Component c, Graphics g, int x, int y)
2128 Color saved = g.getColor();
2130 g.setColor(MetalLookAndFeel.getBlack());
2131 g.drawLine(x + 3, y + 1, x + 12, y + 1);
2132 g.drawLine(x + 2, y + 2, x + 2, y + 8);
2133 g.drawLine(x + 13, y + 2, x + 13, y + 8);
2134 g.drawLine(x + 3, y + 9, x + 3, y + 9);
2135 g.drawLine(x + 12, y + 9, x + 12, y + 9);
2136 g.drawRect(x + 1, y + 10, 13, 4);
2137 g.drawLine(x + 5, y + 3, x + 10, y + 3);
2138 g.drawLine(x + 5, y + 8, x + 10, y + 8);
2139 g.drawLine(x + 4, y + 4, x + 4, y + 7);
2140 g.drawLine(x + 11, y + 4, x + 11, y + 7);
2142 g.setColor(MetalLookAndFeel.getPrimaryControl());
2143 g.fillRect(x + 5, y + 4, 6, 4);
2145 g.setColor(MetalLookAndFeel.getControlShadow());
2146 g.drawLine(x + 6, y + 12, x + 8, y + 12);
2147 g.drawLine(x + 10, y + 12, x + 12, y + 12);
2148 g.setColor(saved);
2152 /** The icon returned by {@link #getCheckBoxIcon()}. */
2153 private static Icon checkBoxIcon;
2155 /** The icon returned by {@link #getCheckBoxMenuItemIcon()}. */
2156 private static Icon checkBoxMenuItemIcon;
2158 /** The icon returned by {@link #getFileChooserDetailViewIcon()}. */
2159 private static Icon fileChooserDetailViewIcon;
2161 /** The icon returned by {@link #getFileChooserHomeFolderIcon()}. */
2162 private static Icon fileChooserHomeFolderIcon;
2164 /** The icon returned by {@link #getFileChooserListViewIcon()}. */
2165 private static Icon fileChooserListViewIcon;
2167 /** The icon returned by {@link #getFileChooserNewFolderIcon()}. */
2168 private static Icon fileChooserNewFolderIcon;
2170 /** The icon returned by {@link #getFileChooserUpFolderIcon()}. */
2171 private static Icon fileChooserUpFolderIcon;
2173 /** The cached RadioButtonIcon instance. */
2174 private static RadioButtonIcon radioButtonIcon;
2176 /** The icon returned by {@link #getRadioButtonMenuItemIcon()}. */
2177 private static Icon radioButtonMenuItemIcon;
2179 /** The icon returned by {@link #getInternalFrameDefaultMenuIcon()}. */
2180 private static Icon internalFrameDefaultMenuIcon;
2182 /** The icon returned by {@link #getTreeComputerIcon()}. */
2183 private static Icon treeComputerIcon;
2185 /** The icon instance returned by {@link #getTreeFloppyDriveIcon()}. */
2186 private static Icon treeFloppyDriveIcon;
2188 /** The icon instance returned by {@link #getTreeHardDriveIcon()}. */
2189 private static Icon treeHardDriveIcon;
2192 * Creates a new instance. All the methods are static, so creating an
2193 * instance isn't necessary.
2195 public MetalIconFactory()
2197 // Nothing to do here.
2201 * Returns an icon for use when rendering the {@link JCheckBox} component.
2203 * @return A check box icon.
2205 * @since 1.3
2207 public static Icon getCheckBoxIcon()
2209 if (checkBoxIcon == null)
2210 checkBoxIcon = new MetalCheckBoxIcon();
2211 return checkBoxIcon;
2215 * Returns an icon for use when rendering the {@link JCheckBoxMenuItem}
2216 * component.
2218 * @return An icon.
2220 public static Icon getCheckBoxMenuItemIcon()
2222 if (checkBoxMenuItemIcon == null)
2223 checkBoxMenuItemIcon = new CheckBoxMenuItemIcon();
2224 return checkBoxMenuItemIcon;
2228 * Returns an icon for use by the {@link JFileChooser} component.
2230 * @return An icon.
2232 public static Icon getFileChooserDetailViewIcon()
2234 if (fileChooserDetailViewIcon == null)
2235 fileChooserDetailViewIcon = new FileChooserDetailViewIcon();
2236 return fileChooserDetailViewIcon;
2240 * Returns an icon for use by the {@link JFileChooser} component.
2242 * @return An icon.
2244 public static Icon getFileChooserHomeFolderIcon()
2246 if (fileChooserHomeFolderIcon == null)
2247 fileChooserHomeFolderIcon = new FileChooserHomeFolderIcon();
2248 return fileChooserHomeFolderIcon;
2252 * Returns an icon for use by the {@link JFileChooser} component.
2254 * @return An icon.
2256 public static Icon getFileChooserListViewIcon()
2258 if (fileChooserListViewIcon == null)
2259 fileChooserListViewIcon = new FileChooserListViewIcon();
2260 return fileChooserListViewIcon;
2264 * Returns an icon for use by the {@link JFileChooser} component.
2266 * @return An icon.
2268 public static Icon getFileChooserNewFolderIcon()
2270 if (fileChooserNewFolderIcon == null)
2271 fileChooserNewFolderIcon = new FileChooserNewFolderIcon();
2272 return fileChooserNewFolderIcon;
2276 * Returns an icon for use by the {@link JFileChooser} component.
2278 * @return An icon.
2280 public static Icon getFileChooserUpFolderIcon()
2282 if (fileChooserUpFolderIcon == null)
2283 fileChooserUpFolderIcon = new FileChooserUpFolderIcon();
2284 return fileChooserUpFolderIcon;
2288 * Returns an icon for RadioButtons in the Metal L&amp;F.
2290 * @return an icon for RadioButtons in the Metal L&amp;F
2292 public static Icon getRadioButtonIcon()
2294 if (radioButtonIcon == null)
2295 radioButtonIcon = new RadioButtonIcon();
2296 return radioButtonIcon;
2300 * Creates a new instance of the icon used in a {@link JRadioButtonMenuItem}.
2302 * @return A new icon instance.
2304 public static Icon getRadioButtonMenuItemIcon()
2306 if (radioButtonMenuItemIcon == null)
2307 radioButtonMenuItemIcon = new RadioButtonMenuItemIcon();
2308 return radioButtonMenuItemIcon;
2312 * Returns the icon used to display the thumb for a horizontally oriented
2313 * {@link JSlider}.
2315 * @return The icon.
2317 public static Icon getHorizontalSliderThumbIcon()
2319 return new HorizontalSliderThumbIcon();
2323 * Creates a new icon used to represent the 'close' button in the title
2324 * pane of a {@link JInternalFrame}.
2326 * @param size the icon size.
2328 * @return A close icon.
2330 public static Icon getInternalFrameCloseIcon(int size)
2332 return new InternalFrameCloseIcon(size);
2336 * Creates a new icon for the menu in a {@link JInternalFrame}. This is the
2337 * icon displayed at the top left of the frame.
2339 * @return A menu icon.
2341 public static Icon getInternalFrameDefaultMenuIcon()
2343 if (internalFrameDefaultMenuIcon == null)
2344 internalFrameDefaultMenuIcon = new InternalFrameDefaultMenuIcon();
2345 return internalFrameDefaultMenuIcon;
2349 * Creates a new icon for the 'maximize' button in a {@link JInternalFrame}.
2351 * @param size the icon size in pixels.
2353 * @return The icon.
2355 * @see #getInternalFrameAltMaximizeIcon(int)
2357 public static Icon getInternalFrameMaximizeIcon(int size)
2359 return new InternalFrameMaximizeIcon();
2363 * Returns the icon used for the minimize button in the frame title for a
2364 * {@link JInternalFrame}.
2366 * @param size the icon size in pixels (ignored by this implementation).
2368 * @return The icon.
2370 public static Icon getInternalFrameMinimizeIcon(int size)
2372 return new InternalFrameMinimizeIcon();
2376 * Creates a new icon for the 'restore' button in a {@link JInternalFrame}
2377 * that has been maximised.
2379 * @param size the icon size in pixels.
2381 * @return The icon.
2383 * @see #getInternalFrameMaximizeIcon(int)
2385 public static Icon getInternalFrameAltMaximizeIcon(int size)
2387 return new InternalFrameAltMaximizeIcon(size);
2391 * Returns the icon used to display the thumb for a vertically oriented
2392 * {@link JSlider}.
2394 * @return The icon.
2396 public static Icon getVerticalSliderThumbIcon()
2398 return new VerticalSliderThumbIcon();
2402 * Creates and returns a new tree folder icon.
2404 * @return A new tree folder icon.
2406 public static Icon getTreeFolderIcon()
2408 return new TreeFolderIcon();
2412 * Creates and returns a new tree leaf icon.
2414 * @return A new tree leaf icon.
2416 public static Icon getTreeLeafIcon()
2418 return new TreeLeafIcon();
2422 * Creates and returns a tree control icon.
2424 * @param isCollapsed a flag that controls whether the icon is in the
2425 * collapsed or expanded state.
2427 * @return A tree control icon.
2429 public static Icon getTreeControlIcon(boolean isCollapsed)
2431 return new TreeControlIcon(isCollapsed);
2435 * Returns a <code>16x16</code> icon representing a computer.
2437 * @return The icon.
2439 public static Icon getTreeComputerIcon()
2441 if (treeComputerIcon == null)
2442 treeComputerIcon = new TreeComputerIcon();
2443 return treeComputerIcon;
2447 * Returns a <code>16x16</code> icon representing a floppy disk.
2449 * @return The icon.
2451 public static Icon getTreeFloppyDriveIcon()
2453 if (treeFloppyDriveIcon == null)
2454 treeFloppyDriveIcon = new TreeFloppyDriveIcon();
2455 return treeFloppyDriveIcon;
2459 * Returns a <code>16x16</code> icon representing a hard disk.
2461 * @return The icon.
2463 public static Icon getTreeHardDriveIcon()
2465 if (treeHardDriveIcon == null)
2466 treeHardDriveIcon = new TreeHardDriveIcon();
2467 return treeHardDriveIcon;