1:
37:
38:
39: package ;
40:
41: import ;
42: import ;
43: import ;
44: import ;
45:
46: import ;
47: import ;
48: import ;
49: import ;
50: import ;
51: import ;
52: import ;
53: import ;
54:
55:
56:
59: public class MetalIconFactory implements Serializable
60: {
61:
62:
63: public static final boolean DARK = false;
64:
65:
66: public static final boolean LIGHT = true;
67:
68:
71: private static class CheckBoxMenuItemIcon implements Icon, Serializable
72: {
73:
76: public CheckBoxMenuItemIcon()
77: {
78: }
79:
80:
85: public int getIconWidth()
86: {
87: return 10;
88: }
89:
90:
95: public int getIconHeight()
96: {
97: return 10;
98: }
99:
100:
108: public void paintIcon(Component c, Graphics g, int x, int y)
109: {
110: JCheckBoxMenuItem item = (JCheckBoxMenuItem) c;
111:
112: if (item.isArmed())
113: g.setColor(MetalLookAndFeel.getBlack());
114: else
115: g.setColor(MetalLookAndFeel.getControlDarkShadow());
116: g.drawLine(x, y, x + 8, y);
117: g.drawLine(x, y + 1, x, y + 8);
118: g.drawLine(x + 2, y + 8, x + 8, y + 8);
119: g.drawLine(x + 8, y + 2, x + 8, y + 7);
120:
121: g.setColor(MetalLookAndFeel.getWhite());
122: g.drawLine(x + 1, y + 1, x + 7, y + 1);
123: g.drawLine(x + 1, y + 2, x + 1, y + 7);
124: g.drawLine(x + 1, y + 9, x + 9, y + 9);
125: g.drawLine(x + 9, y + 1, x + 9, y + 8);
126:
127:
128: if (item.isSelected())
129: {
130: g.setColor(MetalLookAndFeel.getBlack());
131: g.fillRect(x + 2, y + 2, 2, 5);
132: for (int i = 0; i < 6; i++)
133: g.drawLine(x + 8 - i, y + i, x + 9 - i, y + i);
134: }
135:
136: }
137: }
138:
139:
143: public static class FileIcon16 implements Icon, Serializable
144: {
145:
150: public int getIconWidth()
151: {
152: return 16;
153: }
154:
155:
160: public int getIconHeight()
161: {
162: return 16;
163: }
164:
165:
173: public void paintIcon(Component c, Graphics g, int x, int y)
174: {
175:
176: g.setColor(Color.black);
177: g.drawLine(x, y, x + 9, y);
178: g.drawLine(x, y + 1, x, y + 15);
179: g.drawLine(x, y + 15, x + 12, y + 15);
180: g.drawLine(x + 12, y + 15, x + 12, y + 6);
181: g.drawLine(x + 12, y + 6, x + 9, y);
182:
183: g.drawLine(x + 7, y + 2, x + 11, y + 6);
184: g.drawLine(x + 8, y + 1, x + 9, y + 1);
185:
186: g.setColor(new Color(204, 204, 255));
187: g.drawLine(x + 1, y + 1, x + 7, y + 1);
188: g.drawLine(x + 1, y + 1, x + 1, y + 14);
189: g.drawLine(x + 1, y + 14, x + 11, y + 14);
190: g.drawLine(x + 11, y + 14, x + 11, y + 7);
191: g.drawLine(x + 8, y + 2, x + 10, y + 4);
192: }
193:
194:
199: public int getAdditionalHeight()
200: {
201: return 0;
202: }
203:
204:
209: public int getShift()
210: {
211: return 0;
212: }
213:
214: }
215:
216:
219: public static class FolderIcon16 implements Icon, Serializable
220: {
221:
226: public int getIconWidth() {
227: return 16;
228: }
229:
230:
235: public int getIconHeight()
236: {
237: return 16;
238: }
239:
240:
248: public void paintIcon(Component c, Graphics g, int x, int y)
249: {
250:
251: g.setColor(Color.black);
252: g.drawLine(x, y + 3, x, y + 12);
253: g.drawLine(x, y + 12, x + 15, y + 12);
254: g.drawLine(x + 15, y + 12, x + 15, y + 2);
255: g.drawLine(x + 14, y + 3, x + 9, y + 3);
256: g.drawLine(x + 8, y + 2, x + 1, y + 2);
257: g.setColor(new Color(204, 204, 255));
258: g.fillRect(x + 2, y + 4, 7, 8);
259: g.fillRect(x + 9, y + 5, 6, 7);
260: g.setColor(new Color(102, 102, 153));
261: g.drawLine(x + 9, y + 2, x + 14, y + 2);
262: g.setColor(new Color(50, 50, 120));
263: g.drawLine(x + 9, y + 1, x + 15, y + 1);
264: g.drawLine(x + 10, y, x + 15, y);
265: }
266:
267:
272: public int getAdditionalHeight()
273: {
274: return 0;
275: }
276:
277:
282: public int getShift()
283: {
284: return 0;
285: }
286:
287: }
288:
289:
295: static class RadioButtonIcon
296: implements Icon, UIResource, Serializable
297: {
298:
304: protected void drawCheck(Component c, Graphics g)
305: {
306: g.setColor(MetalLookAndFeel.getBlack());
307: g.fillRect(4, 3, 4, 6);
308: g.drawLine(3, 4, 3, 7);
309: g.drawLine(8, 4, 8, 7);
310: }
311:
312:
317: public int getIconWidth()
318: {
319: return 13;
320: }
321:
322:
327: public int getIconHeight()
328: {
329: return 13;
330: }
331:
332:
342: public void paintIcon(Component c, Graphics g, int x, int y)
343: {
344: Color dark = MetalLookAndFeel.getControlDarkShadow();
345: Color light = MetalLookAndFeel.getWhite();
346: g.translate(x, y);
347:
348:
349: g.setColor(light);
350: g.drawLine(4, 1, 10, 1);
351: g.drawLine(2, 2, 3, 2);
352: g.drawLine(8, 2, 11, 2);
353: g.drawLine(2, 3, 2, 3);
354: g.drawLine(11, 2, 11, 9);
355: g.drawLine(1, 4, 1, 7);
356: g.drawLine(12, 4, 12, 7);
357: g.drawLine(2, 8, 2, 11);
358: g.drawLine(11, 8, 11, 9);
359: g.drawLine(10, 10, 10, 10);
360: g.drawLine(2, 11, 9, 11);
361: g.drawLine(4, 12, 7, 12);
362:
363:
364: g.setColor(dark);
365: g.drawLine(4, 0, 7, 0);
366: g.drawLine(2, 1, 3, 1);
367: g.drawLine(8, 1, 9, 1);
368: g.drawLine(1, 2, 1, 3);
369: g.drawLine(10, 2, 10, 3);
370: g.drawLine(0, 4, 0, 7);
371: g.drawLine(11, 4, 11, 7);
372: g.drawLine(1, 8, 1, 9);
373: g.drawLine(10, 8, 10, 9);
374: g.drawLine(2, 10, 3, 10);
375: g.drawLine(8, 10, 9, 10);
376: g.drawLine(4, 11, 7, 11);
377:
378: JRadioButton rb = (JRadioButton) c;
379: if (rb.isSelected())
380: drawCheck(c, g);
381:
382: g.translate(-x, -y);
383: }
384: }
385:
386:
389: private static class RadioButtonMenuItemIcon
390: implements Icon, Serializable
391: {
392:
395: public RadioButtonMenuItemIcon()
396: {
397: }
398:
399:
404: public int getIconWidth()
405: {
406: return 10;
407: }
408:
409:
414: public int getIconHeight()
415: {
416: return 10;
417: }
418:
419:
427: public void paintIcon(Component c, Graphics g, int x, int y)
428: {
429: Color savedColor = g.getColor();
430: JRadioButtonMenuItem item = (JRadioButtonMenuItem) c;
431: g.setColor(MetalLookAndFeel.getBlack());
432: g.drawLine(x + 2, y, x + 6, y);
433: g.drawLine(x + 7, y + 1, x + 7, y + 1);
434: g.drawLine(x + 8, y + 2, x + 8, y + 6);
435: g.drawLine(x + 7, y + 7, x + 7, y + 7);
436: g.drawLine(x + 2, y + 8, x + 6, y + 8);
437: g.drawLine(x + 1, y + 7, x + 1, y + 7);
438: g.drawLine(x, y + 2, x, y + 6);
439: g.drawLine(x + 1, y + 1, x + 1, y + 1);
440:
441: if (item.isSelected())
442: {
443: g.drawLine(x + 3, y + 2, x + 5, y + 2);
444: g.fillRect(x + 2, y + 3, 5, 3);
445: g.drawLine(x + 3, y + 6, x + 5, y + 6);
446: }
447:
448:
449: g.setColor(MetalLookAndFeel.getControlHighlight());
450: g.drawLine(x + 3, y + 1, x + 6, y + 1);
451: g.drawLine(x + 8, y + 1, x + 8, y + 1);
452: g.drawLine(x + 9, y + 2, x + 9, y + 7);
453: g.drawLine(x + 8, y + 8, x + 8, y + 8);
454: g.drawLine(x + 2, y + 9, x + 7, y + 9);
455: g.drawLine(x + 1, y + 8, x + 1, y + 8);
456: g.drawLine(x + 1, y + 3, x + 1, y + 6);
457: g.drawLine(x + 2, y + 2, x + 2, y + 2);
458: g.setColor(savedColor);
459: }
460: }
461:
462:
466: private static class HorizontalSliderThumbIcon
467: implements Icon, Serializable
468: {
469:
470:
473: public HorizontalSliderThumbIcon()
474: {
475: }
476:
477:
482: public int getIconWidth()
483: {
484: return 15;
485: }
486:
487:
492: public int getIconHeight()
493: {
494: return 16;
495: }
496:
497:
506: public void paintIcon(Component c, Graphics g, int x, int y)
507: {
508: boolean focus = false;
509: if (c != null)
510: focus = c.hasFocus();
511:
512:
513:
514: g.setColor(Color.black);
515: g.drawLine(x + 1, y, x + 13, y);
516: g.drawLine(x + 14, y + 1, x + 14, y + 7);
517: g.drawLine(x + 14, y + 8, x + 7, y + 15);
518: g.drawLine(x + 6, y + 14, x, y + 8);
519: g.drawLine(x, y + 7, x, y + 1);
520:
521:
522: g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204));
523: g.fillRect(x + 2, y + 2, 12, 7);
524: g.drawLine(x + 2, y + 9, x + 12, y + 9);
525: g.drawLine(x + 3, y + 10, x + 11, y + 10);
526: g.drawLine(x + 4, y + 11, x + 10, y + 11);
527: g.drawLine(x + 5, y + 12, x + 9, y + 12);
528: g.drawLine(x + 6, y + 13, x + 8, y + 13);
529: g.drawLine(x + 7, y + 14, x + 7, y + 14);
530:
531:
532: g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255));
533: g.drawLine(x + 1, y + 1, x + 13, y + 1);
534: g.drawLine(x + 1, y + 2, x + 1, y + 8);
535: g.drawLine(x + 2, y + 2, x + 2, y + 2);
536: g.drawLine(x + 6, y + 2, x + 6, y + 2);
537: g.drawLine(x + 10, y + 2, x + 10, y + 2);
538:
539: g.drawLine(x + 4, y + 4, x + 4, y + 4);
540: g.drawLine(x + 8, y + 4, x + 8, y + 4);
541:
542: g.drawLine(x + 2, y + 6, x + 2, y + 6);
543: g.drawLine(x + 6, y + 6, x + 6, y + 6);
544: g.drawLine(x + 10, y + 6, x + 10, y + 6);
545:
546:
547: g.setColor(focus ? new Color(102, 102, 153) : Color.black);
548: g.drawLine(x + 3, y + 3, x + 3, y + 3);
549: g.drawLine(x + 7, y + 3, x + 7, y + 3);
550: g.drawLine(x + 11, y + 3, x + 11, y + 3);
551:
552: g.drawLine(x + 5, y + 5, x + 5, y + 5);
553: g.drawLine(x + 9, y + 5, x + 9, y + 5);
554:
555: g.drawLine(x + 3, y + 7, x + 3, y + 7);
556: g.drawLine(x + 7, y + 7, x + 7, y + 7);
557: g.drawLine(x + 11, y + 7, x + 11, y + 7);
558:
559: }
560: }
561:
562:
566: private static class InternalFrameCloseIcon implements Icon, Serializable
567: {
568:
569: private int size;
570:
571:
576: public InternalFrameCloseIcon(int size)
577: {
578: this.size = size;
579: }
580:
581:
586: public int getIconWidth()
587: {
588: return size;
589: }
590:
591:
596: public int getIconHeight()
597: {
598: return size;
599: }
600:
601:
609: public void paintIcon(Component c, Graphics g, int x, int y)
610: {
611:
612: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
613: g.drawLine(x + 1, y + 1, x + 13, y + 1);
614: g.drawLine(x + 1, y + 2, x + 1, y + 12);
615: g.drawLine(x + 1, y + 13, x + 13, y + 13);
616: g.drawLine(x + 13, y + 2, x + 13, y + 12);
617:
618: g.fillRect(x + 4, y + 4, 2, 2);
619: g.fillRect(x + 4, y + 9, 2, 2);
620: g.fillRect(x + 9, y + 4, 2, 2);
621: g.fillRect(x + 9, y + 9, 2, 2);
622: g.fillRect(x + 5, y + 5, 5, 5);
623:
624: g.setColor(MetalLookAndFeel.getBlack());
625: g.drawLine(x, y, x + 13, y);
626: g.drawLine(x, y + 1, x, y + 13);
627: g.drawLine(x + 3, y + 4, x + 4, y + 3);
628: g.drawLine(x + 3, y + 9, x + 5, y + 7);
629: g.drawLine(x + 7, y + 5, x + 9, y + 3);
630:
631: g.drawLine(x + 12, y + 3, x + 12, y + 11);
632: g.drawLine(x + 3, y + 12, x + 12, y + 12);
633:
634: g.setColor(MetalLookAndFeel.getWhite());
635: g.drawLine(x + 1, y + 14, x + 14, y + 14);
636: g.drawLine(x + 14, y + 1, x + 14, y + 14);
637:
638: g.drawLine(x + 5, y + 10, x + 5, y + 10);
639: g.drawLine(x + 6, y + 9, x + 7, y + 9);
640: g.drawLine(x + 10, y + 5, x + 10, y + 5);
641: g.drawLine(x + 9, y + 6, x + 9, y + 7);
642: g.drawLine(x + 10, y + 10, x + 11, y + 10);
643: g.drawLine(x + 10, y + 11, x + 10, y + 11);
644: }
645: }
646:
647:
650: private static class InternalFrameDefaultMenuIcon
651: implements Icon, Serializable
652: {
653:
654:
657: public InternalFrameDefaultMenuIcon()
658: {
659: }
660:
661:
666: public int getIconWidth()
667: {
668: return 16;
669: }
670:
671:
676: public int getIconHeight()
677: {
678: return 16;
679: }
680:
681:
689: public void paintIcon(Component c, Graphics g, int x, int y)
690: {
691: g.setColor(new Color(102, 102, 153));
692: g.fillRect(x + 1, y, 14, 2);
693: g.fillRect(x, y + 1, 2, 14);
694: g.fillRect(x + 1, y + 14, 14, 2);
695: g.fillRect(x + 14, y + 1, 2, 14);
696: g.drawLine(x + 2, y + 5, x + 14, y + 5);
697:
698: g.setColor(new Color(204, 204, 255));
699: g.fillRect(x + 2, y + 2, 12, 3);
700:
701: g.setColor(new Color(102, 102, 153));
702: g.drawLine(x + 3, y + 3, x + 3, y + 3);
703: g.drawLine(x + 6, y + 3, x + 6, y + 3);
704: g.drawLine(x + 9, y + 3, x + 9, y + 3);
705: g.drawLine(x + 12, y + 3, x + 12, y + 3);
706:
707: g.setColor(Color.white);
708: g.fillRect(x + 2, y + 6, 12, 8);
709: g.drawLine(x + 2, y + 2, x + 2, y + 2);
710: g.drawLine(x + 5, y + 2, x + 5, y + 2);
711: g.drawLine(x + 8, y + 2, x + 8, y + 2);
712: g.drawLine(x + 11, y + 2, x + 11, y + 2);
713: }
714: }
715:
716:
721: private static class InternalFrameAltMaximizeIcon
722: implements Icon, Serializable
723: {
724:
725: private int size;
726:
727:
732: public InternalFrameAltMaximizeIcon(int size)
733: {
734: this.size = size;
735: }
736:
737:
742: public int getIconWidth()
743: {
744: return size;
745: }
746:
747:
752: public int getIconHeight()
753: {
754: return size;
755: }
756:
757:
765: public void paintIcon(Component c, Graphics g, int x, int y)
766: {
767: Color color = MetalLookAndFeel.getControlDarkShadow();
768: if (c instanceof JInternalFrame)
769: {
770: JInternalFrame f = (JInternalFrame) c;
771: if (f.isSelected())
772: color = MetalLookAndFeel.getPrimaryControlShadow();
773: }
774: g.setColor(color);
775: g.drawLine(x + 12, y + 1, x + 13, y + 1);
776: g.drawLine(x + 11, y + 2, x + 12, y + 2);
777: g.drawLine(x + 10, y + 3, x + 11, y + 3);
778: g.drawLine(x + 8, y + 2, x + 8, y + 3);
779: g.fillRect(x + 8, y + 4, 3, 3);
780: g.drawLine(x + 11, y + 6, x + 12, y + 6);
781:
782: g.drawLine(x + 1, y + 5, x + 5, y + 5);
783: g.drawLine(x + 1, y + 6, x + 1, y + 12);
784: g.drawLine(x + 9, y + 9, x + 9, y + 12);
785: g.drawLine(x + 1, y + 13, x + 9, y + 13);
786:
787: g.drawLine(x + 2, y + 12, x + 2, y + 12);
788:
789: g.setColor(MetalLookAndFeel.getBlack());
790: g.drawLine(x + 12, y, x + 9, y + 3);
791: g.drawLine(x + 7, y + 1, x + 8, y + 1);
792: g.drawLine(x + 7, y + 2, x + 7, y + 6);
793: g.drawLine(x + 11, y + 5, x + 12, y + 5);
794: g.drawLine(x, y + 4, x + 5, y + 4);
795: g.drawLine(x, y + 5, x, y + 13);
796: g.drawLine(x + 3, y + 12, x + 8, y + 12);
797: g.drawLine(x + 8, y + 8, x + 8, y + 11);
798: g.drawLine(x + 9, y + 8, x + 9, y + 8);
799:
800: g.setColor(MetalLookAndFeel.getWhite());
801: g.drawLine(x + 9, y + 2, x + 9, y + 2);
802: g.drawLine(x + 11, y + 4, x + 13, y + 2);
803: g.drawLine(x + 13, y + 6, x + 13, y + 6);
804: g.drawLine(x + 8, y + 7, x + 13, y + 7);
805: g.drawLine(x + 6, y + 5, x + 6, y + 5);
806: g.drawLine(x + 2, y + 6, x + 6, y + 6);
807: g.drawLine(x + 2, y + 6, x + 2, y + 11);
808: g.drawLine(x + 10, y + 8, x + 10, y + 13);
809: g.drawLine(x + 1, y + 14, x + 10, y + 14);
810: }
811: }
812:
813:
817: private static class InternalFrameMaximizeIcon
818: implements Icon, Serializable
819: {
820:
821:
824: public InternalFrameMaximizeIcon()
825: {
826: }
827:
828:
833: public int getIconWidth()
834: {
835: return 16;
836: }
837:
838:
843: public int getIconHeight()
844: {
845: return 16;
846: }
847:
848:
856: public void paintIcon(Component c, Graphics g, int x, int y)
857: {
858: Color color = MetalLookAndFeel.getControlDarkShadow();
859: if (c instanceof JInternalFrame)
860: {
861: JInternalFrame f = (JInternalFrame) c;
862: if (f.isSelected())
863: color = MetalLookAndFeel.getPrimaryControlShadow();
864: }
865: g.setColor(color);
866: g.drawLine(x + 9, y + 1, x + 10, y + 1);
867: g.fillRect(x + 11, y + 1, 3, 3);
868: g.fillRect(x + 12, y + 4, 2, 2);
869: g.drawLine(x + 10, y + 3, x + 10, y + 3);
870: g.drawLine(x + 9, y + 4, x + 10, y + 4);
871: g.drawLine(x + 1, y + 5, x + 9, y + 5);
872: g.drawLine(x + 1, y + 6, x + 1, y + 12);
873: g.drawLine(x + 9, y + 6, x + 9, y + 12);
874: g.drawLine(x + 1, y + 13, x + 9, y + 13);
875:
876:
877: g.drawLine(x + 7, y + 6, x + 8, y + 6);
878: g.drawLine(x + 6, y + 7, x + 8, y + 7);
879: g.drawLine(x + 5, y + 8, x + 6, y + 8);
880: g.drawLine(x + 4, y + 9, x + 5, y + 9);
881: g.drawLine(x + 3, y + 10, x + 4, y + 10);
882: g.drawLine(x + 2, y + 11, x + 3, y + 11);
883: g.drawLine(x + 2, y + 12, x + 4, y + 12);
884: g.drawLine(x + 8, y + 8, x + 8, y + 8);
885:
886:
887: g.setColor(MetalLookAndFeel.getBlack());
888: g.drawLine(x + 8, y, x + 13, y);
889: g.drawLine(x + 8, y + 1, x + 8, y + 1);
890: g.drawLine(x + 10, y + 2, x + 9, y + 3);
891: g.drawLine(x, y + 4, x + 8, y + 4);
892: g.drawLine(x, y + 5, x, y + 13);
893:
894: g.drawLine(x + 2, y + 10, x + 6, y + 6);
895: g.drawLine(x + 8, y + 9, x + 8, y + 11);
896: g.drawLine(x + 5, y + 12, x + 8, y + 12);
897:
898:
899: g.setColor(MetalLookAndFeel.getWhite());
900: g.drawLine(x + 2, y + 6, x + 5, y + 6);
901: g.drawLine(x + 2, y + 7, x + 2, y + 9);
902: g.drawLine(x + 4, y + 11, x + 7, y + 8);
903:
904: g.drawLine(x + 1, y + 14, x + 10, y + 14);
905: g.drawLine(x + 10, y + 5, x + 10, y + 13);
906:
907: g.drawLine(x + 9, y + 2, x + 9, y + 2);
908: g.drawLine(x + 11, y + 4, x + 11, y + 5);
909: g.drawLine(x + 13, y + 6, x + 14, y + 6);
910: g.drawLine(x + 14, y + 1, x + 14, y + 5);
911: }
912: }
913:
914:
917: private static class InternalFrameMinimizeIcon
918: implements Icon, Serializable
919: {
920:
921:
924: public InternalFrameMinimizeIcon()
925: {
926: }
927:
928:
933: public int getIconWidth()
934: {
935: return 16;
936: }
937:
938:
943: public int getIconHeight()
944: {
945: return 16;
946: }
947:
948:
956: public void paintIcon(Component c, Graphics g, int x, int y)
957: {
958: Color color = MetalLookAndFeel.getControlDarkShadow();
959: if (c instanceof JInternalFrame)
960: {
961: JInternalFrame f = (JInternalFrame) c;
962: if (f.isSelected())
963: color = MetalLookAndFeel.getPrimaryControlShadow();
964: }
965: g.setColor(color);
966: g.drawLine(x + 12, y + 1, x + 13, y + 1);
967: g.drawLine(x + 11, y + 2, x + 12, y + 2);
968: g.drawLine(x + 10, y + 3, x + 11, y + 3);
969: g.drawLine(x + 8, y + 2, x + 8, y + 3);
970: g.fillRect(x + 8, y + 4, 3, 3);
971: g.drawLine(x + 11, y + 6, x + 12, y + 6);
972:
973: g.drawLine(x + 1, y + 8, x + 6, y + 8);
974: g.drawLine(x + 1, y + 9, x + 1, y + 12);
975: g.drawLine(x + 6, y + 9, x + 6, y + 12);
976: g.drawLine(x + 1, y + 13, x + 6, y + 13);
977:
978: g.drawLine(x + 5, y + 9, x + 5, y + 9);
979: g.drawLine(x + 2, y + 12, x + 2, y + 12);
980:
981: g.setColor(MetalLookAndFeel.getBlack());
982: g.drawLine(x + 12, y, x + 9, y + 3);
983: g.drawLine(x + 7, y + 1, x + 8, y + 1);
984: g.drawLine(x + 7, y + 2, x + 7, y + 6);
985: g.drawLine(x, y + 7, x + 6, y + 7);
986: g.drawLine(x, y + 8, x, y + 13);
987: g.drawLine(x + 3, y + 12, x + 5, y + 12);
988: g.drawLine(x + 5, y + 10, x + 5, y + 11);
989: g.drawLine(x + 11, y + 5, x + 12, y + 5);
990:
991: g.setColor(MetalLookAndFeel.getWhite());
992: g.drawLine(x + 9, y + 2, x + 9, y + 2);
993: g.drawLine(x + 11, y + 4, x + 13, y + 2);
994: g.drawLine(x + 13, y + 6, x + 13, y + 6);
995: g.drawLine(x + 8, y + 7, x + 13, y + 7);
996: g.drawLine(x + 2, y + 9, x + 4, y + 9);
997: g.drawLine(x + 2, y + 10, x + 2, y + 11);
998: g.drawLine(x + 7, y + 9, x + 7, y + 13);
999: g.drawLine(x + 1, y + 14, x + 7, y + 14);
1000: }
1001: }
1002:
1003:
1007: private static class VerticalSliderThumbIcon implements Icon, Serializable
1008: {
1009:
1012: public VerticalSliderThumbIcon()
1013: {
1014: }
1015:
1016:
1021: public int getIconWidth()
1022: {
1023: return 16;
1024: }
1025:
1026:
1031: public int getIconHeight()
1032: {
1033: return 15;
1034: }
1035:
1036:
1046: public void paintIcon(Component c, Graphics g, int x, int y)
1047: {
1048: boolean focus = false;
1049: if (c != null)
1050: focus = c.hasFocus();
1051:
1052:
1053:
1054: g.setColor(Color.black);
1055: g.drawLine(x + 1, y, x + 7, y);
1056: g.drawLine(x + 8, y, x + 15, y + 7);
1057: g.drawLine(x + 14, y + 8, x + 8, y + 14);
1058: g.drawLine(x + 8, y + 14, x + 1, y + 14);
1059: g.drawLine(x, y + 13, x, y + 1);
1060:
1061:
1062: g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204));
1063: g.fillRect(x + 2, y + 2, 7, 12);
1064: g.drawLine(x + 9, y + 2, x + 9, y + 12);
1065: g.drawLine(x + 10, y + 3, x + 10, y + 11);
1066: g.drawLine(x + 11, y + 4, x + 11, y + 10);
1067: g.drawLine(x + 12, y + 5, x + 12, y + 9);
1068: g.drawLine(x + 13, y + 6, x + 13, y + 8);
1069: g.drawLine(x + 14, y + 7, x + 14, y + 7);
1070:
1071:
1072: g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255));
1073: g.drawLine(x + 1, y + 1, x + 8, y + 1);
1074: g.drawLine(x + 1, y + 2, x + 1, y + 13);
1075: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1076: g.drawLine(x + 2, y + 6, x + 2, y + 6);
1077: g.drawLine(x + 2, y + 10, x + 2, y + 10);
1078:
1079: g.drawLine(x + 4, y + 4, x + 4, y + 4);
1080: g.drawLine(x + 4, y + 8, x + 4, y + 8);
1081:
1082: g.drawLine(x + 6, y + 2, x + 6, y + 2);
1083: g.drawLine(x + 6, y + 6, x + 6, y + 6);
1084: g.drawLine(x + 6, y + 10, x + 6, y + 10);
1085:
1086:
1087: g.setColor(focus ? new Color(102, 102, 153) : Color.black);
1088: g.drawLine(x + 3, y + 3, x + 3, y + 3);
1089: g.drawLine(x + 3, y + 7, x + 3, y + 7);
1090: g.drawLine(x + 3, y + 11, x + 3, y + 11);
1091:
1092: g.drawLine(x + 5, y + 5, x + 5, y + 5);
1093: g.drawLine(x + 5, y + 9, x + 5, y + 9);
1094:
1095: g.drawLine(x + 7, y + 3, x + 7, y + 3);
1096: g.drawLine(x + 7, y + 7, x + 7, y + 7);
1097: g.drawLine(x + 7, y + 11, x + 7, y + 11);
1098: }
1099: }
1100:
1101:
1105: public static class TreeControlIcon implements Icon, Serializable
1106: {
1107:
1108:
1109: protected boolean isLight;
1110:
1111:
1112: private boolean collapsed;
1113:
1114:
1120: public TreeControlIcon(boolean isCollapsed)
1121: {
1122: collapsed = isCollapsed;
1123: }
1124:
1125:
1130: public int getIconWidth()
1131: {
1132: return 18;
1133: }
1134:
1139: public int getIconHeight()
1140: {
1141: return 18;
1142: }
1143:
1144:
1152: public void paintIcon(Component c, Graphics g, int x, int y)
1153: {
1154: x = x + 5;
1155: y = y + 5;
1156: if (collapsed)
1157: {
1158:
1159: g.setColor(Color.black);
1160: g.drawLine(x + 2, y, x + 5, y);
1161: g.drawLine(x + 6, y + 1, x + 7, y + 2);
1162: g.fillRect(x + 7, y + 3, 5, 2);
1163: g.drawLine(x + 7, y + 5, x + 6, y + 6);
1164: g.drawLine(x + 1, y + 1, x + 1, y + 1);
1165: g.drawLine(x, y + 2, x, y + 5);
1166: g.drawLine(x + 1, y + 6, x + 1, y + 6);
1167: g.drawLine(x + 2, y + 7, x + 5, y + 7);
1168: g.fillRect(x + 3, y + 3, 2, 2);
1169:
1170: g.setColor(new Color(204, 204, 255));
1171: g.drawLine(x + 3, y + 2, x + 4, y + 2);
1172: g.drawLine(x + 2, y + 3, x + 2, y + 4);
1173: g.drawLine(x + 3, y + 5, x + 3, y + 5);
1174: g.drawLine(x + 5, y + 3, x + 5, y + 3);
1175:
1176: g.setColor(new Color(153, 153, 204));
1177: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1178: g.drawLine(x + 2, y + 5, x + 2, y + 5);
1179: g.drawLine(x + 2, y + 6, x + 5, y + 6);
1180: g.drawLine(x + 5, y + 2, x + 5, y + 2);
1181: g.drawLine(x + 6, y + 2, x + 6, y + 5);
1182:
1183: g.setColor(new Color(102, 102, 153));
1184: g.drawLine(x + 2, y + 1, x + 5, y + 1);
1185: g.drawLine(x + 1, y + 2, x + 1, y + 5);
1186: }
1187: else
1188: {
1189:
1190: g.setColor(Color.black);
1191: g.drawLine(x + 2, y, x + 5, y);
1192: g.drawLine(x + 6, y + 1, x + 7, y + 2);
1193: g.drawLine(x + 7, y + 2, x + 7, y + 5);
1194: g.fillRect(x + 3, y + 7, 2, 5);
1195: g.drawLine(x + 7, y + 5, x + 6, y + 6);
1196: g.drawLine(x + 1, y + 1, x + 1, y + 1);
1197: g.drawLine(x, y + 2, x, y + 5);
1198: g.drawLine(x + 1, y + 6, x + 1, y + 6);
1199: g.drawLine(x + 2, y + 7, x + 5, y + 7);
1200: g.fillRect(x + 3, y + 3, 2, 2);
1201:
1202: g.setColor(new Color(204, 204, 255));
1203: g.drawLine(x + 3, y + 2, x + 4, y + 2);
1204: g.drawLine(x + 2, y + 3, x + 2, y + 4);
1205: g.drawLine(x + 3, y + 5, x + 3, y + 5);
1206: g.drawLine(x + 5, y + 3, x + 5, y + 3);
1207:
1208: g.setColor(new Color(153, 153, 204));
1209: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1210: g.drawLine(x + 2, y + 5, x + 2, y + 5);
1211: g.drawLine(x + 2, y + 6, x + 5, y + 6);
1212: g.drawLine(x + 5, y + 2, x + 5, y + 2);
1213: g.drawLine(x + 6, y + 2, x + 6, y + 5);
1214:
1215: g.setColor(new Color(102, 102, 153));
1216: g.drawLine(x + 2, y + 1, x + 5, y + 1);
1217: g.drawLine(x + 1, y + 2, x + 1, y + 5);
1218: }
1219: }
1220:
1221:
1229: public void paintMe(Component c, Graphics g, int x, int y)
1230: {
1231: paintIcon(c, g, x, y);
1232: }
1233: }
1234:
1235:
1238: public static class TreeFolderIcon extends FolderIcon16
1239: {
1240:
1243: public TreeFolderIcon()
1244: {
1245: }
1246:
1247:
1252: public int getAdditionalHeight()
1253: {
1254: return 2;
1255: }
1256:
1257:
1262: public int getShift()
1263: {
1264: return -1;
1265: }
1266: }
1267:
1268:
1271: public static class TreeLeafIcon extends FileIcon16
1272: {
1273:
1276: public TreeLeafIcon()
1277: {
1278: }
1279:
1280:
1285: public int getAdditionalHeight()
1286: {
1287: return 4;
1288: }
1289:
1290:
1295: public int getShift()
1296: {
1297: return 2;
1298: }
1299: }
1300:
1301:
1302: private static RadioButtonIcon radioButtonIcon;
1303:
1304:
1308: public MetalIconFactory()
1309: {
1310: }
1311:
1312:
1319: public static Icon getCheckBoxIcon()
1320: {
1321: return new MetalCheckBoxIcon();
1322: }
1323:
1324:
1330: public static Icon getCheckBoxMenuItemIcon()
1331: {
1332: return new CheckBoxMenuItemIcon();
1333: }
1334:
1335:
1340: public static Icon getRadioButtonIcon()
1341: {
1342: if (radioButtonIcon == null)
1343: radioButtonIcon = new RadioButtonIcon();
1344: return radioButtonIcon;
1345: }
1346:
1347:
1352: public static Icon getRadioButtonMenuItemIcon()
1353: {
1354: return new RadioButtonMenuItemIcon();
1355: }
1356:
1357:
1363: public static Icon getHorizontalSliderThumbIcon()
1364: {
1365: return new HorizontalSliderThumbIcon();
1366: }
1367:
1368:
1376: public static Icon getInternalFrameCloseIcon(int size)
1377: {
1378: return new InternalFrameCloseIcon(size);
1379: }
1380:
1381:
1387: public static Icon getInternalFrameDefaultMenuIcon()
1388: {
1389: return new InternalFrameDefaultMenuIcon();
1390: }
1391:
1392:
1401: public static Icon getInternalFrameMaximizeIcon(int size)
1402: {
1403: return new InternalFrameMaximizeIcon();
1404: }
1405:
1406:
1414: public static Icon getInternalFrameMinimizeIcon(int size)
1415: {
1416: return new InternalFrameMinimizeIcon();
1417: }
1418:
1419:
1429: public static Icon getInternalFrameAltMaximizeIcon(int size)
1430: {
1431: return new InternalFrameAltMaximizeIcon(size);
1432: }
1433:
1434:
1440: public static Icon getVerticalSliderThumbIcon()
1441: {
1442: return new VerticalSliderThumbIcon();
1443: }
1444:
1445:
1450: public static Icon getTreeFolderIcon()
1451: {
1452: return new TreeFolderIcon();
1453: }
1454:
1455:
1460: public static Icon getTreeLeafIcon()
1461: {
1462: return new TreeLeafIcon();
1463: }
1464:
1465:
1473: public static Icon getTreeControlIcon(boolean isCollapsed)
1474: {
1475: return new TreeControlIcon(isCollapsed);
1476: }
1477:
1478: }