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: import ;
55: import ;
56: import ;
57: import ;
58:
59:
60:
63: public class MetalIconFactory implements Serializable
64: {
65:
66:
67: public static final boolean DARK = false;
68:
69:
70: public static final boolean LIGHT = true;
71:
72:
73: private static Icon menuArrow;
74:
75:
76: private static Icon menuItemArrow;
77:
78:
81: private static class CheckBoxMenuItemIcon implements Icon, Serializable
82: {
83:
86: public CheckBoxMenuItemIcon()
87: {
88:
89: }
90:
91:
96: public int getIconWidth()
97: {
98: return 10;
99: }
100:
101:
106: public int getIconHeight()
107: {
108: return 10;
109: }
110:
111:
119: public void paintIcon(Component c, Graphics g, int x, int y)
120: {
121: JCheckBoxMenuItem item = (JCheckBoxMenuItem) c;
122:
123: if (item.isArmed())
124: g.setColor(MetalLookAndFeel.getBlack());
125: else
126: g.setColor(MetalLookAndFeel.getControlDarkShadow());
127: g.drawLine(x, y, x + 8, y);
128: g.drawLine(x, y + 1, x, y + 8);
129: g.drawLine(x + 2, y + 8, x + 8, y + 8);
130: g.drawLine(x + 8, y + 2, x + 8, y + 7);
131:
132: g.setColor(MetalLookAndFeel.getWhite());
133: g.drawLine(x + 1, y + 1, x + 7, y + 1);
134: g.drawLine(x + 1, y + 2, x + 1, y + 7);
135: g.drawLine(x + 1, y + 9, x + 9, y + 9);
136: g.drawLine(x + 9, y + 1, x + 9, y + 8);
137:
138:
139: if (item.isSelected())
140: {
141: g.setColor(MetalLookAndFeel.getBlack());
142: g.fillRect(x + 2, y + 2, 2, 5);
143: for (int i = 0; i < 6; i++)
144: g.drawLine(x + 8 - i, y + i, x + 9 - i, y + i);
145: }
146:
147: }
148: }
149:
150:
156: private static class FileChooserDetailViewIcon implements Icon, Serializable
157: {
158:
159:
162: public FileChooserDetailViewIcon()
163: {
164:
165: }
166:
167:
172: public int getIconWidth()
173: {
174: return 18;
175: }
176:
177:
182: public int getIconHeight()
183: {
184: return 18;
185: }
186:
187:
195: public void paintIcon(Component c, Graphics g, int x, int y)
196: {
197: Color savedColor = g.getColor();
198: g.setColor(MetalLookAndFeel.getBlack());
199:
200:
201: g.drawLine(x + 2, y + 2, x + 5, y + 2);
202: g.drawLine(x + 6, y + 3, x + 6, y + 7);
203: g.drawLine(x + 2, y + 7, x + 6, y + 7);
204: g.drawLine(x + 2, y + 2, x + 2, y + 7);
205:
206:
207: g.drawLine(x + 2, y + 10, x + 5, y + 10);
208: g.drawLine(x + 6, y + 11, x + 6, y + 15);
209: g.drawLine(x + 2, y + 15, x + 6, y + 15);
210: g.drawLine(x + 2, y + 10, x + 2, y + 15);
211:
212:
213: g.drawLine(x + 8, y + 5, x + 15, y + 5);
214: g.drawLine(x + 8, y + 13, x + 15, y + 13);
215:
216:
217: g.setColor(MetalLookAndFeel.getPrimaryControl());
218: g.fillRect(x + 3, y + 3, 3, 4);
219: g.fillRect(x + 3, y + 11, 3, 4);
220:
221:
222: g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
223: g.drawLine(x + 4, y + 4, x + 4, y + 5);
224: g.drawLine(x + 4, y + 12, x + 4, y + 13);
225:
226: g.setColor(savedColor);
227: }
228: }
229:
230:
236: private static class FileChooserHomeFolderIcon implements Icon, Serializable
237: {
238:
239:
242: public FileChooserHomeFolderIcon()
243: {
244:
245: }
246:
247:
252: public int getIconWidth()
253: {
254: return 18;
255: }
256:
257:
262: public int getIconHeight()
263: {
264: return 18;
265: }
266:
267:
275: public void paintIcon(Component c, Graphics g, int x, int y)
276: {
277: Color savedColor = g.getColor();
278: g.setColor(MetalLookAndFeel.getBlack());
279:
280:
281: g.drawLine(x + 1, y + 8, x + 8, y + 1);
282: g.drawLine(x + 8, y + 1, x + 15, y + 8);
283:
284:
285: g.drawLine(x + 3, y + 6, x + 3, y + 15);
286: g.drawLine(x + 3, y + 15, x + 13, y + 15);
287: g.drawLine(x + 13, y + 6, x + 13, y + 15);
288:
289:
290: g.drawLine(x + 6, y + 9, x + 6, y + 15);
291: g.drawLine(x + 6, y + 9, x + 10, y + 9);
292: g.drawLine(x + 10, y + 9, x + 10, y + 15);
293:
294:
295: g.drawLine(x + 11, y + 2, x + 11, y + 4);
296: g.drawLine(x + 12, y + 2, x + 12, y + 5);
297:
298: g.setColor(MetalLookAndFeel.getControlDarkShadow());
299:
300:
301: int xx = x + 8;
302: for (int i = 0; i < 4; i++)
303: g.drawLine(xx - i, y + 2 + i, xx + i, y + 2 + i);
304: g.fillRect(x + 4, y + 6, 9, 2);
305:
306:
307: g.drawLine(x + 9, y + 12, x + 9, y + 12);
308:
309:
310: g.setColor(MetalLookAndFeel.getPrimaryControl());
311: g.drawLine(x + 4, y + 8, x + 12, y + 8);
312: g.fillRect(x + 4, y + 9, 2, 6);
313: g.fillRect(x + 11, y + 9, 2, 6);
314:
315: g.setColor(savedColor);
316: }
317: }
318:
319:
325: private static class FileChooserListViewIcon implements Icon, Serializable
326: {
327:
330: public FileChooserListViewIcon()
331: {
332:
333: }
334:
335:
340: public int getIconWidth()
341: {
342: return 18;
343: }
344:
345:
350: public int getIconHeight()
351: {
352: return 18;
353: }
354:
355:
363: public void paintIcon(Component c, Graphics g, int x, int y)
364: {
365: Color savedColor = g.getColor();
366: g.setColor(MetalLookAndFeel.getBlack());
367:
368:
369: g.drawLine(x + 2, y + 2, x + 5, y + 2);
370: g.drawLine(x + 6, y + 3, x + 6, y + 7);
371: g.drawLine(x + 2, y + 7, x + 6, y + 7);
372: g.drawLine(x + 2, y + 2, x + 2, y + 7);
373:
374:
375: g.drawLine(x + 2, y + 10, x + 5, y + 10);
376: g.drawLine(x + 6, y + 11, x + 6, y + 15);
377: g.drawLine(x + 2, y + 15, x + 6, y + 15);
378: g.drawLine(x + 2, y + 10, x + 2, y + 15);
379:
380:
381: g.drawLine(x + 10, y + 2, x + 13, y + 2);
382: g.drawLine(x + 14, y + 3, x + 14, y + 7);
383: g.drawLine(x + 10, y + 7, x + 14, y + 7);
384: g.drawLine(x + 10, y + 2, x + 10, y + 7);
385:
386:
387: g.drawLine(x + 10, y + 10, x + 13, y + 10);
388: g.drawLine(x + 14, y + 11, x + 14, y + 15);
389: g.drawLine(x + 10, y + 15, x + 14, y + 15);
390: g.drawLine(x + 10, y + 10, x + 10, y + 15);
391:
392: g.drawLine(x + 8, y + 5, x + 8, y + 5);
393: g.drawLine(x + 8, y + 13, x + 8, y + 13);
394: g.drawLine(x + 16, y + 5, x + 16, y + 5);
395: g.drawLine(x + 16, y + 13, x + 16, y + 13);
396:
397:
398: g.setColor(MetalLookAndFeel.getPrimaryControl());
399: g.fillRect(x + 3, y + 3, 3, 4);
400: g.fillRect(x + 3, y + 11, 3, 4);
401: g.fillRect(x + 11, y + 3, 3, 4);
402: g.fillRect(x + 11, y + 11, 3, 4);
403:
404:
405: g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
406: g.drawLine(x + 4, y + 4, x + 4, y + 5);
407: g.drawLine(x + 4, y + 12, x + 4, y + 13);
408: g.drawLine(x + 12, y + 4, x + 12, y + 5);
409: g.drawLine(x + 12, y + 12, x + 12, y + 13);
410:
411: g.setColor(savedColor);
412: }
413: }
414:
415:
421: private static class FileChooserNewFolderIcon implements Icon, Serializable
422: {
423:
426: public FileChooserNewFolderIcon()
427: {
428:
429: }
430:
431:
436: public int getIconWidth()
437: {
438: return 18;
439: }
440:
441:
446: public int getIconHeight()
447: {
448: return 18;
449: }
450:
451:
459: public void paintIcon(Component c, Graphics g, int x, int y)
460: {
461: Color savedColor = g.getColor();
462: g.setColor(MetalLookAndFeel.getBlack());
463:
464: g.drawLine(x + 2, y + 5, x + 9, y + 5);
465: g.drawLine(x + 10, y + 6, x + 15, y + 6);
466: g.drawLine(x + 15, y + 5, x + 15, y + 14);
467: g.drawLine(x + 2, y + 14, x + 15, y + 14);
468: g.drawLine(x + 1, y + 6, x + 1, y + 14);
469:
470: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
471: g.drawLine(x + 11, y + 3, x + 15, y + 3);
472: g.drawLine(x + 10, y + 4, x + 15, y + 4);
473:
474: g.setColor(MetalLookAndFeel.getPrimaryControl());
475: g.fillRect(x + 3, y + 7, 7, 7);
476: g.fillRect(x + 10, y + 8, 5, 6);
477: g.drawLine(x + 10, y + 5, x + 14, y + 5);
478:
479: g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
480: g.drawLine(x + 10, y + 7, x + 14, y + 7);
481: g.drawLine(x + 2, y + 6, x + 9, y + 6);
482: g.drawLine(x + 2, y + 6, x + 2, y + 13);
483: g.setColor(savedColor);
484: }
485: }
486:
487:
493: private static class FileChooserUpFolderIcon extends FileChooserNewFolderIcon
494: implements Icon, Serializable
495: {
496:
499: public FileChooserUpFolderIcon()
500: {
501:
502: }
503:
504:
512: public void paintIcon(Component c, Graphics g, int x, int y)
513: {
514: Color savedColor = g.getColor();
515:
516:
517: super.paintIcon(c, g, x, y);
518:
519:
520: g.setColor(MetalLookAndFeel.getBlack());
521: g.drawLine(x + 8, y + 9, x + 8, y + 16);
522: int xx = x + 8;
523: for (int i = 0; i < 4; i++)
524: g.drawLine(xx - i, y + 9 + i, xx + i, y + 9 + i);
525: g.setColor(savedColor);
526: }
527: }
528:
529:
533: public static class FileIcon16 implements Icon, Serializable
534: {
535:
540: public int getIconWidth()
541: {
542: return 16;
543: }
544:
545:
552: public int getIconHeight()
553: {
554: return 16 + getAdditionalHeight();
555: }
556:
557:
565: public void paintIcon(Component c, Graphics g, int x, int y)
566: {
567:
568: g.setColor(Color.black);
569: g.drawLine(x, y, x + 9, y);
570: g.drawLine(x, y + 1, x, y + 15);
571: g.drawLine(x, y + 15, x + 12, y + 15);
572: g.drawLine(x + 12, y + 15, x + 12, y + 6);
573: g.drawLine(x + 12, y + 6, x + 9, y);
574:
575: g.drawLine(x + 7, y + 2, x + 11, y + 6);
576: g.drawLine(x + 8, y + 1, x + 9, y + 1);
577:
578: g.setColor(new Color(204, 204, 255));
579: g.drawLine(x + 1, y + 1, x + 7, y + 1);
580: g.drawLine(x + 1, y + 1, x + 1, y + 14);
581: g.drawLine(x + 1, y + 14, x + 11, y + 14);
582: g.drawLine(x + 11, y + 14, x + 11, y + 7);
583: g.drawLine(x + 8, y + 2, x + 10, y + 4);
584: }
585:
586:
593: public int getAdditionalHeight()
594: {
595: return 0;
596: }
597:
598:
603: public int getShift()
604: {
605: return 0;
606: }
607:
608: }
609:
610:
613: public static class FolderIcon16 implements Icon, Serializable
614: {
615:
620: public int getIconWidth() {
621: return 16;
622: }
623:
624:
631: public int getIconHeight()
632: {
633: return 16 + getAdditionalHeight();
634: }
635:
636:
644: public void paintIcon(Component c, Graphics g, int x, int y)
645: {
646:
647: g.setColor(Color.black);
648: g.drawLine(x, y + 3, x, y + 12);
649: g.drawLine(x, y + 12, x + 15, y + 12);
650: g.drawLine(x + 15, y + 12, x + 15, y + 2);
651: g.drawLine(x + 14, y + 3, x + 9, y + 3);
652: g.drawLine(x + 8, y + 2, x + 1, y + 2);
653: g.setColor(new Color(204, 204, 255));
654: g.fillRect(x + 2, y + 4, 7, 8);
655: g.fillRect(x + 9, y + 5, 6, 7);
656: g.setColor(new Color(102, 102, 153));
657: g.drawLine(x + 9, y + 2, x + 14, y + 2);
658: g.setColor(new Color(50, 50, 120));
659: g.drawLine(x + 9, y + 1, x + 15, y + 1);
660: g.drawLine(x + 10, y, x + 15, y);
661: }
662:
663:
670: public int getAdditionalHeight()
671: {
672: return 0;
673: }
674:
675:
680: public int getShift()
681: {
682: return 0;
683: }
684:
685: }
686:
687:
693: public static class PaletteCloseIcon
694: implements Icon, Serializable, UIResource
695: {
696:
701: public int getIconWidth()
702: {
703: return 7;
704: }
705:
706:
711: public int getIconHeight()
712: {
713: return 7;
714: }
715:
716:
724: public void paintIcon(Component c, Graphics g, int x, int y)
725: {
726: Color savedColor = g.getColor();
727: AbstractButton button = (AbstractButton) c;
728: if (button.getModel().isPressed())
729: g.setColor(MetalLookAndFeel.getBlack());
730: else
731: g.setColor(MetalLookAndFeel.getControlDarkShadow());
732: g.fillRect(x + 2, y + 2, 3, 3);
733: g.drawLine(x + 1, y, x + 1, y + 2);
734: g.drawLine(x, y + 1, x + 2, y + 1);
735: g.drawLine(x + 5, y, x + 5, y + 2);
736: g.drawLine(x + 4, y + 1, x + 6, y + 1);
737: g.drawLine(x + 1, y + 4, x + 1, y + 6);
738: g.drawLine(x, y + 5, x + 2, y + 5);
739: g.drawLine(x + 5, y + 4, x + 5, y + 6);
740: g.drawLine(x + 4, y + 5, x + 6, y + 5);
741: g.setColor(MetalLookAndFeel.getControlHighlight());
742: g.drawLine(x + 2, y + 6, x + 3, y + 5);
743: g.drawLine(x + 5, y + 3, x + 6, y + 2);
744: g.drawLine(x + 6, y + 6, x + 6, y + 6);
745: g.setColor(savedColor);
746: }
747: }
748:
749:
755: static class RadioButtonIcon implements Icon, UIResource, Serializable
756: {
757:
758:
763: public int getIconWidth()
764: {
765: return 13;
766: }
767:
768:
773: public int getIconHeight()
774: {
775: return 13;
776: }
777:
778:
788: public void paintIcon(Component c, Graphics g, int x, int y)
789: {
790: if (UIManager.get("RadioButton.gradient") != null)
791: MetalUtils.paintGradient(g, x, y, getIconWidth(), getIconHeight(),
792: SwingConstants.VERTICAL, "RadioButton.gradient");
793:
794: Color savedColor = g.getColor();
795: JRadioButton b = (JRadioButton) c;
796:
797:
798: if (b.isEnabled())
799: g.setColor(MetalLookAndFeel.getControlDarkShadow());
800: else
801: g.setColor(MetalLookAndFeel.getControlDisabled());
802: g.drawLine(x + 2, y + 1, x + 3, y + 1);
803: g.drawLine(x + 4, y, x + 7, y);
804: g.drawLine(x + 8, y + 1, x + 9, y + 1);
805: g.drawLine(x + 10, y + 2, x + 10, y + 3);
806: g.drawLine(x + 11, y + 4, x + 11, y + 7);
807: g.drawLine(x + 10, y + 8, x + 10, y + 9);
808: g.drawLine(x + 8, y + 10, x + 9, y + 10);
809: g.drawLine(x + 4, y + 11, x + 7, y + 11);
810: g.drawLine(x + 2, y + 10, x + 3, y + 10);
811: g.drawLine(x + 1, y + 9, x + 1, y + 8);
812: g.drawLine(x, y + 7, x, y + 4);
813: g.drawLine(x + 1, y + 2, x + 1, y + 3);
814:
815: if (b.getModel().isArmed())
816: {
817: g.setColor(MetalLookAndFeel.getControlShadow());
818: g.drawLine(x + 4, y + 1, x + 7, y + 1);
819: g.drawLine(x + 4, y + 10, x + 7, y + 10);
820: g.drawLine(x + 1, y + 4, x + 1, y + 7);
821: g.drawLine(x + 10, y + 4, x + 10, y + 7);
822: g.fillRect(x + 2, y + 2, 8, 8);
823: }
824: else
825: {
826:
827: if (b.isEnabled())
828: {
829: g.setColor(MetalLookAndFeel.getWhite());
830:
831: g.drawLine(x + 2, y + 8, x + 2, y + 9);
832: g.drawLine(x + 1, y + 4, x + 1, y + 7);
833: g.drawLine(x + 2, y + 2, x + 2, y + 3);
834: g.drawLine(x + 3, y + 2, x + 3, y + 2);
835: g.drawLine(x + 4, y + 1, x + 7, y + 1);
836: g.drawLine(x + 8, y + 2, x + 9, y + 2);
837: }
838: }
839:
840:
841: if (b.isEnabled())
842: {
843: g.setColor(MetalLookAndFeel.getWhite());
844:
845:
846: g.drawLine(x + 10, y + 1, x + 10, y + 1);
847: g.drawLine(x + 11, y + 2, x + 11, y + 3);
848: g.drawLine(x + 12, y + 4, x + 12, y + 7);
849: g.drawLine(x + 11, y + 8, x + 11, y + 9);
850: g.drawLine(x + 10, y + 10, x + 10, y + 10);
851: g.drawLine(x + 8, y + 11, x + 9, y + 11);
852: g.drawLine(x + 4, y + 12, x + 7, y + 12);
853: g.drawLine(x + 2, y + 11, x + 3, y + 11);
854: }
855:
856: if (b.isSelected())
857: {
858: if (b.isEnabled())
859: g.setColor(MetalLookAndFeel.getBlack());
860: else
861: g.setColor(MetalLookAndFeel.getControlDisabled());
862: g.drawLine(x + 4, y + 3, x + 7, y + 3);
863: g.fillRect(x + 3, y + 4, 6, 4);
864: g.drawLine(x + 4, y + 8, x + 7, y + 8);
865: }
866: g.setColor(savedColor);
867: }
868: }
869:
870:
873: private static class RadioButtonMenuItemIcon implements Icon, Serializable
874: {
875:
878: public RadioButtonMenuItemIcon()
879: {
880:
881: }
882:
883:
888: public int getIconWidth()
889: {
890: return 10;
891: }
892:
893:
898: public int getIconHeight()
899: {
900: return 10;
901: }
902:
903:
911: public void paintIcon(Component c, Graphics g, int x, int y)
912: {
913: Color savedColor = g.getColor();
914: JRadioButtonMenuItem item = (JRadioButtonMenuItem) c;
915: g.setColor(MetalLookAndFeel.getBlack());
916: g.drawLine(x + 2, y, x + 6, y);
917: g.drawLine(x + 7, y + 1, x + 7, y + 1);
918: g.drawLine(x + 8, y + 2, x + 8, y + 6);
919: g.drawLine(x + 7, y + 7, x + 7, y + 7);
920: g.drawLine(x + 2, y + 8, x + 6, y + 8);
921: g.drawLine(x + 1, y + 7, x + 1, y + 7);
922: g.drawLine(x, y + 2, x, y + 6);
923: g.drawLine(x + 1, y + 1, x + 1, y + 1);
924:
925: if (item.isSelected())
926: {
927: g.drawLine(x + 3, y + 2, x + 5, y + 2);
928: g.fillRect(x + 2, y + 3, 5, 3);
929: g.drawLine(x + 3, y + 6, x + 5, y + 6);
930: }
931:
932:
933: g.setColor(MetalLookAndFeel.getControlHighlight());
934: g.drawLine(x + 3, y + 1, x + 6, y + 1);
935: g.drawLine(x + 8, y + 1, x + 8, y + 1);
936: g.drawLine(x + 9, y + 2, x + 9, y + 7);
937: g.drawLine(x + 8, y + 8, x + 8, y + 8);
938: g.drawLine(x + 2, y + 9, x + 7, y + 9);
939: g.drawLine(x + 1, y + 8, x + 1, y + 8);
940: g.drawLine(x + 1, y + 3, x + 1, y + 6);
941: g.drawLine(x + 2, y + 2, x + 2, y + 2);
942: g.setColor(savedColor);
943: }
944: }
945:
946:
950: private static class HorizontalSliderThumbIcon implements Icon, Serializable
951: {
952:
953:
956: public HorizontalSliderThumbIcon()
957: {
958:
959: }
960:
961:
966: public int getIconWidth()
967: {
968: return 15;
969: }
970:
971:
976: public int getIconHeight()
977: {
978: return 16;
979: }
980:
981:
990: public void paintIcon(Component c, Graphics g, int x, int y)
991: {
992: boolean enabled = false;
993: boolean focus = false;
994: if (c != null)
995: {
996: enabled = c.isEnabled();
997: focus = c.hasFocus();
998: }
999:
1000:
1001: if (enabled)
1002: g.setColor(MetalLookAndFeel.getBlack());
1003: else
1004: g.setColor(MetalLookAndFeel.getControlDarkShadow());
1005: g.drawLine(x + 1, y, x + 13, y);
1006: g.drawLine(x + 14, y + 1, x + 14, y + 7);
1007: g.drawLine(x + 14, y + 8, x + 7, y + 15);
1008: g.drawLine(x + 6, y + 14, x, y + 8);
1009: g.drawLine(x, y + 7, x, y + 1);
1010:
1011:
1012: if (focus)
1013: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1014: else
1015: g.setColor(MetalLookAndFeel.getControl());
1016: g.fillRect(x + 1, y + 2, 13, 7);
1017: g.drawLine(x + 2, y + 9, x + 12, y + 9);
1018: g.drawLine(x + 3, y + 10, x + 11, y + 10);
1019: g.drawLine(x + 4, y + 11, x + 10, y + 11);
1020: g.drawLine(x + 5, y + 12, x + 9, y + 12);
1021: g.drawLine(x + 6, y + 13, x + 8, y + 13);
1022: g.drawLine(x + 7, y + 14, x + 7, y + 14);
1023:
1024:
1025: if (c.isEnabled())
1026: {
1027: if (focus)
1028: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1029: else
1030: g.setColor(MetalLookAndFeel.getBlack());
1031: g.drawLine(x + 3, y + 3, x + 3, y + 3);
1032: g.drawLine(x + 7, y + 3, x + 7, y + 3);
1033: g.drawLine(x + 11, y + 3, x + 11, y + 3);
1034:
1035: g.drawLine(x + 5, y + 5, x + 5, y + 5);
1036: g.drawLine(x + 9, y + 5, x + 9, y + 5);
1037:
1038: g.drawLine(x + 3, y + 7, x + 3, y + 7);
1039: g.drawLine(x + 7, y + 7, x + 7, y + 7);
1040: g.drawLine(x + 11, y + 7, x + 11, y + 7);
1041:
1042:
1043: if (focus)
1044: g.setColor(MetalLookAndFeel.getPrimaryControl());
1045: else
1046: g.setColor(MetalLookAndFeel.getWhite());
1047: g.drawLine(x + 1, y + 1, x + 13, y + 1);
1048: g.drawLine(x + 1, y + 2, x + 1, y + 8);
1049: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1050: g.drawLine(x + 6, y + 2, x + 6, y + 2);
1051: g.drawLine(x + 10, y + 2, x + 10, y + 2);
1052:
1053: g.drawLine(x + 4, y + 4, x + 4, y + 4);
1054: g.drawLine(x + 8, y + 4, x + 8, y + 4);
1055:
1056: g.drawLine(x + 2, y + 6, x + 2, y + 6);
1057: g.drawLine(x + 6, y + 6, x + 6, y + 6);
1058: g.drawLine(x + 10, y + 6, x + 10, y + 6);
1059: }
1060:
1061: }
1062: }
1063:
1064:
1068: private static class InternalFrameCloseIcon implements Icon, Serializable
1069: {
1070:
1071: private int size;
1072:
1073:
1078: public InternalFrameCloseIcon(int size)
1079: {
1080: this.size = size;
1081: }
1082:
1083:
1088: public int getIconWidth()
1089: {
1090: return size;
1091: }
1092:
1093:
1098: public int getIconHeight()
1099: {
1100: return size;
1101: }
1102:
1103:
1111: public void paintIcon(Component c, Graphics g, int x, int y)
1112: {
1113: Color savedColor = g.getColor();
1114: AbstractButton b = (AbstractButton) c;
1115:
1116:
1117: if (b.getModel().isPressed())
1118:
1119:
1120: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1121: else
1122: g.setColor(MetalLookAndFeel.getPrimaryControl());
1123: g.fillRect(x + 2, y + 2, 10, 10);
1124:
1125:
1126: if (b.getModel().isPressed())
1127: g.setColor(MetalLookAndFeel.getBlack());
1128: else
1129: {
1130:
1131:
1132: boolean selected = true;
1133: if (selected)
1134: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1135: else
1136: g.setColor(MetalLookAndFeel.getControlDarkShadow());
1137: }
1138: g.drawLine(x + 1, y + 1, x + 13, y + 1);
1139: g.drawLine(x + 1, y + 2, x + 1, y + 12);
1140: g.drawLine(x + 1, y + 13, x + 13, y + 13);
1141: g.drawLine(x + 13, y + 2, x + 13, y + 12);
1142: g.drawLine(x + 2, y + 12, x + 2, y + 12);
1143: g.drawLine(x + 12, y + 2, x + 12, y + 2);
1144:
1145: g.fillRect(x + 4, y + 4, 2, 2);
1146: g.fillRect(x + 5, y + 5, 4, 4);
1147: g.drawLine(x + 9, y + 4, x + 10, y + 4);
1148: g.drawLine(x + 9, y + 4, x + 9, y + 5);
1149: g.drawLine(x + 4, y + 9, x + 4, y + 10);
1150: g.drawLine(x + 4, y + 9, x + 5, y + 9);
1151: g.drawLine(x + 9, y + 8, x + 9, y + 10);
1152: g.drawLine(x + 8, y + 9, x + 10, y + 9);
1153:
1154: g.setColor(MetalLookAndFeel.getBlack());
1155: g.drawLine(x, y, x + 13, y);
1156: g.drawLine(x, y + 1, x, y + 13);
1157: g.drawLine(x + 3, y + 4, x + 4, y + 3);
1158: g.drawLine(x + 3, y + 9, x + 5, y + 7);
1159: g.drawLine(x + 7, y + 5, x + 9, y + 3);
1160:
1161: g.drawLine(x + 12, y + 3, x + 12, y + 11);
1162: g.drawLine(x + 3, y + 12, x + 12, y + 12);
1163:
1164: g.setColor(MetalLookAndFeel.getWhite());
1165: g.drawLine(x + 1, y + 14, x + 14, y + 14);
1166: g.drawLine(x + 14, y + 1, x + 14, y + 14);
1167:
1168: if (!b.getModel().isPressed())
1169: {
1170: g.drawLine(x + 5, y + 10, x + 5, y + 10);
1171: g.drawLine(x + 6, y + 9, x + 7, y + 9);
1172: g.drawLine(x + 10, y + 5, x + 10, y + 5);
1173: g.drawLine(x + 9, y + 6, x + 9, y + 7);
1174: g.drawLine(x + 10, y + 10, x + 11, y + 10);
1175: g.drawLine(x + 10, y + 11, x + 10, y + 11);
1176: }
1177: g.setColor(savedColor);
1178: }
1179: }
1180:
1181:
1184: private static class InternalFrameDefaultMenuIcon
1185: implements Icon, Serializable
1186: {
1187:
1188:
1191: public InternalFrameDefaultMenuIcon()
1192: {
1193:
1194: }
1195:
1196:
1201: public int getIconWidth()
1202: {
1203: return 16;
1204: }
1205:
1206:
1211: public int getIconHeight()
1212: {
1213: return 16;
1214: }
1215:
1216:
1224: public void paintIcon(Component c, Graphics g, int x, int y)
1225: {
1226: g.setColor(new Color(102, 102, 153));
1227: g.fillRect(x + 1, y, 14, 2);
1228: g.fillRect(x, y + 1, 2, 14);
1229: g.fillRect(x + 1, y + 14, 14, 2);
1230: g.fillRect(x + 14, y + 1, 2, 14);
1231: g.drawLine(x + 2, y + 5, x + 14, y + 5);
1232:
1233: g.setColor(new Color(204, 204, 255));
1234: g.fillRect(x + 2, y + 2, 12, 3);
1235:
1236: g.setColor(new Color(102, 102, 153));
1237: g.drawLine(x + 3, y + 3, x + 3, y + 3);
1238: g.drawLine(x + 6, y + 3, x + 6, y + 3);
1239: g.drawLine(x + 9, y + 3, x + 9, y + 3);
1240: g.drawLine(x + 12, y + 3, x + 12, y + 3);
1241:
1242: g.setColor(Color.white);
1243: g.fillRect(x + 2, y + 6, 12, 8);
1244: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1245: g.drawLine(x + 5, y + 2, x + 5, y + 2);
1246: g.drawLine(x + 8, y + 2, x + 8, y + 2);
1247: g.drawLine(x + 11, y + 2, x + 11, y + 2);
1248: }
1249: }
1250:
1251:
1256: private static class InternalFrameAltMaximizeIcon
1257: implements Icon, Serializable
1258: {
1259:
1260: private int size;
1261:
1262:
1267: public InternalFrameAltMaximizeIcon(int size)
1268: {
1269: this.size = size;
1270: }
1271:
1272:
1277: public int getIconWidth()
1278: {
1279: return size;
1280: }
1281:
1282:
1287: public int getIconHeight()
1288: {
1289: return size;
1290: }
1291:
1292:
1300: public void paintIcon(Component c, Graphics g, int x, int y)
1301: {
1302: Color savedColor = g.getColor();
1303:
1304: AbstractButton b = (AbstractButton) c;
1305:
1306:
1307: if (b.getModel().isPressed())
1308: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1309: else
1310: g.setColor(MetalLookAndFeel.getPrimaryControl());
1311: g.fillRect(x + 2, y + 6, 7, 7);
1312:
1313:
1314: if (b.getModel().isPressed())
1315: g.setColor(MetalLookAndFeel.getBlack());
1316: else
1317: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1318:
1319: g.drawLine(x + 12, y + 1, x + 13, y + 1);
1320: g.drawLine(x + 11, y + 2, x + 12, y + 2);
1321: g.drawLine(x + 10, y + 3, x + 11, y + 3);
1322: g.drawLine(x + 8, y + 2, x + 8, y + 3);
1323: g.fillRect(x + 8, y + 4, 3, 3);
1324: g.drawLine(x + 11, y + 6, x + 12, y + 6);
1325:
1326: g.drawLine(x + 1, y + 5, x + 5, y + 5);
1327: g.drawLine(x + 1, y + 6, x + 1, y + 12);
1328: g.drawLine(x + 9, y + 9, x + 9, y + 12);
1329: g.drawLine(x + 1, y + 13, x + 9, y + 13);
1330:
1331: g.drawLine(x + 2, y + 12, x + 2, y + 12);
1332:
1333: g.setColor(MetalLookAndFeel.getBlack());
1334: g.drawLine(x + 12, y, x + 9, y + 3);
1335: g.drawLine(x + 7, y + 1, x + 8, y + 1);
1336: g.drawLine(x + 7, y + 2, x + 7, y + 6);
1337: g.drawLine(x + 11, y + 5, x + 12, y + 5);
1338: g.drawLine(x, y + 4, x + 5, y + 4);
1339: g.drawLine(x, y + 5, x, y + 13);
1340: g.drawLine(x + 3, y + 12, x + 8, y + 12);
1341: g.drawLine(x + 8, y + 8, x + 8, y + 11);
1342: g.drawLine(x + 9, y + 8, x + 9, y + 8);
1343:
1344: g.setColor(MetalLookAndFeel.getWhite());
1345: g.drawLine(x + 9, y + 2, x + 9, y + 2);
1346: g.drawLine(x + 11, y + 4, x + 13, y + 2);
1347: g.drawLine(x + 13, y + 6, x + 13, y + 6);
1348: g.drawLine(x + 8, y + 7, x + 13, y + 7);
1349: g.drawLine(x + 6, y + 5, x + 6, y + 5);
1350: g.drawLine(x + 10, y + 8, x + 10, y + 13);
1351: g.drawLine(x + 1, y + 14, x + 10, y + 14);
1352:
1353: if (!b.getModel().isPressed())
1354: {
1355: g.drawLine(x + 2, y + 6, x + 6, y + 6);
1356: g.drawLine(x + 2, y + 6, x + 2, y + 11);
1357: }
1358:
1359: g.setColor(savedColor);
1360: }
1361: }
1362:
1363:
1367: private static class InternalFrameMaximizeIcon implements Icon, Serializable
1368: {
1369:
1370:
1373: public InternalFrameMaximizeIcon()
1374: {
1375:
1376: }
1377:
1378:
1383: public int getIconWidth()
1384: {
1385: return 16;
1386: }
1387:
1388:
1393: public int getIconHeight()
1394: {
1395: return 16;
1396: }
1397:
1398:
1406: public void paintIcon(Component c, Graphics g, int x, int y)
1407: {
1408: Color savedColor = g.getColor();
1409:
1410: AbstractButton b = (AbstractButton) c;
1411:
1412:
1413: if (b.getModel().isPressed())
1414: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1415: else
1416: g.setColor(MetalLookAndFeel.getPrimaryControl());
1417: g.fillRect(x + 2, y + 6, 7, 7);
1418:
1419: if (b.getModel().isPressed())
1420: g.setColor(MetalLookAndFeel.getBlack());
1421: else
1422: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1423:
1424: g.drawLine(x + 9, y + 1, x + 10, y + 1);
1425: g.fillRect(x + 11, y + 1, 3, 3);
1426: g.fillRect(x + 12, y + 4, 2, 2);
1427: g.drawLine(x + 10, y + 3, x + 10, y + 3);
1428: g.drawLine(x + 9, y + 4, x + 10, y + 4);
1429: g.drawLine(x + 1, y + 5, x + 9, y + 5);
1430: g.drawLine(x + 1, y + 6, x + 1, y + 12);
1431: g.drawLine(x + 9, y + 6, x + 9, y + 12);
1432: g.drawLine(x + 1, y + 13, x + 9, y + 13);
1433:
1434:
1435: g.drawLine(x + 7, y + 6, x + 8, y + 6);
1436: g.drawLine(x + 6, y + 7, x + 8, y + 7);
1437: g.drawLine(x + 5, y + 8, x + 6, y + 8);
1438: g.drawLine(x + 4, y + 9, x + 5, y + 9);
1439: g.drawLine(x + 3, y + 10, x + 4, y + 10);
1440: g.drawLine(x + 2, y + 11, x + 3, y + 11);
1441: g.drawLine(x + 2, y + 12, x + 4, y + 12);
1442: g.drawLine(x + 8, y + 8, x + 8, y + 8);
1443:
1444:
1445: g.setColor(MetalLookAndFeel.getBlack());
1446: g.drawLine(x + 8, y, x + 13, y);
1447: g.drawLine(x + 8, y + 1, x + 8, y + 1);
1448: g.drawLine(x + 10, y + 2, x + 9, y + 3);
1449: g.drawLine(x, y + 4, x + 8, y + 4);
1450: g.drawLine(x, y + 5, x, y + 13);
1451:
1452: g.drawLine(x + 2, y + 10, x + 6, y + 6);
1453: g.drawLine(x + 8, y + 9, x + 8, y + 11);
1454: g.drawLine(x + 5, y + 12, x + 8, y + 12);
1455:
1456:
1457: g.setColor(MetalLookAndFeel.getWhite());
1458: if (!b.getModel().isPressed())
1459: {
1460: g.drawLine(x + 2, y + 6, x + 5, y + 6);
1461: g.drawLine(x + 2, y + 7, x + 2, y + 9);
1462: g.drawLine(x + 4, y + 11, x + 7, y + 8);
1463: }
1464:
1465: g.drawLine(x + 1, y + 14, x + 10, y + 14);
1466: g.drawLine(x + 10, y + 5, x + 10, y + 13);
1467:
1468: g.drawLine(x + 9, y + 2, x + 9, y + 2);
1469: g.drawLine(x + 11, y + 4, x + 11, y + 5);
1470: g.drawLine(x + 13, y + 6, x + 14, y + 6);
1471: g.drawLine(x + 14, y + 1, x + 14, y + 5);
1472: g.setColor(savedColor);
1473: }
1474: }
1475:
1476:
1479: private static class InternalFrameMinimizeIcon implements Icon, Serializable
1480: {
1481:
1482:
1485: public InternalFrameMinimizeIcon()
1486: {
1487:
1488: }
1489:
1490:
1495: public int getIconWidth()
1496: {
1497: return 16;
1498: }
1499:
1500:
1505: public int getIconHeight()
1506: {
1507: return 16;
1508: }
1509:
1510:
1518: public void paintIcon(Component c, Graphics g, int x, int y)
1519: {
1520: Color savedColor = g.getColor();
1521:
1522: AbstractButton b = (AbstractButton) c;
1523:
1524: if (b.getModel().isPressed())
1525: g.setColor(MetalLookAndFeel.getBlack());
1526: else
1527:
1528:
1529: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1530:
1531: g.drawLine(x + 12, y + 1, x + 13, y + 1);
1532: g.drawLine(x + 11, y + 2, x + 12, y + 2);
1533: g.drawLine(x + 10, y + 3, x + 11, y + 3);
1534: g.drawLine(x + 8, y + 2, x + 8, y + 3);
1535: g.fillRect(x + 8, y + 4, 3, 3);
1536: g.drawLine(x + 11, y + 6, x + 12, y + 6);
1537:
1538: g.drawLine(x + 1, y + 8, x + 6, y + 8);
1539: g.drawLine(x + 1, y + 9, x + 1, y + 12);
1540: g.drawLine(x + 6, y + 9, x + 6, y + 12);
1541: g.drawLine(x + 1, y + 13, x + 6, y + 13);
1542:
1543: g.drawLine(x + 5, y + 9, x + 5, y + 9);
1544: g.drawLine(x + 2, y + 12, x + 2, y + 12);
1545:
1546: g.setColor(MetalLookAndFeel.getBlack());
1547: g.drawLine(x + 12, y, x + 9, y + 3);
1548: g.drawLine(x + 7, y + 1, x + 8, y + 1);
1549: g.drawLine(x + 7, y + 2, x + 7, y + 6);
1550: g.drawLine(x, y + 7, x + 6, y + 7);
1551: g.drawLine(x, y + 8, x, y + 13);
1552: g.drawLine(x + 3, y + 12, x + 5, y + 12);
1553: g.drawLine(x + 5, y + 10, x + 5, y + 11);
1554: g.drawLine(x + 11, y + 5, x + 12, y + 5);
1555:
1556: g.setColor(MetalLookAndFeel.getWhite());
1557: g.drawLine(x + 9, y + 2, x + 9, y + 2);
1558: g.drawLine(x + 11, y + 4, x + 13, y + 2);
1559: g.drawLine(x + 13, y + 6, x + 13, y + 6);
1560: g.drawLine(x + 8, y + 7, x + 13, y + 7);
1561: g.drawLine(x + 7, y + 9, x + 7, y + 13);
1562: g.drawLine(x + 1, y + 14, x + 7, y + 14);
1563:
1564: if (b.getModel().isPressed())
1565: {
1566: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1567: g.fillRect(x + 2, y + 9, 3, 3);
1568: }
1569: else
1570: {
1571: g.drawLine(x + 2, y + 9, x + 4, y + 9);
1572: g.drawLine(x + 2, y + 10, x + 2, y + 11);
1573: }
1574:
1575: g.setColor(savedColor);
1576: }
1577: }
1578:
1579:
1583: private static class VerticalSliderThumbIcon implements Icon, Serializable
1584: {
1585:
1588: public VerticalSliderThumbIcon()
1589: {
1590:
1591: }
1592:
1593:
1598: public int getIconWidth()
1599: {
1600: return 16;
1601: }
1602:
1603:
1608: public int getIconHeight()
1609: {
1610: return 15;
1611: }
1612:
1613:
1623: public void paintIcon(Component c, Graphics g, int x, int y)
1624: {
1625: boolean enabled = false;
1626: boolean focus = false;
1627: if (c != null)
1628: {
1629: enabled = c.isEnabled();
1630: focus = c.hasFocus();
1631: }
1632:
1633:
1634: if (enabled)
1635: g.setColor(MetalLookAndFeel.getBlack());
1636: else
1637: g.setColor(MetalLookAndFeel.getControlDarkShadow());
1638: g.drawLine(x + 1, y, x + 7, y);
1639: g.drawLine(x + 8, y, x + 15, y + 7);
1640: g.drawLine(x + 14, y + 8, x + 8, y + 14);
1641: g.drawLine(x + 8, y + 14, x + 1, y + 14);
1642: g.drawLine(x, y + 13, x, y + 1);
1643:
1644:
1645: if (focus)
1646: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1647: else
1648: g.setColor(MetalLookAndFeel.getControl());
1649: g.fillRect(x + 2, y + 1, 7, 13);
1650: g.drawLine(x + 9, y + 2, x + 9, y + 12);
1651: g.drawLine(x + 10, y + 3, x + 10, y + 11);
1652: g.drawLine(x + 11, y + 4, x + 11, y + 10);
1653: g.drawLine(x + 12, y + 5, x + 12, y + 9);
1654: g.drawLine(x + 13, y + 6, x + 13, y + 8);
1655: g.drawLine(x + 14, y + 7, x + 14, y + 7);
1656:
1657:
1658: if (enabled)
1659: {
1660: if (focus)
1661: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1662: else
1663: g.setColor(MetalLookAndFeel.getBlack());
1664: g.drawLine(x + 3, y + 3, x + 3, y + 3);
1665: g.drawLine(x + 3, y + 7, x + 3, y + 7);
1666: g.drawLine(x + 3, y + 11, x + 3, y + 11);
1667:
1668: g.drawLine(x + 5, y + 5, x + 5, y + 5);
1669: g.drawLine(x + 5, y + 9, x + 5, y + 9);
1670:
1671: g.drawLine(x + 7, y + 3, x + 7, y + 3);
1672: g.drawLine(x + 7, y + 7, x + 7, y + 7);
1673: g.drawLine(x + 7, y + 11, x + 7, y + 11);
1674:
1675:
1676: if (focus)
1677: g.setColor(MetalLookAndFeel.getPrimaryControl());
1678: else
1679: g.setColor(MetalLookAndFeel.getWhite());
1680: g.drawLine(x + 1, y + 1, x + 8, y + 1);
1681: g.drawLine(x + 1, y + 2, x + 1, y + 13);
1682: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1683: g.drawLine(x + 2, y + 6, x + 2, y + 6);
1684: g.drawLine(x + 2, y + 10, x + 2, y + 10);
1685:
1686: g.drawLine(x + 4, y + 4, x + 4, y + 4);
1687: g.drawLine(x + 4, y + 8, x + 4, y + 8);
1688:
1689: g.drawLine(x + 6, y + 2, x + 6, y + 2);
1690: g.drawLine(x + 6, y + 6, x + 6, y + 6);
1691: g.drawLine(x + 6, y + 10, x + 6, y + 10);
1692:
1693: }
1694: }
1695: }
1696:
1697:
1701: public static class TreeControlIcon implements Icon, Serializable
1702: {
1703:
1704:
1705: protected boolean isLight;
1706:
1707:
1708: private boolean collapsed;
1709:
1710:
1716: public TreeControlIcon(boolean isCollapsed)
1717: {
1718: collapsed = isCollapsed;
1719: }
1720:
1721:
1726: public int getIconWidth()
1727: {
1728: return 18;
1729: }
1730:
1735: public int getIconHeight()
1736: {
1737: return 18;
1738: }
1739:
1740:
1748: public void paintIcon(Component c, Graphics g, int x, int y)
1749: {
1750: x = x + 5;
1751: y = y + 5;
1752: if (collapsed)
1753: {
1754:
1755: g.setColor(Color.black);
1756: g.drawLine(x + 2, y, x + 5, y);
1757: g.drawLine(x + 6, y + 1, x + 7, y + 2);
1758: g.fillRect(x + 7, y + 3, 5, 2);
1759: g.drawLine(x + 7, y + 5, x + 6, y + 6);
1760: g.drawLine(x + 1, y + 1, x + 1, y + 1);
1761: g.drawLine(x, y + 2, x, y + 5);
1762: g.drawLine(x + 1, y + 6, x + 1, y + 6);
1763: g.drawLine(x + 2, y + 7, x + 5, y + 7);
1764: g.fillRect(x + 3, y + 3, 2, 2);
1765:
1766: g.setColor(new Color(204, 204, 255));
1767: g.drawLine(x + 3, y + 2, x + 4, y + 2);
1768: g.drawLine(x + 2, y + 3, x + 2, y + 4);
1769: g.drawLine(x + 3, y + 5, x + 3, y + 5);
1770: g.drawLine(x + 5, y + 3, x + 5, y + 3);
1771:
1772: g.setColor(new Color(153, 153, 204));
1773: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1774: g.drawLine(x + 2, y + 5, x + 2, y + 5);
1775: g.drawLine(x + 2, y + 6, x + 5, y + 6);
1776: g.drawLine(x + 5, y + 2, x + 5, y + 2);
1777: g.drawLine(x + 6, y + 2, x + 6, y + 5);
1778:
1779: g.setColor(new Color(102, 102, 153));
1780: g.drawLine(x + 2, y + 1, x + 5, y + 1);
1781: g.drawLine(x + 1, y + 2, x + 1, y + 5);
1782: }
1783: else
1784: {
1785:
1786: g.setColor(Color.black);
1787: g.drawLine(x + 2, y, x + 5, y);
1788: g.drawLine(x + 6, y + 1, x + 7, y + 2);
1789: g.drawLine(x + 7, y + 2, x + 7, y + 5);
1790: g.fillRect(x + 3, y + 7, 2, 5);
1791: g.drawLine(x + 7, y + 5, x + 6, y + 6);
1792: g.drawLine(x + 1, y + 1, x + 1, y + 1);
1793: g.drawLine(x, y + 2, x, y + 5);
1794: g.drawLine(x + 1, y + 6, x + 1, y + 6);
1795: g.drawLine(x + 2, y + 7, x + 5, y + 7);
1796: g.fillRect(x + 3, y + 3, 2, 2);
1797:
1798: g.setColor(new Color(204, 204, 255));
1799: g.drawLine(x + 3, y + 2, x + 4, y + 2);
1800: g.drawLine(x + 2, y + 3, x + 2, y + 4);
1801: g.drawLine(x + 3, y + 5, x + 3, y + 5);
1802: g.drawLine(x + 5, y + 3, x + 5, y + 3);
1803:
1804: g.setColor(new Color(153, 153, 204));
1805: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1806: g.drawLine(x + 2, y + 5, x + 2, y + 5);
1807: g.drawLine(x + 2, y + 6, x + 5, y + 6);
1808: g.drawLine(x + 5, y + 2, x + 5, y + 2);
1809: g.drawLine(x + 6, y + 2, x + 6, y + 5);
1810:
1811: g.setColor(new Color(102, 102, 153));
1812: g.drawLine(x + 2, y + 1, x + 5, y + 1);
1813: g.drawLine(x + 1, y + 2, x + 1, y + 5);
1814: }
1815: }
1816:
1817:
1825: public void paintMe(Component c, Graphics g, int x, int y)
1826: {
1827: paintIcon(c, g, x, y);
1828: }
1829: }
1830:
1831:
1834: public static class TreeFolderIcon extends FolderIcon16
1835: {
1836:
1839: public TreeFolderIcon()
1840: {
1841:
1842: }
1843:
1844:
1850: public int getAdditionalHeight()
1851: {
1852: return 2;
1853: }
1854:
1855:
1860: public int getShift()
1861: {
1862: return -1;
1863: }
1864: }
1865:
1866:
1869: public static class TreeLeafIcon extends FileIcon16
1870: {
1871:
1874: public TreeLeafIcon()
1875: {
1876:
1877: }
1878:
1879:
1885: public int getAdditionalHeight()
1886: {
1887: return 4;
1888: }
1889:
1890:
1895: public int getShift()
1896: {
1897: return 2;
1898: }
1899: }
1900:
1901:
1906: private static class TreeHardDriveIcon implements Icon, Serializable
1907: {
1908:
1909:
1912: public TreeHardDriveIcon()
1913: {
1914:
1915: }
1916:
1917:
1922: public int getIconWidth()
1923: {
1924: return 16;
1925: }
1926:
1927:
1932: public int getIconHeight()
1933: {
1934: return 16;
1935: }
1936:
1937:
1946: public void paintIcon(Component c, Graphics g, int x, int y)
1947: {
1948: Color saved = g.getColor();
1949: g.setColor(MetalLookAndFeel.getBlack());
1950: g.drawLine(x + 1, y + 4, x + 1, y + 5);
1951: g.drawLine(x + 14, y + 4, x + 14, y + 5);
1952: g.drawLine(x + 1, y + 7, x + 1, y + 8);
1953: g.drawLine(x + 14, y + 7, x + 14, y + 8);
1954: g.drawLine(x + 1, y + 10, x + 1, y + 11);
1955: g.drawLine(x + 14, y + 10, x + 14, y + 11);
1956:
1957: g.drawLine(x + 2, y + 3, x + 3, y + 3);
1958: g.drawLine(x + 12, y + 3, x + 13, y + 3);
1959: g.drawLine(x + 2, y + 6, x + 3, y + 6);
1960: g.drawLine(x + 12, y + 6, x + 13, y + 6);
1961: g.drawLine(x + 2, y + 9, x + 3, y + 9);
1962: g.drawLine(x + 12, y + 9, x + 13, y + 9);
1963: g.drawLine(x + 2, y + 12, x + 3, y + 12);
1964: g.drawLine(x + 12, y + 12, x + 13, y + 12);
1965:
1966: g.drawLine(x + 4, y + 2, x + 11, y + 2);
1967: g.drawLine(x + 4, y + 7, x + 11, y + 7);
1968: g.drawLine(x + 4, y + 10, x + 11, y + 10);
1969: g.drawLine(x + 4, y + 13, x + 11, y + 13);
1970:
1971: g.setColor(MetalLookAndFeel.getWhite());
1972: g.fillRect(x + 4, y + 3, 2, 2);
1973: g.drawLine(x + 6, y + 4, x + 6, y + 4);
1974: g.drawLine(x + 7, y + 3, x + 9, y + 3);
1975: g.drawLine(x + 8, y + 4, x + 8, y + 4);
1976: g.drawLine(x + 11, y + 3, x + 11, y + 3);
1977: g.fillRect(x + 2, y + 4, 2, 2);
1978: g.fillRect(x + 2, y + 7, 2, 2);
1979: g.fillRect(x + 2, y + 10, 2, 2);
1980: g.drawLine(x + 4, y + 6, x + 4, y + 6);
1981: g.drawLine(x + 4, y + 9, x + 4, y + 9);
1982: g.drawLine(x + 4, y + 12, x + 4, y + 12);
1983:
1984: g.setColor(MetalLookAndFeel.getControlShadow());
1985: g.drawLine(x + 13, y + 4, x + 13, y + 4);
1986: g.drawLine(x + 12, y + 5, x + 13, y + 5);
1987: g.drawLine(x + 13, y + 7, x + 13, y + 7);
1988: g.drawLine(x + 12, y + 8, x + 13, y + 8);
1989: g.drawLine(x + 13, y + 10, x + 13, y + 10);
1990: g.drawLine(x + 12, y + 11, x + 13, y + 11);
1991:
1992: g.drawLine(x + 10, y + 5, x + 10, y + 5);
1993: g.drawLine(x + 7, y + 6, x + 7, y + 6);
1994: g.drawLine(x + 9, y + 6, x + 9, y + 6);
1995: g.drawLine(x + 11, y + 6, x + 11, y + 6);
1996:
1997: g.drawLine(x + 10, y + 8, x + 10, y + 8);
1998: g.drawLine(x + 7, y + 9, x + 7, y + 9);
1999: g.drawLine(x + 9, y + 9, x + 9, y + 9);
2000: g.drawLine(x + 11, y + 9, x + 11, y + 9);
2001:
2002: g.drawLine(x + 10, y + 11, x + 10, y + 11);
2003: g.drawLine(x + 7, y + 12, x + 7, y + 12);
2004: g.drawLine(x + 9, y + 12, x + 9, y + 12);
2005: g.drawLine(x + 11, y + 12, x + 11, y + 12);
2006:
2007: g.setColor(saved);
2008: }
2009: }
2010:
2011:
2016: private static class TreeFloppyDriveIcon implements Icon, Serializable
2017: {
2018:
2019:
2022: public TreeFloppyDriveIcon()
2023: {
2024:
2025: }
2026:
2027:
2032: public int getIconWidth()
2033: {
2034: return 16;
2035: }
2036:
2037:
2042: public int getIconHeight()
2043: {
2044: return 16;
2045: }
2046:
2047:
2056: public void paintIcon(Component c, Graphics g, int x, int y)
2057: {
2058: Color saved = g.getColor();
2059:
2060: g.setColor(MetalLookAndFeel.getBlack());
2061: g.drawLine(x + 1, y + 1, x + 13, y + 1);
2062: g.drawLine(x + 1, y + 1, x + 1, y + 14);
2063: g.drawLine(x + 1, y + 14, x + 14, y + 14);
2064: g.drawLine(x + 14, y + 2, x + 14, y + 14);
2065:
2066: g.setColor(MetalLookAndFeel.getPrimaryControl());
2067: g.fillRect(x + 2, y + 2, 12, 12);
2068:
2069: g.setColor(MetalLookAndFeel.getControlShadow());
2070: g.fillRect(x + 5, y + 2, 6, 5);
2071: g.drawLine(x + 4, y + 8, x + 11, y + 8);
2072: g.drawLine(x + 3, y + 9, x + 3, y + 13);
2073: g.drawLine(x + 12, y + 9, x + 12, y + 13);
2074:
2075: g.setColor(MetalLookAndFeel.getWhite());
2076: g.fillRect(x + 8, y + 3, 2, 3);
2077: g.fillRect(x + 4, y + 9, 8, 5);
2078:
2079: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
2080: g.drawLine(x + 5, y + 10, x + 9, y + 10);
2081: g.drawLine(x + 5, y + 12, x + 8, y + 12);
2082:
2083: g.setColor(saved);
2084: }
2085: }
2086:
2087:
2092: private static class TreeComputerIcon implements Icon, Serializable
2093: {
2094:
2095:
2098: public TreeComputerIcon()
2099: {
2100:
2101: }
2102:
2103:
2108: public int getIconWidth()
2109: {
2110: return 16;
2111: }
2112:
2113:
2118: public int getIconHeight()
2119: {
2120: return 16;
2121: }
2122:
2123:
2132: public void paintIcon(Component c, Graphics g, int x, int y)
2133: {
2134: Color saved = g.getColor();
2135:
2136: g.setColor(MetalLookAndFeel.getBlack());
2137: g.drawLine(x + 3, y + 1, x + 12, y + 1);
2138: g.drawLine(x + 2, y + 2, x + 2, y + 8);
2139: g.drawLine(x + 13, y + 2, x + 13, y + 8);
2140: g.drawLine(x + 3, y + 9, x + 3, y + 9);
2141: g.drawLine(x + 12, y + 9, x + 12, y + 9);
2142: g.drawRect(x + 1, y + 10, 13, 4);
2143: g.drawLine(x + 5, y + 3, x + 10, y + 3);
2144: g.drawLine(x + 5, y + 8, x + 10, y + 8);
2145: g.drawLine(x + 4, y + 4, x + 4, y + 7);
2146: g.drawLine(x + 11, y + 4, x + 11, y + 7);
2147:
2148: g.setColor(MetalLookAndFeel.getPrimaryControl());
2149: g.fillRect(x + 5, y + 4, 6, 4);
2150:
2151: g.setColor(MetalLookAndFeel.getControlShadow());
2152: g.drawLine(x + 6, y + 12, x + 8, y + 12);
2153: g.drawLine(x + 10, y + 12, x + 12, y + 12);
2154: g.setColor(saved);
2155: }
2156: }
2157:
2158:
2159: private static Icon checkBoxIcon;
2160:
2161:
2162: private static Icon checkBoxMenuItemIcon;
2163:
2164:
2165: private static Icon fileChooserDetailViewIcon;
2166:
2167:
2168: private static Icon fileChooserHomeFolderIcon;
2169:
2170:
2171: private static Icon fileChooserListViewIcon;
2172:
2173:
2174: private static Icon fileChooserNewFolderIcon;
2175:
2176:
2177: private static Icon fileChooserUpFolderIcon;
2178:
2179:
2180: private static RadioButtonIcon radioButtonIcon;
2181:
2182:
2183: private static Icon radioButtonMenuItemIcon;
2184:
2185:
2186: private static Icon internalFrameDefaultMenuIcon;
2187:
2188:
2189: private static Icon treeComputerIcon;
2190:
2191:
2192: private static Icon treeFloppyDriveIcon;
2193:
2194:
2195: private static Icon treeHardDriveIcon;
2196:
2197:
2201: public MetalIconFactory()
2202: {
2203:
2204: }
2205:
2206:
2213: public static Icon getCheckBoxIcon()
2214: {
2215: if (checkBoxIcon == null)
2216: checkBoxIcon = new MetalCheckBoxIcon();
2217: return checkBoxIcon;
2218: }
2219:
2220:
2226: public static Icon getCheckBoxMenuItemIcon()
2227: {
2228: if (checkBoxMenuItemIcon == null)
2229: checkBoxMenuItemIcon = new CheckBoxMenuItemIcon();
2230: return checkBoxMenuItemIcon;
2231: }
2232:
2233:
2238: public static Icon getFileChooserDetailViewIcon()
2239: {
2240: if (fileChooserDetailViewIcon == null)
2241: fileChooserDetailViewIcon = new FileChooserDetailViewIcon();
2242: return fileChooserDetailViewIcon;
2243: }
2244:
2245:
2250: public static Icon getFileChooserHomeFolderIcon()
2251: {
2252: if (fileChooserHomeFolderIcon == null)
2253: fileChooserHomeFolderIcon = new FileChooserHomeFolderIcon();
2254: return fileChooserHomeFolderIcon;
2255: }
2256:
2257:
2262: public static Icon getFileChooserListViewIcon()
2263: {
2264: if (fileChooserListViewIcon == null)
2265: fileChooserListViewIcon = new FileChooserListViewIcon();
2266: return fileChooserListViewIcon;
2267: }
2268:
2269:
2274: public static Icon getFileChooserNewFolderIcon()
2275: {
2276: if (fileChooserNewFolderIcon == null)
2277: fileChooserNewFolderIcon = new FileChooserNewFolderIcon();
2278: return fileChooserNewFolderIcon;
2279: }
2280:
2281:
2286: public static Icon getFileChooserUpFolderIcon()
2287: {
2288: if (fileChooserUpFolderIcon == null)
2289: fileChooserUpFolderIcon = new FileChooserUpFolderIcon();
2290: return fileChooserUpFolderIcon;
2291: }
2292:
2293:
2298: public static Icon getRadioButtonIcon()
2299: {
2300: if (radioButtonIcon == null)
2301: radioButtonIcon = new RadioButtonIcon();
2302: return radioButtonIcon;
2303: }
2304:
2305:
2310: public static Icon getRadioButtonMenuItemIcon()
2311: {
2312: if (radioButtonMenuItemIcon == null)
2313: radioButtonMenuItemIcon = new RadioButtonMenuItemIcon();
2314: return radioButtonMenuItemIcon;
2315: }
2316:
2317:
2323: public static Icon getHorizontalSliderThumbIcon()
2324: {
2325: return new HorizontalSliderThumbIcon();
2326: }
2327:
2328:
2336: public static Icon getInternalFrameCloseIcon(int size)
2337: {
2338: return new InternalFrameCloseIcon(size);
2339: }
2340:
2341:
2347: public static Icon getInternalFrameDefaultMenuIcon()
2348: {
2349: if (internalFrameDefaultMenuIcon == null)
2350: internalFrameDefaultMenuIcon = new InternalFrameDefaultMenuIcon();
2351: return internalFrameDefaultMenuIcon;
2352: }
2353:
2354:
2363: public static Icon getInternalFrameMaximizeIcon(int size)
2364: {
2365: return new InternalFrameMaximizeIcon();
2366: }
2367:
2368:
2376: public static Icon getInternalFrameMinimizeIcon(int size)
2377: {
2378: return new InternalFrameMinimizeIcon();
2379: }
2380:
2381:
2391: public static Icon getInternalFrameAltMaximizeIcon(int size)
2392: {
2393: return new InternalFrameAltMaximizeIcon(size);
2394: }
2395:
2396:
2402: public static Icon getVerticalSliderThumbIcon()
2403: {
2404: return new VerticalSliderThumbIcon();
2405: }
2406:
2407:
2412: public static Icon getTreeFolderIcon()
2413: {
2414: return new TreeFolderIcon();
2415: }
2416:
2417:
2422: public static Icon getTreeLeafIcon()
2423: {
2424: return new TreeLeafIcon();
2425: }
2426:
2427:
2435: public static Icon getTreeControlIcon(boolean isCollapsed)
2436: {
2437: return new TreeControlIcon(isCollapsed);
2438: }
2439:
2440:
2445: public static Icon getTreeComputerIcon()
2446: {
2447: if (treeComputerIcon == null)
2448: treeComputerIcon = new TreeComputerIcon();
2449: return treeComputerIcon;
2450: }
2451:
2452:
2457: public static Icon getTreeFloppyDriveIcon()
2458: {
2459: if (treeFloppyDriveIcon == null)
2460: treeFloppyDriveIcon = new TreeFloppyDriveIcon();
2461: return treeFloppyDriveIcon;
2462: }
2463:
2464:
2469: public static Icon getTreeHardDriveIcon()
2470: {
2471: if (treeHardDriveIcon == null)
2472: treeHardDriveIcon = new TreeHardDriveIcon();
2473: return treeHardDriveIcon;
2474: }
2475:
2476:
2483: public static Icon getMenuArrowIcon()
2484: {
2485: if (menuArrow == null)
2486: menuArrow = new Icon()
2487: {
2488: public int getIconHeight()
2489: {
2490: return 8;
2491: }
2492:
2493: public int getIconWidth()
2494: {
2495: return 4;
2496: }
2497:
2498: public void paintIcon(Component c, Graphics g, int x, int y)
2499: {
2500: Color saved = g.getColor();
2501: g.setColor(Color.BLACK);
2502: for (int i = 0; i < 4; i++)
2503: g.drawLine(x + i, y + i, x + i, y + 7 - i);
2504: g.setColor(saved);
2505: }
2506: };
2507: return menuArrow;
2508: }
2509:
2510:
2516: public static Icon getMenuItemArrowIcon()
2517: {
2518: if (menuItemArrow == null)
2519: menuItemArrow = new Icon()
2520: {
2521: public int getIconHeight()
2522: {
2523: return 8;
2524: }
2525:
2526: public int getIconWidth()
2527: {
2528: return 4;
2529: }
2530:
2531: public void paintIcon(Component c, Graphics g, int x, int y)
2532: {
2533: Color saved = g.getColor();
2534: g.setColor(Color.BLACK);
2535: for (int i = 0; i < 4; i++)
2536: g.drawLine(x + i, y + i, x + i, y + 7 - i);
2537: g.setColor(saved);
2538: }
2539: };
2540: return menuItemArrow;
2541: }
2542:
2543:
2548: public static Icon getMenuItemCheckIcon()
2549: {
2550: return new Icon()
2551: {
2552: public int getIconHeight()
2553: {
2554: return 13;
2555: }
2556:
2557: public int getIconWidth()
2558: {
2559: return 13;
2560: }
2561:
2562: public void paintIcon(Component c, Graphics g, int x, int y)
2563: {
2564: Color saved = g.getColor();
2565: g.setColor(Color.BLACK);
2566: g.drawLine(3 + x, 5 + y, 3 + x, 9 + y);
2567: g.drawLine(4 + x, 5 + y, 4 + x, 9 + y);
2568: g.drawLine(5 + x, 7 + y, 9 + x, 3 + y);
2569: g.drawLine(5 + x, 8 + y, 9 + x, 4 + y);
2570: g.setColor(saved);
2571: }
2572: };
2573: }
2574: }