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