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:
764: private static int[][] gradientMask = new int[][] {{3, 7}, {1, 9}, {1, 9},
765: {0, 10}, {0, 10}, {0, 10},
766: {0, 10}, {1, 9}, {1, 9},
767: {3, 7}};
768:
769:
774: public int getIconWidth()
775: {
776: return 13;
777: }
778:
779:
784: public int getIconHeight()
785: {
786: return 13;
787: }
788:
789:
799: public void paintIcon(Component c, Graphics g, int x, int y)
800: {
801: if (UIManager.get("RadioButton.gradient") != null)
802: MetalUtils.paintGradient(g, x + 2, y + 2, 8, 8,
803: SwingConstants.VERTICAL, "RadioButton.gradient",
804: gradientMask);
805:
806: Color savedColor = g.getColor();
807: JRadioButton b = (JRadioButton) c;
808:
809:
810: if (b.isEnabled())
811: g.setColor(MetalLookAndFeel.getControlDarkShadow());
812: else
813: g.setColor(MetalLookAndFeel.getControlDisabled());
814: g.drawLine(x + 2, y + 1, x + 3, y + 1);
815: g.drawLine(x + 4, y, x + 7, y);
816: g.drawLine(x + 8, y + 1, x + 9, y + 1);
817: g.drawLine(x + 10, y + 2, x + 10, y + 3);
818: g.drawLine(x + 11, y + 4, x + 11, y + 7);
819: g.drawLine(x + 10, y + 8, x + 10, y + 9);
820: g.drawLine(x + 8, y + 10, x + 9, y + 10);
821: g.drawLine(x + 4, y + 11, x + 7, y + 11);
822: g.drawLine(x + 2, y + 10, x + 3, y + 10);
823: g.drawLine(x + 1, y + 9, x + 1, y + 8);
824: g.drawLine(x, y + 7, x, y + 4);
825: g.drawLine(x + 1, y + 2, x + 1, y + 3);
826:
827: if (b.getModel().isArmed())
828: {
829: g.setColor(MetalLookAndFeel.getControlShadow());
830: g.drawLine(x + 4, y + 1, x + 7, y + 1);
831: g.drawLine(x + 4, y + 10, x + 7, y + 10);
832: g.drawLine(x + 1, y + 4, x + 1, y + 7);
833: g.drawLine(x + 10, y + 4, x + 10, y + 7);
834: g.fillRect(x + 2, y + 2, 8, 8);
835: }
836: else
837: {
838:
839: if (b.isEnabled())
840: {
841: g.setColor(MetalLookAndFeel.getWhite());
842:
843: g.drawLine(x + 2, y + 8, x + 2, y + 9);
844: g.drawLine(x + 1, y + 4, x + 1, y + 7);
845: g.drawLine(x + 2, y + 2, x + 2, y + 3);
846: g.drawLine(x + 3, y + 2, x + 3, y + 2);
847: g.drawLine(x + 4, y + 1, x + 7, y + 1);
848: g.drawLine(x + 8, y + 2, x + 9, y + 2);
849: }
850: }
851:
852:
853: if (b.isEnabled())
854: {
855: g.setColor(MetalLookAndFeel.getWhite());
856:
857:
858: g.drawLine(x + 10, y + 1, x + 10, y + 1);
859: g.drawLine(x + 11, y + 2, x + 11, y + 3);
860: g.drawLine(x + 12, y + 4, x + 12, y + 7);
861: g.drawLine(x + 11, y + 8, x + 11, y + 9);
862: g.drawLine(x + 10, y + 10, x + 10, y + 10);
863: g.drawLine(x + 8, y + 11, x + 9, y + 11);
864: g.drawLine(x + 4, y + 12, x + 7, y + 12);
865: g.drawLine(x + 2, y + 11, x + 3, y + 11);
866: }
867:
868: if (b.isSelected())
869: {
870: if (b.isEnabled())
871: g.setColor(MetalLookAndFeel.getBlack());
872: else
873: g.setColor(MetalLookAndFeel.getControlDisabled());
874: g.drawLine(x + 4, y + 3, x + 7, y + 3);
875: g.fillRect(x + 3, y + 4, 6, 4);
876: g.drawLine(x + 4, y + 8, x + 7, y + 8);
877: }
878: g.setColor(savedColor);
879: }
880: }
881:
882:
885: private static class RadioButtonMenuItemIcon implements Icon, Serializable
886: {
887:
890: public RadioButtonMenuItemIcon()
891: {
892:
893: }
894:
895:
900: public int getIconWidth()
901: {
902: return 10;
903: }
904:
905:
910: public int getIconHeight()
911: {
912: return 10;
913: }
914:
915:
923: public void paintIcon(Component c, Graphics g, int x, int y)
924: {
925: Color savedColor = g.getColor();
926: JRadioButtonMenuItem item = (JRadioButtonMenuItem) c;
927: g.setColor(MetalLookAndFeel.getBlack());
928: g.drawLine(x + 2, y, x + 6, y);
929: g.drawLine(x + 7, y + 1, x + 7, y + 1);
930: g.drawLine(x + 8, y + 2, x + 8, y + 6);
931: g.drawLine(x + 7, y + 7, x + 7, y + 7);
932: g.drawLine(x + 2, y + 8, x + 6, y + 8);
933: g.drawLine(x + 1, y + 7, x + 1, y + 7);
934: g.drawLine(x, y + 2, x, y + 6);
935: g.drawLine(x + 1, y + 1, x + 1, y + 1);
936:
937: if (item.isSelected())
938: {
939: g.drawLine(x + 3, y + 2, x + 5, y + 2);
940: g.fillRect(x + 2, y + 3, 5, 3);
941: g.drawLine(x + 3, y + 6, x + 5, y + 6);
942: }
943:
944:
945: g.setColor(MetalLookAndFeel.getControlHighlight());
946: g.drawLine(x + 3, y + 1, x + 6, y + 1);
947: g.drawLine(x + 8, y + 1, x + 8, y + 1);
948: g.drawLine(x + 9, y + 2, x + 9, y + 7);
949: g.drawLine(x + 8, y + 8, x + 8, y + 8);
950: g.drawLine(x + 2, y + 9, x + 7, y + 9);
951: g.drawLine(x + 1, y + 8, x + 1, y + 8);
952: g.drawLine(x + 1, y + 3, x + 1, y + 6);
953: g.drawLine(x + 2, y + 2, x + 2, y + 2);
954: g.setColor(savedColor);
955: }
956: }
957:
958:
962: private static class HorizontalSliderThumbIcon implements Icon, Serializable
963: {
964:
965:
968: int[][] gradientMask = new int[][] { {0, 12}, {0, 12}, {0, 12}, {0, 12},
969: {0, 12}, {0, 12}, {0, 12}, {1, 12},
970: {2, 10}, {3, 9}, {4, 8}, {5, 7},
971: {6, 6}};
972:
973:
976: public HorizontalSliderThumbIcon()
977: {
978:
979: }
980:
981:
986: public int getIconWidth()
987: {
988: return 15;
989: }
990:
991:
996: public int getIconHeight()
997: {
998: return 16;
999: }
1000:
1001:
1010: public void paintIcon(Component c, Graphics g, int x, int y)
1011: {
1012: boolean enabled = false;
1013: boolean focus = false;
1014: if (c != null)
1015: {
1016: enabled = c.isEnabled();
1017: focus = c.hasFocus();
1018: }
1019:
1020:
1021: if (enabled)
1022: g.setColor(MetalLookAndFeel.getBlack());
1023: else
1024: g.setColor(MetalLookAndFeel.getControlDarkShadow());
1025: g.drawLine(x + 1, y, x + 13, y);
1026: g.drawLine(x + 14, y + 1, x + 14, y + 7);
1027: g.drawLine(x + 14, y + 8, x + 7, y + 15);
1028: g.drawLine(x + 6, y + 14, x, y + 8);
1029: g.drawLine(x, y + 7, x, y + 1);
1030:
1031:
1032: if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme
1033: && enabled)
1034: {
1035: String gradient;
1036: if (focus)
1037: gradient = "Slider.focusGradient";
1038: else
1039: gradient = "Slider.gradient";
1040: MetalUtils.paintGradient(g, x + 1, y + 2, 12, 13,
1041: SwingConstants.VERTICAL, gradient,
1042: gradientMask);
1043: }
1044: else
1045: {
1046: if (focus)
1047: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1048: else
1049: g.setColor(MetalLookAndFeel.getControl());
1050: g.fillRect(x + 1, y + 2, 13, 7);
1051: g.drawLine(x + 2, y + 9, x + 12, y + 9);
1052: g.drawLine(x + 3, y + 10, x + 11, y + 10);
1053: g.drawLine(x + 4, y + 11, x + 10, y + 11);
1054: g.drawLine(x + 5, y + 12, x + 9, y + 12);
1055: g.drawLine(x + 6, y + 13, x + 8, y + 13);
1056: g.drawLine(x + 7, y + 14, x + 7, y + 14);
1057: }
1058:
1059:
1060: if (c.isEnabled()
1061: && !(MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme))
1062: {
1063: if (focus)
1064: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1065: else
1066: g.setColor(MetalLookAndFeel.getBlack());
1067: g.drawLine(x + 3, y + 3, x + 3, y + 3);
1068: g.drawLine(x + 7, y + 3, x + 7, y + 3);
1069: g.drawLine(x + 11, y + 3, x + 11, y + 3);
1070:
1071: g.drawLine(x + 5, y + 5, x + 5, y + 5);
1072: g.drawLine(x + 9, y + 5, x + 9, y + 5);
1073:
1074: g.drawLine(x + 3, y + 7, x + 3, y + 7);
1075: g.drawLine(x + 7, y + 7, x + 7, y + 7);
1076: g.drawLine(x + 11, y + 7, x + 11, y + 7);
1077:
1078:
1079: if (focus)
1080: g.setColor(MetalLookAndFeel.getPrimaryControl());
1081: else
1082: g.setColor(MetalLookAndFeel.getWhite());
1083: g.drawLine(x + 1, y + 1, x + 13, y + 1);
1084: g.drawLine(x + 1, y + 2, x + 1, y + 8);
1085: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1086: g.drawLine(x + 6, y + 2, x + 6, y + 2);
1087: g.drawLine(x + 10, y + 2, x + 10, y + 2);
1088:
1089: g.drawLine(x + 4, y + 4, x + 4, y + 4);
1090: g.drawLine(x + 8, y + 4, x + 8, y + 4);
1091:
1092: g.drawLine(x + 2, y + 6, x + 2, y + 6);
1093: g.drawLine(x + 6, y + 6, x + 6, y + 6);
1094: g.drawLine(x + 10, y + 6, x + 10, y + 6);
1095: }
1096:
1097: }
1098: }
1099:
1100:
1104: private static class InternalFrameCloseIcon implements Icon, Serializable
1105: {
1106:
1107: private int size;
1108:
1109:
1114: public InternalFrameCloseIcon(int size)
1115: {
1116: this.size = size;
1117: }
1118:
1119:
1124: public int getIconWidth()
1125: {
1126: return size;
1127: }
1128:
1129:
1134: public int getIconHeight()
1135: {
1136: return size;
1137: }
1138:
1139:
1147: public void paintIcon(Component c, Graphics g, int x, int y)
1148: {
1149: Color savedColor = g.getColor();
1150: AbstractButton b = (AbstractButton) c;
1151:
1152:
1153: if (b.getModel().isPressed())
1154:
1155:
1156: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1157: else
1158: g.setColor(MetalLookAndFeel.getPrimaryControl());
1159: g.fillRect(x + 2, y + 2, 10, 10);
1160:
1161:
1162: if (b.getModel().isPressed())
1163: g.setColor(MetalLookAndFeel.getBlack());
1164: else
1165: {
1166:
1167:
1168: boolean selected = true;
1169: if (selected)
1170: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1171: else
1172: g.setColor(MetalLookAndFeel.getControlDarkShadow());
1173: }
1174: g.drawLine(x + 1, y + 1, x + 13, y + 1);
1175: g.drawLine(x + 1, y + 2, x + 1, y + 12);
1176: g.drawLine(x + 1, y + 13, x + 13, y + 13);
1177: g.drawLine(x + 13, y + 2, x + 13, y + 12);
1178: g.drawLine(x + 2, y + 12, x + 2, y + 12);
1179: g.drawLine(x + 12, y + 2, x + 12, y + 2);
1180:
1181: g.fillRect(x + 4, y + 4, 2, 2);
1182: g.fillRect(x + 5, y + 5, 4, 4);
1183: g.drawLine(x + 9, y + 4, x + 10, y + 4);
1184: g.drawLine(x + 9, y + 4, x + 9, y + 5);
1185: g.drawLine(x + 4, y + 9, x + 4, y + 10);
1186: g.drawLine(x + 4, y + 9, x + 5, y + 9);
1187: g.drawLine(x + 9, y + 8, x + 9, y + 10);
1188: g.drawLine(x + 8, y + 9, x + 10, y + 9);
1189:
1190: g.setColor(MetalLookAndFeel.getBlack());
1191: g.drawLine(x, y, x + 13, y);
1192: g.drawLine(x, y + 1, x, y + 13);
1193: g.drawLine(x + 3, y + 4, x + 4, y + 3);
1194: g.drawLine(x + 3, y + 9, x + 5, y + 7);
1195: g.drawLine(x + 7, y + 5, x + 9, y + 3);
1196:
1197: g.drawLine(x + 12, y + 3, x + 12, y + 11);
1198: g.drawLine(x + 3, y + 12, x + 12, y + 12);
1199:
1200: g.setColor(MetalLookAndFeel.getWhite());
1201: g.drawLine(x + 1, y + 14, x + 14, y + 14);
1202: g.drawLine(x + 14, y + 1, x + 14, y + 14);
1203:
1204: if (!b.getModel().isPressed())
1205: {
1206: g.drawLine(x + 5, y + 10, x + 5, y + 10);
1207: g.drawLine(x + 6, y + 9, x + 7, y + 9);
1208: g.drawLine(x + 10, y + 5, x + 10, y + 5);
1209: g.drawLine(x + 9, y + 6, x + 9, y + 7);
1210: g.drawLine(x + 10, y + 10, x + 11, y + 10);
1211: g.drawLine(x + 10, y + 11, x + 10, y + 11);
1212: }
1213: g.setColor(savedColor);
1214: }
1215: }
1216:
1217:
1220: private static class InternalFrameDefaultMenuIcon
1221: implements Icon, Serializable
1222: {
1223:
1224:
1227: public InternalFrameDefaultMenuIcon()
1228: {
1229:
1230: }
1231:
1232:
1237: public int getIconWidth()
1238: {
1239: return 16;
1240: }
1241:
1242:
1247: public int getIconHeight()
1248: {
1249: return 16;
1250: }
1251:
1252:
1260: public void paintIcon(Component c, Graphics g, int x, int y)
1261: {
1262: g.setColor(new Color(102, 102, 153));
1263: g.fillRect(x + 1, y, 14, 2);
1264: g.fillRect(x, y + 1, 2, 14);
1265: g.fillRect(x + 1, y + 14, 14, 2);
1266: g.fillRect(x + 14, y + 1, 2, 14);
1267: g.drawLine(x + 2, y + 5, x + 14, y + 5);
1268:
1269: g.setColor(new Color(204, 204, 255));
1270: g.fillRect(x + 2, y + 2, 12, 3);
1271:
1272: g.setColor(new Color(102, 102, 153));
1273: g.drawLine(x + 3, y + 3, x + 3, y + 3);
1274: g.drawLine(x + 6, y + 3, x + 6, y + 3);
1275: g.drawLine(x + 9, y + 3, x + 9, y + 3);
1276: g.drawLine(x + 12, y + 3, x + 12, y + 3);
1277:
1278: g.setColor(Color.white);
1279: g.fillRect(x + 2, y + 6, 12, 8);
1280: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1281: g.drawLine(x + 5, y + 2, x + 5, y + 2);
1282: g.drawLine(x + 8, y + 2, x + 8, y + 2);
1283: g.drawLine(x + 11, y + 2, x + 11, y + 2);
1284: }
1285: }
1286:
1287:
1292: private static class InternalFrameAltMaximizeIcon
1293: implements Icon, Serializable
1294: {
1295:
1296: private int size;
1297:
1298:
1303: public InternalFrameAltMaximizeIcon(int size)
1304: {
1305: this.size = size;
1306: }
1307:
1308:
1313: public int getIconWidth()
1314: {
1315: return size;
1316: }
1317:
1318:
1323: public int getIconHeight()
1324: {
1325: return size;
1326: }
1327:
1328:
1336: public void paintIcon(Component c, Graphics g, int x, int y)
1337: {
1338: Color savedColor = g.getColor();
1339:
1340: AbstractButton b = (AbstractButton) c;
1341:
1342:
1343: if (b.getModel().isPressed())
1344: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1345: else
1346: g.setColor(MetalLookAndFeel.getPrimaryControl());
1347: g.fillRect(x + 2, y + 6, 7, 7);
1348:
1349:
1350: if (b.getModel().isPressed())
1351: g.setColor(MetalLookAndFeel.getBlack());
1352: else
1353: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1354:
1355: g.drawLine(x + 12, y + 1, x + 13, y + 1);
1356: g.drawLine(x + 11, y + 2, x + 12, y + 2);
1357: g.drawLine(x + 10, y + 3, x + 11, y + 3);
1358: g.drawLine(x + 8, y + 2, x + 8, y + 3);
1359: g.fillRect(x + 8, y + 4, 3, 3);
1360: g.drawLine(x + 11, y + 6, x + 12, y + 6);
1361:
1362: g.drawLine(x + 1, y + 5, x + 5, y + 5);
1363: g.drawLine(x + 1, y + 6, x + 1, y + 12);
1364: g.drawLine(x + 9, y + 9, x + 9, y + 12);
1365: g.drawLine(x + 1, y + 13, x + 9, y + 13);
1366:
1367: g.drawLine(x + 2, y + 12, x + 2, y + 12);
1368:
1369: g.setColor(MetalLookAndFeel.getBlack());
1370: g.drawLine(x + 12, y, x + 9, y + 3);
1371: g.drawLine(x + 7, y + 1, x + 8, y + 1);
1372: g.drawLine(x + 7, y + 2, x + 7, y + 6);
1373: g.drawLine(x + 11, y + 5, x + 12, y + 5);
1374: g.drawLine(x, y + 4, x + 5, y + 4);
1375: g.drawLine(x, y + 5, x, y + 13);
1376: g.drawLine(x + 3, y + 12, x + 8, y + 12);
1377: g.drawLine(x + 8, y + 8, x + 8, y + 11);
1378: g.drawLine(x + 9, y + 8, x + 9, y + 8);
1379:
1380: g.setColor(MetalLookAndFeel.getWhite());
1381: g.drawLine(x + 9, y + 2, x + 9, y + 2);
1382: g.drawLine(x + 11, y + 4, x + 13, y + 2);
1383: g.drawLine(x + 13, y + 6, x + 13, y + 6);
1384: g.drawLine(x + 8, y + 7, x + 13, y + 7);
1385: g.drawLine(x + 6, y + 5, x + 6, y + 5);
1386: g.drawLine(x + 10, y + 8, x + 10, y + 13);
1387: g.drawLine(x + 1, y + 14, x + 10, y + 14);
1388:
1389: if (!b.getModel().isPressed())
1390: {
1391: g.drawLine(x + 2, y + 6, x + 6, y + 6);
1392: g.drawLine(x + 2, y + 6, x + 2, y + 11);
1393: }
1394:
1395: g.setColor(savedColor);
1396: }
1397: }
1398:
1399:
1403: private static class InternalFrameMaximizeIcon implements Icon, Serializable
1404: {
1405:
1406:
1409: public InternalFrameMaximizeIcon()
1410: {
1411:
1412: }
1413:
1414:
1419: public int getIconWidth()
1420: {
1421: return 16;
1422: }
1423:
1424:
1429: public int getIconHeight()
1430: {
1431: return 16;
1432: }
1433:
1434:
1442: public void paintIcon(Component c, Graphics g, int x, int y)
1443: {
1444: Color savedColor = g.getColor();
1445:
1446: AbstractButton b = (AbstractButton) c;
1447:
1448:
1449: if (b.getModel().isPressed())
1450: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1451: else
1452: g.setColor(MetalLookAndFeel.getPrimaryControl());
1453: g.fillRect(x + 2, y + 6, 7, 7);
1454:
1455: if (b.getModel().isPressed())
1456: g.setColor(MetalLookAndFeel.getBlack());
1457: else
1458: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1459:
1460: g.drawLine(x + 9, y + 1, x + 10, y + 1);
1461: g.fillRect(x + 11, y + 1, 3, 3);
1462: g.fillRect(x + 12, y + 4, 2, 2);
1463: g.drawLine(x + 10, y + 3, x + 10, y + 3);
1464: g.drawLine(x + 9, y + 4, x + 10, y + 4);
1465: g.drawLine(x + 1, y + 5, x + 9, y + 5);
1466: g.drawLine(x + 1, y + 6, x + 1, y + 12);
1467: g.drawLine(x + 9, y + 6, x + 9, y + 12);
1468: g.drawLine(x + 1, y + 13, x + 9, y + 13);
1469:
1470:
1471: g.drawLine(x + 7, y + 6, x + 8, y + 6);
1472: g.drawLine(x + 6, y + 7, x + 8, y + 7);
1473: g.drawLine(x + 5, y + 8, x + 6, y + 8);
1474: g.drawLine(x + 4, y + 9, x + 5, y + 9);
1475: g.drawLine(x + 3, y + 10, x + 4, y + 10);
1476: g.drawLine(x + 2, y + 11, x + 3, y + 11);
1477: g.drawLine(x + 2, y + 12, x + 4, y + 12);
1478: g.drawLine(x + 8, y + 8, x + 8, y + 8);
1479:
1480:
1481: g.setColor(MetalLookAndFeel.getBlack());
1482: g.drawLine(x + 8, y, x + 13, y);
1483: g.drawLine(x + 8, y + 1, x + 8, y + 1);
1484: g.drawLine(x + 10, y + 2, x + 9, y + 3);
1485: g.drawLine(x, y + 4, x + 8, y + 4);
1486: g.drawLine(x, y + 5, x, y + 13);
1487:
1488: g.drawLine(x + 2, y + 10, x + 6, y + 6);
1489: g.drawLine(x + 8, y + 9, x + 8, y + 11);
1490: g.drawLine(x + 5, y + 12, x + 8, y + 12);
1491:
1492:
1493: g.setColor(MetalLookAndFeel.getWhite());
1494: if (!b.getModel().isPressed())
1495: {
1496: g.drawLine(x + 2, y + 6, x + 5, y + 6);
1497: g.drawLine(x + 2, y + 7, x + 2, y + 9);
1498: g.drawLine(x + 4, y + 11, x + 7, y + 8);
1499: }
1500:
1501: g.drawLine(x + 1, y + 14, x + 10, y + 14);
1502: g.drawLine(x + 10, y + 5, x + 10, y + 13);
1503:
1504: g.drawLine(x + 9, y + 2, x + 9, y + 2);
1505: g.drawLine(x + 11, y + 4, x + 11, y + 5);
1506: g.drawLine(x + 13, y + 6, x + 14, y + 6);
1507: g.drawLine(x + 14, y + 1, x + 14, y + 5);
1508: g.setColor(savedColor);
1509: }
1510: }
1511:
1512:
1515: private static class InternalFrameMinimizeIcon implements Icon, Serializable
1516: {
1517:
1518:
1521: public InternalFrameMinimizeIcon()
1522: {
1523:
1524: }
1525:
1526:
1531: public int getIconWidth()
1532: {
1533: return 16;
1534: }
1535:
1536:
1541: public int getIconHeight()
1542: {
1543: return 16;
1544: }
1545:
1546:
1554: public void paintIcon(Component c, Graphics g, int x, int y)
1555: {
1556: Color savedColor = g.getColor();
1557:
1558: AbstractButton b = (AbstractButton) c;
1559:
1560: if (b.getModel().isPressed())
1561: g.setColor(MetalLookAndFeel.getBlack());
1562: else
1563:
1564:
1565: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1566:
1567: g.drawLine(x + 12, y + 1, x + 13, y + 1);
1568: g.drawLine(x + 11, y + 2, x + 12, y + 2);
1569: g.drawLine(x + 10, y + 3, x + 11, y + 3);
1570: g.drawLine(x + 8, y + 2, x + 8, y + 3);
1571: g.fillRect(x + 8, y + 4, 3, 3);
1572: g.drawLine(x + 11, y + 6, x + 12, y + 6);
1573:
1574: g.drawLine(x + 1, y + 8, x + 6, y + 8);
1575: g.drawLine(x + 1, y + 9, x + 1, y + 12);
1576: g.drawLine(x + 6, y + 9, x + 6, y + 12);
1577: g.drawLine(x + 1, y + 13, x + 6, y + 13);
1578:
1579: g.drawLine(x + 5, y + 9, x + 5, y + 9);
1580: g.drawLine(x + 2, y + 12, x + 2, y + 12);
1581:
1582: g.setColor(MetalLookAndFeel.getBlack());
1583: g.drawLine(x + 12, y, x + 9, y + 3);
1584: g.drawLine(x + 7, y + 1, x + 8, y + 1);
1585: g.drawLine(x + 7, y + 2, x + 7, y + 6);
1586: g.drawLine(x, y + 7, x + 6, y + 7);
1587: g.drawLine(x, y + 8, x, y + 13);
1588: g.drawLine(x + 3, y + 12, x + 5, y + 12);
1589: g.drawLine(x + 5, y + 10, x + 5, y + 11);
1590: g.drawLine(x + 11, y + 5, x + 12, y + 5);
1591:
1592: g.setColor(MetalLookAndFeel.getWhite());
1593: g.drawLine(x + 9, y + 2, x + 9, y + 2);
1594: g.drawLine(x + 11, y + 4, x + 13, y + 2);
1595: g.drawLine(x + 13, y + 6, x + 13, y + 6);
1596: g.drawLine(x + 8, y + 7, x + 13, y + 7);
1597: g.drawLine(x + 7, y + 9, x + 7, y + 13);
1598: g.drawLine(x + 1, y + 14, x + 7, y + 14);
1599:
1600: if (b.getModel().isPressed())
1601: {
1602: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1603: g.fillRect(x + 2, y + 9, 3, 3);
1604: }
1605: else
1606: {
1607: g.drawLine(x + 2, y + 9, x + 4, y + 9);
1608: g.drawLine(x + 2, y + 10, x + 2, y + 11);
1609: }
1610:
1611: g.setColor(savedColor);
1612: }
1613: }
1614:
1615:
1619: private static class VerticalSliderThumbIcon implements Icon, Serializable
1620: {
1621:
1624: int[][] gradientMask = new int[][] { {0, 12}, {0, 12}, {0, 12}, {0, 12},
1625: {0, 12}, {0, 12}, {0, 12}, {1, 12},
1626: {2, 10}, {3, 9}, {4, 8}, {5, 7},
1627: {6, 6}};
1628:
1629:
1632: public VerticalSliderThumbIcon()
1633: {
1634:
1635: }
1636:
1637:
1642: public int getIconWidth()
1643: {
1644: return 16;
1645: }
1646:
1647:
1652: public int getIconHeight()
1653: {
1654: return 15;
1655: }
1656:
1657:
1667: public void paintIcon(Component c, Graphics g, int x, int y)
1668: {
1669: boolean enabled = false;
1670: boolean focus = false;
1671: if (c != null)
1672: {
1673: enabled = c.isEnabled();
1674: focus = c.hasFocus();
1675: }
1676:
1677:
1678: if (enabled)
1679: g.setColor(MetalLookAndFeel.getBlack());
1680: else
1681: g.setColor(MetalLookAndFeel.getControlDarkShadow());
1682: g.drawLine(x + 1, y, x + 7, y);
1683: g.drawLine(x + 8, y, x + 15, y + 7);
1684: g.drawLine(x + 14, y + 8, x + 8, y + 14);
1685: g.drawLine(x + 8, y + 14, x + 1, y + 14);
1686: g.drawLine(x, y + 13, x, y + 1);
1687:
1688:
1689: if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme
1690: && enabled)
1691: {
1692: String gradient;
1693: if (focus)
1694: gradient = "Slider.focusGradient";
1695: else
1696: gradient = "Slider.gradient";
1697: MetalUtils.paintGradient(g, x + 2, y + 1, 13, 12,
1698: SwingConstants.HORIZONTAL, gradient,
1699: gradientMask);
1700: }
1701: else
1702: {
1703: if (focus)
1704: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1705: else
1706: g.setColor(MetalLookAndFeel.getControl());
1707: g.fillRect(x + 2, y + 1, 7, 13);
1708: g.drawLine(x + 9, y + 2, x + 9, y + 12);
1709: g.drawLine(x + 10, y + 3, x + 10, y + 11);
1710: g.drawLine(x + 11, y + 4, x + 11, y + 10);
1711: g.drawLine(x + 12, y + 5, x + 12, y + 9);
1712: g.drawLine(x + 13, y + 6, x + 13, y + 8);
1713: g.drawLine(x + 14, y + 7, x + 14, y + 7);
1714: }
1715:
1716:
1717: if (enabled
1718: && ! (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme))
1719: {
1720: if (focus)
1721: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1722: else
1723: g.setColor(MetalLookAndFeel.getBlack());
1724: g.drawLine(x + 3, y + 3, x + 3, y + 3);
1725: g.drawLine(x + 3, y + 7, x + 3, y + 7);
1726: g.drawLine(x + 3, y + 11, x + 3, y + 11);
1727:
1728: g.drawLine(x + 5, y + 5, x + 5, y + 5);
1729: g.drawLine(x + 5, y + 9, x + 5, y + 9);
1730:
1731: g.drawLine(x + 7, y + 3, x + 7, y + 3);
1732: g.drawLine(x + 7, y + 7, x + 7, y + 7);
1733: g.drawLine(x + 7, y + 11, x + 7, y + 11);
1734:
1735:
1736: if (focus)
1737: g.setColor(MetalLookAndFeel.getPrimaryControl());
1738: else
1739: g.setColor(MetalLookAndFeel.getWhite());
1740: g.drawLine(x + 1, y + 1, x + 8, y + 1);
1741: g.drawLine(x + 1, y + 2, x + 1, y + 13);
1742: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1743: g.drawLine(x + 2, y + 6, x + 2, y + 6);
1744: g.drawLine(x + 2, y + 10, x + 2, y + 10);
1745:
1746: g.drawLine(x + 4, y + 4, x + 4, y + 4);
1747: g.drawLine(x + 4, y + 8, x + 4, y + 8);
1748:
1749: g.drawLine(x + 6, y + 2, x + 6, y + 2);
1750: g.drawLine(x + 6, y + 6, x + 6, y + 6);
1751: g.drawLine(x + 6, y + 10, x + 6, y + 10);
1752:
1753: }
1754: }
1755: }
1756:
1757:
1761: public static class TreeControlIcon implements Icon, Serializable
1762: {
1763:
1764:
1765: protected boolean isLight;
1766:
1767:
1768: private boolean collapsed;
1769:
1770:
1776: public TreeControlIcon(boolean isCollapsed)
1777: {
1778: collapsed = isCollapsed;
1779: }
1780:
1781:
1786: public int getIconWidth()
1787: {
1788: return 18;
1789: }
1790:
1795: public int getIconHeight()
1796: {
1797: return 18;
1798: }
1799:
1800:
1808: public void paintIcon(Component c, Graphics g, int x, int y)
1809: {
1810: x = x + 5;
1811: y = y + 5;
1812: if (collapsed)
1813: {
1814:
1815: g.setColor(Color.black);
1816: g.drawLine(x + 2, y, x + 5, y);
1817: g.drawLine(x + 6, y + 1, x + 7, y + 2);
1818: g.fillRect(x + 7, y + 3, 5, 2);
1819: g.drawLine(x + 7, y + 5, x + 6, y + 6);
1820: g.drawLine(x + 1, y + 1, x + 1, y + 1);
1821: g.drawLine(x, y + 2, x, y + 5);
1822: g.drawLine(x + 1, y + 6, x + 1, y + 6);
1823: g.drawLine(x + 2, y + 7, x + 5, y + 7);
1824: g.fillRect(x + 3, y + 3, 2, 2);
1825:
1826: g.setColor(new Color(204, 204, 255));
1827: g.drawLine(x + 3, y + 2, x + 4, y + 2);
1828: g.drawLine(x + 2, y + 3, x + 2, y + 4);
1829: g.drawLine(x + 3, y + 5, x + 3, y + 5);
1830: g.drawLine(x + 5, y + 3, x + 5, y + 3);
1831:
1832: g.setColor(new Color(153, 153, 204));
1833: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1834: g.drawLine(x + 2, y + 5, x + 2, y + 5);
1835: g.drawLine(x + 2, y + 6, x + 5, y + 6);
1836: g.drawLine(x + 5, y + 2, x + 5, y + 2);
1837: g.drawLine(x + 6, y + 2, x + 6, y + 5);
1838:
1839: g.setColor(new Color(102, 102, 153));
1840: g.drawLine(x + 2, y + 1, x + 5, y + 1);
1841: g.drawLine(x + 1, y + 2, x + 1, y + 5);
1842: }
1843: else
1844: {
1845:
1846: g.setColor(Color.black);
1847: g.drawLine(x + 2, y, x + 5, y);
1848: g.drawLine(x + 6, y + 1, x + 7, y + 2);
1849: g.drawLine(x + 7, y + 2, x + 7, y + 5);
1850: g.fillRect(x + 3, y + 7, 2, 5);
1851: g.drawLine(x + 7, y + 5, x + 6, y + 6);
1852: g.drawLine(x + 1, y + 1, x + 1, y + 1);
1853: g.drawLine(x, y + 2, x, y + 5);
1854: g.drawLine(x + 1, y + 6, x + 1, y + 6);
1855: g.drawLine(x + 2, y + 7, x + 5, y + 7);
1856: g.fillRect(x + 3, y + 3, 2, 2);
1857:
1858: g.setColor(new Color(204, 204, 255));
1859: g.drawLine(x + 3, y + 2, x + 4, y + 2);
1860: g.drawLine(x + 2, y + 3, x + 2, y + 4);
1861: g.drawLine(x + 3, y + 5, x + 3, y + 5);
1862: g.drawLine(x + 5, y + 3, x + 5, y + 3);
1863:
1864: g.setColor(new Color(153, 153, 204));
1865: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1866: g.drawLine(x + 2, y + 5, x + 2, y + 5);
1867: g.drawLine(x + 2, y + 6, x + 5, y + 6);
1868: g.drawLine(x + 5, y + 2, x + 5, y + 2);
1869: g.drawLine(x + 6, y + 2, x + 6, y + 5);
1870:
1871: g.setColor(new Color(102, 102, 153));
1872: g.drawLine(x + 2, y + 1, x + 5, y + 1);
1873: g.drawLine(x + 1, y + 2, x + 1, y + 5);
1874: }
1875: }
1876:
1877:
1885: public void paintMe(Component c, Graphics g, int x, int y)
1886: {
1887: paintIcon(c, g, x, y);
1888: }
1889: }
1890:
1891:
1894: public static class TreeFolderIcon extends FolderIcon16
1895: {
1896:
1899: public TreeFolderIcon()
1900: {
1901:
1902: }
1903:
1904:
1910: public int getAdditionalHeight()
1911: {
1912: return 2;
1913: }
1914:
1915:
1920: public int getShift()
1921: {
1922: return -1;
1923: }
1924: }
1925:
1926:
1929: public static class TreeLeafIcon extends FileIcon16
1930: {
1931:
1934: public TreeLeafIcon()
1935: {
1936:
1937: }
1938:
1939:
1945: public int getAdditionalHeight()
1946: {
1947: return 4;
1948: }
1949:
1950:
1955: public int getShift()
1956: {
1957: return 2;
1958: }
1959: }
1960:
1961:
1966: private static class TreeHardDriveIcon implements Icon, Serializable
1967: {
1968:
1969:
1972: public TreeHardDriveIcon()
1973: {
1974:
1975: }
1976:
1977:
1982: public int getIconWidth()
1983: {
1984: return 16;
1985: }
1986:
1987:
1992: public int getIconHeight()
1993: {
1994: return 16;
1995: }
1996:
1997:
2006: public void paintIcon(Component c, Graphics g, int x, int y)
2007: {
2008: Color saved = g.getColor();
2009: g.setColor(MetalLookAndFeel.getBlack());
2010: g.drawLine(x + 1, y + 4, x + 1, y + 5);
2011: g.drawLine(x + 14, y + 4, x + 14, y + 5);
2012: g.drawLine(x + 1, y + 7, x + 1, y + 8);
2013: g.drawLine(x + 14, y + 7, x + 14, y + 8);
2014: g.drawLine(x + 1, y + 10, x + 1, y + 11);
2015: g.drawLine(x + 14, y + 10, x + 14, y + 11);
2016:
2017: g.drawLine(x + 2, y + 3, x + 3, y + 3);
2018: g.drawLine(x + 12, y + 3, x + 13, y + 3);
2019: g.drawLine(x + 2, y + 6, x + 3, y + 6);
2020: g.drawLine(x + 12, y + 6, x + 13, y + 6);
2021: g.drawLine(x + 2, y + 9, x + 3, y + 9);
2022: g.drawLine(x + 12, y + 9, x + 13, y + 9);
2023: g.drawLine(x + 2, y + 12, x + 3, y + 12);
2024: g.drawLine(x + 12, y + 12, x + 13, y + 12);
2025:
2026: g.drawLine(x + 4, y + 2, x + 11, y + 2);
2027: g.drawLine(x + 4, y + 7, x + 11, y + 7);
2028: g.drawLine(x + 4, y + 10, x + 11, y + 10);
2029: g.drawLine(x + 4, y + 13, x + 11, y + 13);
2030:
2031: g.setColor(MetalLookAndFeel.getWhite());
2032: g.fillRect(x + 4, y + 3, 2, 2);
2033: g.drawLine(x + 6, y + 4, x + 6, y + 4);
2034: g.drawLine(x + 7, y + 3, x + 9, y + 3);
2035: g.drawLine(x + 8, y + 4, x + 8, y + 4);
2036: g.drawLine(x + 11, y + 3, x + 11, y + 3);
2037: g.fillRect(x + 2, y + 4, 2, 2);
2038: g.fillRect(x + 2, y + 7, 2, 2);
2039: g.fillRect(x + 2, y + 10, 2, 2);
2040: g.drawLine(x + 4, y + 6, x + 4, y + 6);
2041: g.drawLine(x + 4, y + 9, x + 4, y + 9);
2042: g.drawLine(x + 4, y + 12, x + 4, y + 12);
2043:
2044: g.setColor(MetalLookAndFeel.getControlShadow());
2045: g.drawLine(x + 13, y + 4, x + 13, y + 4);
2046: g.drawLine(x + 12, y + 5, x + 13, y + 5);
2047: g.drawLine(x + 13, y + 7, x + 13, y + 7);
2048: g.drawLine(x + 12, y + 8, x + 13, y + 8);
2049: g.drawLine(x + 13, y + 10, x + 13, y + 10);
2050: g.drawLine(x + 12, y + 11, x + 13, y + 11);
2051:
2052: g.drawLine(x + 10, y + 5, x + 10, y + 5);
2053: g.drawLine(x + 7, y + 6, x + 7, y + 6);
2054: g.drawLine(x + 9, y + 6, x + 9, y + 6);
2055: g.drawLine(x + 11, y + 6, x + 11, y + 6);
2056:
2057: g.drawLine(x + 10, y + 8, x + 10, y + 8);
2058: g.drawLine(x + 7, y + 9, x + 7, y + 9);
2059: g.drawLine(x + 9, y + 9, x + 9, y + 9);
2060: g.drawLine(x + 11, y + 9, x + 11, y + 9);
2061:
2062: g.drawLine(x + 10, y + 11, x + 10, y + 11);
2063: g.drawLine(x + 7, y + 12, x + 7, y + 12);
2064: g.drawLine(x + 9, y + 12, x + 9, y + 12);
2065: g.drawLine(x + 11, y + 12, x + 11, y + 12);
2066:
2067: g.setColor(saved);
2068: }
2069: }
2070:
2071:
2076: private static class TreeFloppyDriveIcon implements Icon, Serializable
2077: {
2078:
2079:
2082: public TreeFloppyDriveIcon()
2083: {
2084:
2085: }
2086:
2087:
2092: public int getIconWidth()
2093: {
2094: return 16;
2095: }
2096:
2097:
2102: public int getIconHeight()
2103: {
2104: return 16;
2105: }
2106:
2107:
2116: public void paintIcon(Component c, Graphics g, int x, int y)
2117: {
2118: Color saved = g.getColor();
2119:
2120: g.setColor(MetalLookAndFeel.getBlack());
2121: g.drawLine(x + 1, y + 1, x + 13, y + 1);
2122: g.drawLine(x + 1, y + 1, x + 1, y + 14);
2123: g.drawLine(x + 1, y + 14, x + 14, y + 14);
2124: g.drawLine(x + 14, y + 2, x + 14, y + 14);
2125:
2126: g.setColor(MetalLookAndFeel.getPrimaryControl());
2127: g.fillRect(x + 2, y + 2, 12, 12);
2128:
2129: g.setColor(MetalLookAndFeel.getControlShadow());
2130: g.fillRect(x + 5, y + 2, 6, 5);
2131: g.drawLine(x + 4, y + 8, x + 11, y + 8);
2132: g.drawLine(x + 3, y + 9, x + 3, y + 13);
2133: g.drawLine(x + 12, y + 9, x + 12, y + 13);
2134:
2135: g.setColor(MetalLookAndFeel.getWhite());
2136: g.fillRect(x + 8, y + 3, 2, 3);
2137: g.fillRect(x + 4, y + 9, 8, 5);
2138:
2139: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
2140: g.drawLine(x + 5, y + 10, x + 9, y + 10);
2141: g.drawLine(x + 5, y + 12, x + 8, y + 12);
2142:
2143: g.setColor(saved);
2144: }
2145: }
2146:
2147:
2152: private static class TreeComputerIcon implements Icon, Serializable
2153: {
2154:
2155:
2158: public TreeComputerIcon()
2159: {
2160:
2161: }
2162:
2163:
2168: public int getIconWidth()
2169: {
2170: return 16;
2171: }
2172:
2173:
2178: public int getIconHeight()
2179: {
2180: return 16;
2181: }
2182:
2183:
2192: public void paintIcon(Component c, Graphics g, int x, int y)
2193: {
2194: Color saved = g.getColor();
2195:
2196: g.setColor(MetalLookAndFeel.getBlack());
2197: g.drawLine(x + 3, y + 1, x + 12, y + 1);
2198: g.drawLine(x + 2, y + 2, x + 2, y + 8);
2199: g.drawLine(x + 13, y + 2, x + 13, y + 8);
2200: g.drawLine(x + 3, y + 9, x + 3, y + 9);
2201: g.drawLine(x + 12, y + 9, x + 12, y + 9);
2202: g.drawRect(x + 1, y + 10, 13, 4);
2203: g.drawLine(x + 5, y + 3, x + 10, y + 3);
2204: g.drawLine(x + 5, y + 8, x + 10, y + 8);
2205: g.drawLine(x + 4, y + 4, x + 4, y + 7);
2206: g.drawLine(x + 11, y + 4, x + 11, y + 7);
2207:
2208: g.setColor(MetalLookAndFeel.getPrimaryControl());
2209: g.fillRect(x + 5, y + 4, 6, 4);
2210:
2211: g.setColor(MetalLookAndFeel.getControlShadow());
2212: g.drawLine(x + 6, y + 12, x + 8, y + 12);
2213: g.drawLine(x + 10, y + 12, x + 12, y + 12);
2214: g.setColor(saved);
2215: }
2216: }
2217:
2218:
2219: private static Icon checkBoxIcon;
2220:
2221:
2222: private static Icon checkBoxMenuItemIcon;
2223:
2224:
2225: private static Icon fileChooserDetailViewIcon;
2226:
2227:
2228: private static Icon fileChooserHomeFolderIcon;
2229:
2230:
2231: private static Icon fileChooserListViewIcon;
2232:
2233:
2234: private static Icon fileChooserNewFolderIcon;
2235:
2236:
2237: private static Icon fileChooserUpFolderIcon;
2238:
2239:
2240: private static RadioButtonIcon radioButtonIcon;
2241:
2242:
2243: private static Icon radioButtonMenuItemIcon;
2244:
2245:
2246: private static Icon internalFrameDefaultMenuIcon;
2247:
2248:
2249: private static Icon treeComputerIcon;
2250:
2251:
2252: private static Icon treeFloppyDriveIcon;
2253:
2254:
2255: private static Icon treeHardDriveIcon;
2256:
2257:
2261: public MetalIconFactory()
2262: {
2263:
2264: }
2265:
2266:
2273: public static Icon getCheckBoxIcon()
2274: {
2275: if (checkBoxIcon == null)
2276: checkBoxIcon = new MetalCheckBoxIcon();
2277: return checkBoxIcon;
2278: }
2279:
2280:
2286: public static Icon getCheckBoxMenuItemIcon()
2287: {
2288: if (checkBoxMenuItemIcon == null)
2289: checkBoxMenuItemIcon = new CheckBoxMenuItemIcon();
2290: return checkBoxMenuItemIcon;
2291: }
2292:
2293:
2298: public static Icon getFileChooserDetailViewIcon()
2299: {
2300: if (fileChooserDetailViewIcon == null)
2301: fileChooserDetailViewIcon = new FileChooserDetailViewIcon();
2302: return fileChooserDetailViewIcon;
2303: }
2304:
2305:
2310: public static Icon getFileChooserHomeFolderIcon()
2311: {
2312: if (fileChooserHomeFolderIcon == null)
2313: fileChooserHomeFolderIcon = new FileChooserHomeFolderIcon();
2314: return fileChooserHomeFolderIcon;
2315: }
2316:
2317:
2322: public static Icon getFileChooserListViewIcon()
2323: {
2324: if (fileChooserListViewIcon == null)
2325: fileChooserListViewIcon = new FileChooserListViewIcon();
2326: return fileChooserListViewIcon;
2327: }
2328:
2329:
2334: public static Icon getFileChooserNewFolderIcon()
2335: {
2336: if (fileChooserNewFolderIcon == null)
2337: fileChooserNewFolderIcon = new FileChooserNewFolderIcon();
2338: return fileChooserNewFolderIcon;
2339: }
2340:
2341:
2346: public static Icon getFileChooserUpFolderIcon()
2347: {
2348: if (fileChooserUpFolderIcon == null)
2349: fileChooserUpFolderIcon = new FileChooserUpFolderIcon();
2350: return fileChooserUpFolderIcon;
2351: }
2352:
2353:
2358: public static Icon getRadioButtonIcon()
2359: {
2360: if (radioButtonIcon == null)
2361: radioButtonIcon = new RadioButtonIcon();
2362: return radioButtonIcon;
2363: }
2364:
2365:
2370: public static Icon getRadioButtonMenuItemIcon()
2371: {
2372: if (radioButtonMenuItemIcon == null)
2373: radioButtonMenuItemIcon = new RadioButtonMenuItemIcon();
2374: return radioButtonMenuItemIcon;
2375: }
2376:
2377:
2383: public static Icon getHorizontalSliderThumbIcon()
2384: {
2385: return new HorizontalSliderThumbIcon();
2386: }
2387:
2388:
2396: public static Icon getInternalFrameCloseIcon(int size)
2397: {
2398: return new InternalFrameCloseIcon(size);
2399: }
2400:
2401:
2407: public static Icon getInternalFrameDefaultMenuIcon()
2408: {
2409: if (internalFrameDefaultMenuIcon == null)
2410: internalFrameDefaultMenuIcon = new InternalFrameDefaultMenuIcon();
2411: return internalFrameDefaultMenuIcon;
2412: }
2413:
2414:
2423: public static Icon getInternalFrameMaximizeIcon(int size)
2424: {
2425: return new InternalFrameMaximizeIcon();
2426: }
2427:
2428:
2436: public static Icon getInternalFrameMinimizeIcon(int size)
2437: {
2438: return new InternalFrameMinimizeIcon();
2439: }
2440:
2441:
2451: public static Icon getInternalFrameAltMaximizeIcon(int size)
2452: {
2453: return new InternalFrameAltMaximizeIcon(size);
2454: }
2455:
2456:
2462: public static Icon getVerticalSliderThumbIcon()
2463: {
2464: return new VerticalSliderThumbIcon();
2465: }
2466:
2467:
2472: public static Icon getTreeFolderIcon()
2473: {
2474: return new TreeFolderIcon();
2475: }
2476:
2477:
2482: public static Icon getTreeLeafIcon()
2483: {
2484: return new TreeLeafIcon();
2485: }
2486:
2487:
2495: public static Icon getTreeControlIcon(boolean isCollapsed)
2496: {
2497: return new TreeControlIcon(isCollapsed);
2498: }
2499:
2500:
2505: public static Icon getTreeComputerIcon()
2506: {
2507: if (treeComputerIcon == null)
2508: treeComputerIcon = new TreeComputerIcon();
2509: return treeComputerIcon;
2510: }
2511:
2512:
2517: public static Icon getTreeFloppyDriveIcon()
2518: {
2519: if (treeFloppyDriveIcon == null)
2520: treeFloppyDriveIcon = new TreeFloppyDriveIcon();
2521: return treeFloppyDriveIcon;
2522: }
2523:
2524:
2529: public static Icon getTreeHardDriveIcon()
2530: {
2531: if (treeHardDriveIcon == null)
2532: treeHardDriveIcon = new TreeHardDriveIcon();
2533: return treeHardDriveIcon;
2534: }
2535:
2536:
2543: public static Icon getMenuArrowIcon()
2544: {
2545: if (menuArrow == null)
2546: menuArrow = new Icon()
2547: {
2548: public int getIconHeight()
2549: {
2550: return 8;
2551: }
2552:
2553: public int getIconWidth()
2554: {
2555: return 4;
2556: }
2557:
2558: public void paintIcon(Component c, Graphics g, int x, int y)
2559: {
2560: Color saved = g.getColor();
2561: g.setColor(Color.BLACK);
2562: for (int i = 0; i < 4; i++)
2563: g.drawLine(x + i, y + i, x + i, y + 7 - i);
2564: g.setColor(saved);
2565: }
2566: };
2567: return menuArrow;
2568: }
2569:
2570:
2576: public static Icon getMenuItemArrowIcon()
2577: {
2578: if (menuItemArrow == null)
2579: menuItemArrow = new Icon()
2580: {
2581: public int getIconHeight()
2582: {
2583: return 8;
2584: }
2585:
2586: public int getIconWidth()
2587: {
2588: return 4;
2589: }
2590:
2591: public void paintIcon(Component c, Graphics g, int x, int y)
2592: {
2593: Color saved = g.getColor();
2594: g.setColor(Color.BLACK);
2595: for (int i = 0; i < 4; i++)
2596: g.drawLine(x + i, y + i, x + i, y + 7 - i);
2597: g.setColor(saved);
2598: }
2599: };
2600: return menuItemArrow;
2601: }
2602:
2603:
2608: public static Icon getMenuItemCheckIcon()
2609: {
2610: return new Icon()
2611: {
2612: public int getIconHeight()
2613: {
2614: return 13;
2615: }
2616:
2617: public int getIconWidth()
2618: {
2619: return 13;
2620: }
2621:
2622: public void paintIcon(Component c, Graphics g, int x, int y)
2623: {
2624: Color saved = g.getColor();
2625: g.setColor(Color.BLACK);
2626: g.drawLine(3 + x, 5 + y, 3 + x, 9 + y);
2627: g.drawLine(4 + x, 5 + y, 4 + x, 9 + y);
2628: g.drawLine(5 + x, 7 + y, 9 + x, 3 + y);
2629: g.drawLine(5 + x, 8 + y, 9 + x, 4 + y);
2630: g.setColor(saved);
2631: }
2632: };
2633: }
2634: }