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: import ;
59:
60:
61:
64: public class MetalIconFactory implements Serializable
65: {
66:
67:
68: public static final boolean DARK = false;
69:
70:
71: public static final boolean LIGHT = true;
72:
73:
74: private static Icon menuArrow;
75:
76:
77: private static Icon menuItemArrow;
78:
79:
82: private static class CheckBoxMenuItemIcon
83: implements Icon, UIResource, Serializable
84: {
85:
88: public CheckBoxMenuItemIcon()
89: {
90:
91: }
92:
93:
98: public int getIconWidth()
99: {
100: return 10;
101: }
102:
103:
108: public int getIconHeight()
109: {
110: return 10;
111: }
112:
113:
121: public void paintIcon(Component c, Graphics g, int x, int y)
122: {
123: JCheckBoxMenuItem item = (JCheckBoxMenuItem) c;
124:
125: if (item.isArmed())
126: g.setColor(MetalLookAndFeel.getBlack());
127: else
128: g.setColor(MetalLookAndFeel.getControlDarkShadow());
129: g.drawLine(x, y, x + 8, y);
130: g.drawLine(x, y + 1, x, y + 8);
131: g.drawLine(x + 2, y + 8, x + 8, y + 8);
132: g.drawLine(x + 8, y + 2, x + 8, y + 7);
133:
134: g.setColor(MetalLookAndFeel.getWhite());
135: g.drawLine(x + 1, y + 1, x + 7, y + 1);
136: g.drawLine(x + 1, y + 2, x + 1, y + 7);
137: g.drawLine(x + 1, y + 9, x + 9, y + 9);
138: g.drawLine(x + 9, y + 1, x + 9, y + 8);
139:
140:
141: if (item.isSelected())
142: {
143: g.setColor(MetalLookAndFeel.getBlack());
144: g.fillRect(x + 2, y + 2, 2, 5);
145: for (int i = 0; i < 6; i++)
146: g.drawLine(x + 8 - i, y + i, x + 9 - i, y + i);
147: }
148:
149: }
150: }
151:
152:
158: private static class FileChooserDetailViewIcon
159: implements Icon, UIResource, Serializable
160: {
161:
162:
165: public FileChooserDetailViewIcon()
166: {
167:
168: }
169:
170:
175: public int getIconWidth()
176: {
177: return 18;
178: }
179:
180:
185: public int getIconHeight()
186: {
187: return 18;
188: }
189:
190:
198: public void paintIcon(Component c, Graphics g, int x, int y)
199: {
200: Color savedColor = g.getColor();
201: g.setColor(MetalLookAndFeel.getBlack());
202:
203:
204: g.drawLine(x + 2, y + 2, x + 5, y + 2);
205: g.drawLine(x + 6, y + 3, x + 6, y + 7);
206: g.drawLine(x + 2, y + 7, x + 6, y + 7);
207: g.drawLine(x + 2, y + 2, x + 2, y + 7);
208:
209:
210: g.drawLine(x + 2, y + 10, x + 5, y + 10);
211: g.drawLine(x + 6, y + 11, x + 6, y + 15);
212: g.drawLine(x + 2, y + 15, x + 6, y + 15);
213: g.drawLine(x + 2, y + 10, x + 2, y + 15);
214:
215:
216: g.drawLine(x + 8, y + 5, x + 15, y + 5);
217: g.drawLine(x + 8, y + 13, x + 15, y + 13);
218:
219:
220: g.setColor(MetalLookAndFeel.getPrimaryControl());
221: g.fillRect(x + 3, y + 3, 3, 4);
222: g.fillRect(x + 3, y + 11, 3, 4);
223:
224:
225: g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
226: g.drawLine(x + 4, y + 4, x + 4, y + 5);
227: g.drawLine(x + 4, y + 12, x + 4, y + 13);
228:
229: g.setColor(savedColor);
230: }
231: }
232:
233:
239: private static class FileChooserHomeFolderIcon
240: implements Icon, UIResource, Serializable
241: {
242:
243:
246: public FileChooserHomeFolderIcon()
247: {
248:
249: }
250:
251:
256: public int getIconWidth()
257: {
258: return 18;
259: }
260:
261:
266: public int getIconHeight()
267: {
268: return 18;
269: }
270:
271:
279: public void paintIcon(Component c, Graphics g, int x, int y)
280: {
281: Color savedColor = g.getColor();
282: g.setColor(MetalLookAndFeel.getBlack());
283:
284:
285: g.drawLine(x + 1, y + 8, x + 8, y + 1);
286: g.drawLine(x + 8, y + 1, x + 15, y + 8);
287:
288:
289: g.drawLine(x + 3, y + 6, x + 3, y + 15);
290: g.drawLine(x + 3, y + 15, x + 13, y + 15);
291: g.drawLine(x + 13, y + 6, x + 13, y + 15);
292:
293:
294: g.drawLine(x + 6, y + 9, x + 6, y + 15);
295: g.drawLine(x + 6, y + 9, x + 10, y + 9);
296: g.drawLine(x + 10, y + 9, x + 10, y + 15);
297:
298:
299: g.drawLine(x + 11, y + 2, x + 11, y + 4);
300: g.drawLine(x + 12, y + 2, x + 12, y + 5);
301:
302: g.setColor(MetalLookAndFeel.getControlDarkShadow());
303:
304:
305: int xx = x + 8;
306: for (int i = 0; i < 4; i++)
307: g.drawLine(xx - i, y + 2 + i, xx + i, y + 2 + i);
308: g.fillRect(x + 4, y + 6, 9, 2);
309:
310:
311: g.drawLine(x + 9, y + 12, x + 9, y + 12);
312:
313:
314: g.setColor(MetalLookAndFeel.getPrimaryControl());
315: g.drawLine(x + 4, y + 8, x + 12, y + 8);
316: g.fillRect(x + 4, y + 9, 2, 6);
317: g.fillRect(x + 11, y + 9, 2, 6);
318:
319: g.setColor(savedColor);
320: }
321: }
322:
323:
329: private static class FileChooserListViewIcon
330: implements Icon, UIResource, Serializable
331: {
332:
335: public FileChooserListViewIcon()
336: {
337:
338: }
339:
340:
345: public int getIconWidth()
346: {
347: return 18;
348: }
349:
350:
355: public int getIconHeight()
356: {
357: return 18;
358: }
359:
360:
368: public void paintIcon(Component c, Graphics g, int x, int y)
369: {
370: Color savedColor = g.getColor();
371: g.setColor(MetalLookAndFeel.getBlack());
372:
373:
374: g.drawLine(x + 2, y + 2, x + 5, y + 2);
375: g.drawLine(x + 6, y + 3, x + 6, y + 7);
376: g.drawLine(x + 2, y + 7, x + 6, y + 7);
377: g.drawLine(x + 2, y + 2, x + 2, y + 7);
378:
379:
380: g.drawLine(x + 2, y + 10, x + 5, y + 10);
381: g.drawLine(x + 6, y + 11, x + 6, y + 15);
382: g.drawLine(x + 2, y + 15, x + 6, y + 15);
383: g.drawLine(x + 2, y + 10, x + 2, y + 15);
384:
385:
386: g.drawLine(x + 10, y + 2, x + 13, y + 2);
387: g.drawLine(x + 14, y + 3, x + 14, y + 7);
388: g.drawLine(x + 10, y + 7, x + 14, y + 7);
389: g.drawLine(x + 10, y + 2, x + 10, y + 7);
390:
391:
392: g.drawLine(x + 10, y + 10, x + 13, y + 10);
393: g.drawLine(x + 14, y + 11, x + 14, y + 15);
394: g.drawLine(x + 10, y + 15, x + 14, y + 15);
395: g.drawLine(x + 10, y + 10, x + 10, y + 15);
396:
397: g.drawLine(x + 8, y + 5, x + 8, y + 5);
398: g.drawLine(x + 8, y + 13, x + 8, y + 13);
399: g.drawLine(x + 16, y + 5, x + 16, y + 5);
400: g.drawLine(x + 16, y + 13, x + 16, y + 13);
401:
402:
403: g.setColor(MetalLookAndFeel.getPrimaryControl());
404: g.fillRect(x + 3, y + 3, 3, 4);
405: g.fillRect(x + 3, y + 11, 3, 4);
406: g.fillRect(x + 11, y + 3, 3, 4);
407: g.fillRect(x + 11, y + 11, 3, 4);
408:
409:
410: g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
411: g.drawLine(x + 4, y + 4, x + 4, y + 5);
412: g.drawLine(x + 4, y + 12, x + 4, y + 13);
413: g.drawLine(x + 12, y + 4, x + 12, y + 5);
414: g.drawLine(x + 12, y + 12, x + 12, y + 13);
415:
416: g.setColor(savedColor);
417: }
418: }
419:
420:
426: private static class FileChooserNewFolderIcon
427: implements Icon, UIResource, Serializable
428: {
429:
432: public FileChooserNewFolderIcon()
433: {
434:
435: }
436:
437:
442: public int getIconWidth()
443: {
444: return 18;
445: }
446:
447:
452: public int getIconHeight()
453: {
454: return 18;
455: }
456:
457:
465: public void paintIcon(Component c, Graphics g, int x, int y)
466: {
467: Color savedColor = g.getColor();
468: g.setColor(MetalLookAndFeel.getBlack());
469:
470: g.drawLine(x + 2, y + 5, x + 9, y + 5);
471: g.drawLine(x + 10, y + 6, x + 15, y + 6);
472: g.drawLine(x + 15, y + 5, x + 15, y + 14);
473: g.drawLine(x + 2, y + 14, x + 15, y + 14);
474: g.drawLine(x + 1, y + 6, x + 1, y + 14);
475:
476: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
477: g.drawLine(x + 11, y + 3, x + 15, y + 3);
478: g.drawLine(x + 10, y + 4, x + 15, y + 4);
479:
480: g.setColor(MetalLookAndFeel.getPrimaryControl());
481: g.fillRect(x + 3, y + 7, 7, 7);
482: g.fillRect(x + 10, y + 8, 5, 6);
483: g.drawLine(x + 10, y + 5, x + 14, y + 5);
484:
485: g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
486: g.drawLine(x + 10, y + 7, x + 14, y + 7);
487: g.drawLine(x + 2, y + 6, x + 9, y + 6);
488: g.drawLine(x + 2, y + 6, x + 2, y + 13);
489: g.setColor(savedColor);
490: }
491: }
492:
493:
499: private static class FileChooserUpFolderIcon extends FileChooserNewFolderIcon
500: {
501:
504: public FileChooserUpFolderIcon()
505: {
506:
507: }
508:
509:
517: public void paintIcon(Component c, Graphics g, int x, int y)
518: {
519: Color savedColor = g.getColor();
520:
521:
522: super.paintIcon(c, g, x, y);
523:
524:
525: g.setColor(MetalLookAndFeel.getBlack());
526: g.drawLine(x + 8, y + 9, x + 8, y + 16);
527: int xx = x + 8;
528: for (int i = 0; i < 4; i++)
529: g.drawLine(xx - i, y + 9 + i, xx + i, y + 9 + i);
530: g.setColor(savedColor);
531: }
532: }
533:
534:
538: public static class FileIcon16 implements Icon, Serializable
539: {
540:
545: public int getIconWidth()
546: {
547: return 16;
548: }
549:
550:
557: public int getIconHeight()
558: {
559: return 16 + getAdditionalHeight();
560: }
561:
562:
570: public void paintIcon(Component c, Graphics g, int x, int y)
571: {
572:
573: g.setColor(Color.black);
574: g.drawLine(x, y, x + 9, y);
575: g.drawLine(x, y + 1, x, y + 15);
576: g.drawLine(x, y + 15, x + 12, y + 15);
577: g.drawLine(x + 12, y + 15, x + 12, y + 6);
578: g.drawLine(x + 12, y + 6, x + 9, y);
579:
580: g.drawLine(x + 7, y + 2, x + 11, y + 6);
581: g.drawLine(x + 8, y + 1, x + 9, y + 1);
582:
583: g.setColor(new Color(204, 204, 255));
584: g.drawLine(x + 1, y + 1, x + 7, y + 1);
585: g.drawLine(x + 1, y + 1, x + 1, y + 14);
586: g.drawLine(x + 1, y + 14, x + 11, y + 14);
587: g.drawLine(x + 11, y + 14, x + 11, y + 7);
588: g.drawLine(x + 8, y + 2, x + 10, y + 4);
589: }
590:
591:
598: public int getAdditionalHeight()
599: {
600: return 0;
601: }
602:
603:
608: public int getShift()
609: {
610: return 0;
611: }
612:
613: }
614:
615:
618: public static class FolderIcon16 implements Icon, Serializable
619: {
620:
625: public int getIconWidth()
626: {
627: return 16;
628: }
629:
630:
637: public int getIconHeight()
638: {
639: return 16 + getAdditionalHeight();
640: }
641:
642:
650: public void paintIcon(Component c, Graphics g, int x, int y)
651: {
652:
653: g.setColor(Color.black);
654: g.drawLine(x, y + 3, x, y + 12);
655: g.drawLine(x, y + 12, x + 15, y + 12);
656: g.drawLine(x + 15, y + 12, x + 15, y + 2);
657: g.drawLine(x + 14, y + 3, x + 9, y + 3);
658: g.drawLine(x + 8, y + 2, x + 1, y + 2);
659: g.setColor(new Color(204, 204, 255));
660: g.fillRect(x + 2, y + 4, 7, 8);
661: g.fillRect(x + 9, y + 5, 6, 7);
662: g.setColor(new Color(102, 102, 153));
663: g.drawLine(x + 9, y + 2, x + 14, y + 2);
664: g.setColor(new Color(50, 50, 120));
665: g.drawLine(x + 9, y + 1, x + 15, y + 1);
666: g.drawLine(x + 10, y, x + 15, y);
667: }
668:
669:
676: public int getAdditionalHeight()
677: {
678: return 0;
679: }
680:
681:
686: public int getShift()
687: {
688: return 0;
689: }
690:
691: }
692:
693:
699: public static class PaletteCloseIcon
700: implements Icon, Serializable, UIResource
701: {
702:
707: public int getIconWidth()
708: {
709: return 7;
710: }
711:
712:
717: public int getIconHeight()
718: {
719: return 7;
720: }
721:
722:
730: public void paintIcon(Component c, Graphics g, int x, int y)
731: {
732: Color savedColor = g.getColor();
733: AbstractButton button = (AbstractButton) c;
734: if (button.getModel().isPressed())
735: g.setColor(MetalLookAndFeel.getBlack());
736: else
737: g.setColor(MetalLookAndFeel.getControlDarkShadow());
738: g.fillRect(x + 2, y + 2, 3, 3);
739: g.drawLine(x + 1, y, x + 1, y + 2);
740: g.drawLine(x, y + 1, x + 2, y + 1);
741: g.drawLine(x + 5, y, x + 5, y + 2);
742: g.drawLine(x + 4, y + 1, x + 6, y + 1);
743: g.drawLine(x + 1, y + 4, x + 1, y + 6);
744: g.drawLine(x, y + 5, x + 2, y + 5);
745: g.drawLine(x + 5, y + 4, x + 5, y + 6);
746: g.drawLine(x + 4, y + 5, x + 6, y + 5);
747: g.setColor(MetalLookAndFeel.getControlHighlight());
748: g.drawLine(x + 2, y + 6, x + 3, y + 5);
749: g.drawLine(x + 5, y + 3, x + 6, y + 2);
750: g.drawLine(x + 6, y + 6, x + 6, y + 6);
751: g.setColor(savedColor);
752: }
753: }
754:
755:
761: static class RadioButtonIcon implements Icon, UIResource, Serializable
762: {
763:
764:
770: private static int[][] gradientMask = new int[][] {{3, 7}, {1, 9}, {1, 9},
771: {0, 10}, {0, 10}, {0, 10},
772: {0, 10}, {1, 9}, {1, 9},
773: {3, 7}};
774:
775:
780: public int getIconWidth()
781: {
782: return 13;
783: }
784:
785:
790: public int getIconHeight()
791: {
792: return 13;
793: }
794:
795:
805: public void paintIcon(Component c, Graphics g, int x, int y)
806: {
807: if (UIManager.get("RadioButton.gradient") != null)
808: MetalUtils.paintGradient(g, x + 2, y + 2, 8, 8,
809: SwingConstants.VERTICAL, "RadioButton.gradient",
810: gradientMask);
811:
812: Color savedColor = g.getColor();
813: JRadioButton b = (JRadioButton) c;
814:
815:
816: if (b.isEnabled())
817: g.setColor(MetalLookAndFeel.getControlDarkShadow());
818: else
819: g.setColor(MetalLookAndFeel.getControlDisabled());
820: g.drawLine(x + 2, y + 1, x + 3, y + 1);
821: g.drawLine(x + 4, y, x + 7, y);
822: g.drawLine(x + 8, y + 1, x + 9, y + 1);
823: g.drawLine(x + 10, y + 2, x + 10, y + 3);
824: g.drawLine(x + 11, y + 4, x + 11, y + 7);
825: g.drawLine(x + 10, y + 8, x + 10, y + 9);
826: g.drawLine(x + 8, y + 10, x + 9, y + 10);
827: g.drawLine(x + 4, y + 11, x + 7, y + 11);
828: g.drawLine(x + 2, y + 10, x + 3, y + 10);
829: g.drawLine(x + 1, y + 9, x + 1, y + 8);
830: g.drawLine(x, y + 7, x, y + 4);
831: g.drawLine(x + 1, y + 2, x + 1, y + 3);
832:
833: if (b.getModel().isArmed())
834: {
835: g.setColor(MetalLookAndFeel.getControlShadow());
836: g.drawLine(x + 4, y + 1, x + 7, y + 1);
837: g.drawLine(x + 4, y + 10, x + 7, y + 10);
838: g.drawLine(x + 1, y + 4, x + 1, y + 7);
839: g.drawLine(x + 10, y + 4, x + 10, y + 7);
840: g.fillRect(x + 2, y + 2, 8, 8);
841: }
842: else
843: {
844:
845: if (b.isEnabled())
846: {
847: g.setColor(MetalLookAndFeel.getWhite());
848:
849: g.drawLine(x + 2, y + 8, x + 2, y + 9);
850: g.drawLine(x + 1, y + 4, x + 1, y + 7);
851: g.drawLine(x + 2, y + 2, x + 2, y + 3);
852: g.drawLine(x + 3, y + 2, x + 3, y + 2);
853: g.drawLine(x + 4, y + 1, x + 7, y + 1);
854: g.drawLine(x + 8, y + 2, x + 9, y + 2);
855: }
856: }
857:
858:
859: if (b.isEnabled())
860: {
861: g.setColor(MetalLookAndFeel.getWhite());
862:
863:
864: g.drawLine(x + 10, y + 1, x + 10, y + 1);
865: g.drawLine(x + 11, y + 2, x + 11, y + 3);
866: g.drawLine(x + 12, y + 4, x + 12, y + 7);
867: g.drawLine(x + 11, y + 8, x + 11, y + 9);
868: g.drawLine(x + 10, y + 10, x + 10, y + 10);
869: g.drawLine(x + 8, y + 11, x + 9, y + 11);
870: g.drawLine(x + 4, y + 12, x + 7, y + 12);
871: g.drawLine(x + 2, y + 11, x + 3, y + 11);
872: }
873:
874: if (b.isSelected())
875: {
876: if (b.isEnabled())
877: g.setColor(MetalLookAndFeel.getBlack());
878: else
879: g.setColor(MetalLookAndFeel.getControlDisabled());
880: g.drawLine(x + 4, y + 3, x + 7, y + 3);
881: g.fillRect(x + 3, y + 4, 6, 4);
882: g.drawLine(x + 4, y + 8, x + 7, y + 8);
883: }
884: g.setColor(savedColor);
885: }
886: }
887:
888:
891: private static class RadioButtonMenuItemIcon
892: implements Icon, UIResource, Serializable
893: {
894:
897: public RadioButtonMenuItemIcon()
898: {
899:
900: }
901:
902:
907: public int getIconWidth()
908: {
909: return 10;
910: }
911:
912:
917: public int getIconHeight()
918: {
919: return 10;
920: }
921:
922:
930: public void paintIcon(Component c, Graphics g, int x, int y)
931: {
932: Color savedColor = g.getColor();
933: JRadioButtonMenuItem item = (JRadioButtonMenuItem) c;
934: g.setColor(MetalLookAndFeel.getBlack());
935: g.drawLine(x + 2, y, x + 6, y);
936: g.drawLine(x + 7, y + 1, x + 7, y + 1);
937: g.drawLine(x + 8, y + 2, x + 8, y + 6);
938: g.drawLine(x + 7, y + 7, x + 7, y + 7);
939: g.drawLine(x + 2, y + 8, x + 6, y + 8);
940: g.drawLine(x + 1, y + 7, x + 1, y + 7);
941: g.drawLine(x, y + 2, x, y + 6);
942: g.drawLine(x + 1, y + 1, x + 1, y + 1);
943:
944: if (item.isSelected())
945: {
946: g.drawLine(x + 3, y + 2, x + 5, y + 2);
947: g.fillRect(x + 2, y + 3, 5, 3);
948: g.drawLine(x + 3, y + 6, x + 5, y + 6);
949: }
950:
951:
952: g.setColor(MetalLookAndFeel.getControlHighlight());
953: g.drawLine(x + 3, y + 1, x + 6, y + 1);
954: g.drawLine(x + 8, y + 1, x + 8, y + 1);
955: g.drawLine(x + 9, y + 2, x + 9, y + 7);
956: g.drawLine(x + 8, y + 8, x + 8, y + 8);
957: g.drawLine(x + 2, y + 9, x + 7, y + 9);
958: g.drawLine(x + 1, y + 8, x + 1, y + 8);
959: g.drawLine(x + 1, y + 3, x + 1, y + 6);
960: g.drawLine(x + 2, y + 2, x + 2, y + 2);
961: g.setColor(savedColor);
962: }
963: }
964:
965:
969: private static class HorizontalSliderThumbIcon
970: implements Icon, UIResource, Serializable
971: {
972:
973:
976: int[][] gradientMask = new int[][] { {0, 12}, {0, 12}, {0, 12}, {0, 12},
977: {0, 12}, {0, 12}, {0, 12}, {1, 11},
978: {2, 10}, {3, 9}, {4, 8}, {5, 7},
979: {6, 6}};
980:
981:
984: public HorizontalSliderThumbIcon()
985: {
986:
987: }
988:
989:
994: public int getIconWidth()
995: {
996: return 15;
997: }
998:
999:
1004: public int getIconHeight()
1005: {
1006: return 16;
1007: }
1008:
1009:
1018: public void paintIcon(Component c, Graphics g, int x, int y)
1019: {
1020: boolean enabled = false;
1021: boolean focus = false;
1022: if (c != null)
1023: {
1024: enabled = c.isEnabled();
1025: focus = c.hasFocus();
1026: }
1027:
1028:
1029: if (enabled)
1030: g.setColor(MetalLookAndFeel.getBlack());
1031: else
1032: g.setColor(MetalLookAndFeel.getControlDarkShadow());
1033: g.drawLine(x + 1, y, x + 13, y);
1034: g.drawLine(x + 14, y + 1, x + 14, y + 7);
1035: g.drawLine(x + 14, y + 8, x + 7, y + 15);
1036: g.drawLine(x + 6, y + 14, x, y + 8);
1037: g.drawLine(x, y + 7, x, y + 1);
1038:
1039:
1040: if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme
1041: && enabled)
1042: {
1043: String gradient;
1044: if (focus)
1045: gradient = "Slider.focusGradient";
1046: else
1047: gradient = "Slider.gradient";
1048: MetalUtils.paintGradient(g, x + 1, y + 2, 12, 13,
1049: SwingConstants.VERTICAL, gradient,
1050: gradientMask);
1051: }
1052: else
1053: {
1054: if (focus)
1055: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1056: else
1057: g.setColor(MetalLookAndFeel.getControl());
1058: g.fillRect(x + 1, y + 2, 13, 7);
1059: g.drawLine(x + 2, y + 9, x + 12, y + 9);
1060: g.drawLine(x + 3, y + 10, x + 11, y + 10);
1061: g.drawLine(x + 4, y + 11, x + 10, y + 11);
1062: g.drawLine(x + 5, y + 12, x + 9, y + 12);
1063: g.drawLine(x + 6, y + 13, x + 8, y + 13);
1064: g.drawLine(x + 7, y + 14, x + 7, y + 14);
1065: }
1066:
1067:
1068: if (c.isEnabled()
1069: && !(MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme))
1070: {
1071: if (focus)
1072: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1073: else
1074: g.setColor(MetalLookAndFeel.getBlack());
1075: g.drawLine(x + 3, y + 3, x + 3, y + 3);
1076: g.drawLine(x + 7, y + 3, x + 7, y + 3);
1077: g.drawLine(x + 11, y + 3, x + 11, y + 3);
1078:
1079: g.drawLine(x + 5, y + 5, x + 5, y + 5);
1080: g.drawLine(x + 9, y + 5, x + 9, y + 5);
1081:
1082: g.drawLine(x + 3, y + 7, x + 3, y + 7);
1083: g.drawLine(x + 7, y + 7, x + 7, y + 7);
1084: g.drawLine(x + 11, y + 7, x + 11, y + 7);
1085:
1086:
1087: if (focus)
1088: g.setColor(MetalLookAndFeel.getPrimaryControl());
1089: else
1090: g.setColor(MetalLookAndFeel.getWhite());
1091: g.drawLine(x + 1, y + 1, x + 13, y + 1);
1092: g.drawLine(x + 1, y + 2, x + 1, y + 8);
1093: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1094: g.drawLine(x + 6, y + 2, x + 6, y + 2);
1095: g.drawLine(x + 10, y + 2, x + 10, y + 2);
1096:
1097: g.drawLine(x + 4, y + 4, x + 4, y + 4);
1098: g.drawLine(x + 8, y + 4, x + 8, y + 4);
1099:
1100: g.drawLine(x + 2, y + 6, x + 2, y + 6);
1101: g.drawLine(x + 6, y + 6, x + 6, y + 6);
1102: g.drawLine(x + 10, y + 6, x + 10, y + 6);
1103: }
1104:
1105: }
1106: }
1107:
1108:
1112: private static class InternalFrameCloseIcon
1113: implements Icon, UIResource, Serializable
1114: {
1115:
1116: private int size;
1117:
1118:
1123: public InternalFrameCloseIcon(int size)
1124: {
1125: this.size = size;
1126: }
1127:
1128:
1133: public int getIconWidth()
1134: {
1135: return size;
1136: }
1137:
1138:
1143: public int getIconHeight()
1144: {
1145: return size;
1146: }
1147:
1148:
1156: public void paintIcon(Component c, Graphics g, int x, int y)
1157: {
1158: Color savedColor = g.getColor();
1159: AbstractButton b = (AbstractButton) c;
1160:
1161:
1162: if (b.getModel().isPressed())
1163:
1164:
1165: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1166: else
1167: g.setColor(MetalLookAndFeel.getPrimaryControl());
1168: g.fillRect(x + 2, y + 2, 10, 10);
1169:
1170:
1171: if (b.getModel().isPressed())
1172: g.setColor(MetalLookAndFeel.getBlack());
1173: else
1174: {
1175:
1176:
1177: boolean selected = true;
1178: if (selected)
1179: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1180: else
1181: g.setColor(MetalLookAndFeel.getControlDarkShadow());
1182: }
1183: g.drawLine(x + 1, y + 1, x + 13, y + 1);
1184: g.drawLine(x + 1, y + 2, x + 1, y + 12);
1185: g.drawLine(x + 1, y + 13, x + 13, y + 13);
1186: g.drawLine(x + 13, y + 2, x + 13, y + 12);
1187: g.drawLine(x + 2, y + 12, x + 2, y + 12);
1188: g.drawLine(x + 12, y + 2, x + 12, y + 2);
1189:
1190: g.fillRect(x + 4, y + 4, 2, 2);
1191: g.fillRect(x + 5, y + 5, 4, 4);
1192: g.drawLine(x + 9, y + 4, x + 10, y + 4);
1193: g.drawLine(x + 9, y + 4, x + 9, y + 5);
1194: g.drawLine(x + 4, y + 9, x + 4, y + 10);
1195: g.drawLine(x + 4, y + 9, x + 5, y + 9);
1196: g.drawLine(x + 9, y + 8, x + 9, y + 10);
1197: g.drawLine(x + 8, y + 9, x + 10, y + 9);
1198:
1199: g.setColor(MetalLookAndFeel.getBlack());
1200: g.drawLine(x, y, x + 13, y);
1201: g.drawLine(x, y + 1, x, y + 13);
1202: g.drawLine(x + 3, y + 4, x + 4, y + 3);
1203: g.drawLine(x + 3, y + 9, x + 5, y + 7);
1204: g.drawLine(x + 7, y + 5, x + 9, y + 3);
1205:
1206: g.drawLine(x + 12, y + 3, x + 12, y + 11);
1207: g.drawLine(x + 3, y + 12, x + 12, y + 12);
1208:
1209: g.setColor(MetalLookAndFeel.getWhite());
1210: g.drawLine(x + 1, y + 14, x + 14, y + 14);
1211: g.drawLine(x + 14, y + 1, x + 14, y + 14);
1212:
1213: if (!b.getModel().isPressed())
1214: {
1215: g.drawLine(x + 5, y + 10, x + 5, y + 10);
1216: g.drawLine(x + 6, y + 9, x + 7, y + 9);
1217: g.drawLine(x + 10, y + 5, x + 10, y + 5);
1218: g.drawLine(x + 9, y + 6, x + 9, y + 7);
1219: g.drawLine(x + 10, y + 10, x + 11, y + 10);
1220: g.drawLine(x + 10, y + 11, x + 10, y + 11);
1221: }
1222: g.setColor(savedColor);
1223: }
1224: }
1225:
1226:
1229: private static class InternalFrameDefaultMenuIcon
1230: implements Icon, UIResource, Serializable
1231: {
1232:
1233:
1236: public InternalFrameDefaultMenuIcon()
1237: {
1238:
1239: }
1240:
1241:
1246: public int getIconWidth()
1247: {
1248: return 16;
1249: }
1250:
1251:
1256: public int getIconHeight()
1257: {
1258: return 16;
1259: }
1260:
1261:
1269: public void paintIcon(Component c, Graphics g, int x, int y)
1270: {
1271: g.setColor(new Color(102, 102, 153));
1272: g.fillRect(x + 1, y, 14, 2);
1273: g.fillRect(x, y + 1, 2, 14);
1274: g.fillRect(x + 1, y + 14, 14, 2);
1275: g.fillRect(x + 14, y + 1, 2, 14);
1276: g.drawLine(x + 2, y + 5, x + 14, y + 5);
1277:
1278: g.setColor(new Color(204, 204, 255));
1279: g.fillRect(x + 2, y + 2, 12, 3);
1280:
1281: g.setColor(new Color(102, 102, 153));
1282: g.drawLine(x + 3, y + 3, x + 3, y + 3);
1283: g.drawLine(x + 6, y + 3, x + 6, y + 3);
1284: g.drawLine(x + 9, y + 3, x + 9, y + 3);
1285: g.drawLine(x + 12, y + 3, x + 12, y + 3);
1286:
1287: g.setColor(Color.white);
1288: g.fillRect(x + 2, y + 6, 12, 8);
1289: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1290: g.drawLine(x + 5, y + 2, x + 5, y + 2);
1291: g.drawLine(x + 8, y + 2, x + 8, y + 2);
1292: g.drawLine(x + 11, y + 2, x + 11, y + 2);
1293: }
1294: }
1295:
1296:
1301: private static class InternalFrameAltMaximizeIcon
1302: implements Icon, UIResource, Serializable
1303: {
1304:
1305: private int size;
1306:
1307:
1312: public InternalFrameAltMaximizeIcon(int size)
1313: {
1314: this.size = size;
1315: }
1316:
1317:
1322: public int getIconWidth()
1323: {
1324: return size;
1325: }
1326:
1327:
1332: public int getIconHeight()
1333: {
1334: return size;
1335: }
1336:
1337:
1345: public void paintIcon(Component c, Graphics g, int x, int y)
1346: {
1347: Color savedColor = g.getColor();
1348:
1349: AbstractButton b = (AbstractButton) c;
1350:
1351:
1352: if (b.getModel().isPressed())
1353: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1354: else
1355: g.setColor(MetalLookAndFeel.getPrimaryControl());
1356: g.fillRect(x + 2, y + 6, 7, 7);
1357:
1358:
1359: if (b.getModel().isPressed())
1360: g.setColor(MetalLookAndFeel.getBlack());
1361: else
1362: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1363:
1364: g.drawLine(x + 12, y + 1, x + 13, y + 1);
1365: g.drawLine(x + 11, y + 2, x + 12, y + 2);
1366: g.drawLine(x + 10, y + 3, x + 11, y + 3);
1367: g.drawLine(x + 8, y + 2, x + 8, y + 3);
1368: g.fillRect(x + 8, y + 4, 3, 3);
1369: g.drawLine(x + 11, y + 6, x + 12, y + 6);
1370:
1371: g.drawLine(x + 1, y + 5, x + 5, y + 5);
1372: g.drawLine(x + 1, y + 6, x + 1, y + 12);
1373: g.drawLine(x + 9, y + 9, x + 9, y + 12);
1374: g.drawLine(x + 1, y + 13, x + 9, y + 13);
1375:
1376: g.drawLine(x + 2, y + 12, x + 2, y + 12);
1377:
1378: g.setColor(MetalLookAndFeel.getBlack());
1379: g.drawLine(x + 12, y, x + 9, y + 3);
1380: g.drawLine(x + 7, y + 1, x + 8, y + 1);
1381: g.drawLine(x + 7, y + 2, x + 7, y + 6);
1382: g.drawLine(x + 11, y + 5, x + 12, y + 5);
1383: g.drawLine(x, y + 4, x + 5, y + 4);
1384: g.drawLine(x, y + 5, x, y + 13);
1385: g.drawLine(x + 3, y + 12, x + 8, y + 12);
1386: g.drawLine(x + 8, y + 8, x + 8, y + 11);
1387: g.drawLine(x + 9, y + 8, x + 9, y + 8);
1388:
1389: g.setColor(MetalLookAndFeel.getWhite());
1390: g.drawLine(x + 9, y + 2, x + 9, y + 2);
1391: g.drawLine(x + 11, y + 4, x + 13, y + 2);
1392: g.drawLine(x + 13, y + 6, x + 13, y + 6);
1393: g.drawLine(x + 8, y + 7, x + 13, y + 7);
1394: g.drawLine(x + 6, y + 5, x + 6, y + 5);
1395: g.drawLine(x + 10, y + 8, x + 10, y + 13);
1396: g.drawLine(x + 1, y + 14, x + 10, y + 14);
1397:
1398: if (!b.getModel().isPressed())
1399: {
1400: g.drawLine(x + 2, y + 6, x + 6, y + 6);
1401: g.drawLine(x + 2, y + 6, x + 2, y + 11);
1402: }
1403:
1404: g.setColor(savedColor);
1405: }
1406: }
1407:
1408:
1412: private static class InternalFrameMaximizeIcon
1413: implements Icon, UIResource, Serializable
1414: {
1415:
1416:
1419: public InternalFrameMaximizeIcon()
1420: {
1421:
1422: }
1423:
1424:
1429: public int getIconWidth()
1430: {
1431: return 16;
1432: }
1433:
1434:
1439: public int getIconHeight()
1440: {
1441: return 16;
1442: }
1443:
1444:
1452: public void paintIcon(Component c, Graphics g, int x, int y)
1453: {
1454: Color savedColor = g.getColor();
1455:
1456: AbstractButton b = (AbstractButton) c;
1457:
1458:
1459: if (b.getModel().isPressed())
1460: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1461: else
1462: g.setColor(MetalLookAndFeel.getPrimaryControl());
1463: g.fillRect(x + 2, y + 6, 7, 7);
1464:
1465: if (b.getModel().isPressed())
1466: g.setColor(MetalLookAndFeel.getBlack());
1467: else
1468: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1469:
1470: g.drawLine(x + 9, y + 1, x + 10, y + 1);
1471: g.fillRect(x + 11, y + 1, 3, 3);
1472: g.fillRect(x + 12, y + 4, 2, 2);
1473: g.drawLine(x + 10, y + 3, x + 10, y + 3);
1474: g.drawLine(x + 9, y + 4, x + 10, y + 4);
1475: g.drawLine(x + 1, y + 5, x + 9, y + 5);
1476: g.drawLine(x + 1, y + 6, x + 1, y + 12);
1477: g.drawLine(x + 9, y + 6, x + 9, y + 12);
1478: g.drawLine(x + 1, y + 13, x + 9, y + 13);
1479:
1480:
1481: g.drawLine(x + 7, y + 6, x + 8, y + 6);
1482: g.drawLine(x + 6, y + 7, x + 8, y + 7);
1483: g.drawLine(x + 5, y + 8, x + 6, y + 8);
1484: g.drawLine(x + 4, y + 9, x + 5, y + 9);
1485: g.drawLine(x + 3, y + 10, x + 4, y + 10);
1486: g.drawLine(x + 2, y + 11, x + 3, y + 11);
1487: g.drawLine(x + 2, y + 12, x + 4, y + 12);
1488: g.drawLine(x + 8, y + 8, x + 8, y + 8);
1489:
1490:
1491: g.setColor(MetalLookAndFeel.getBlack());
1492: g.drawLine(x + 8, y, x + 13, y);
1493: g.drawLine(x + 8, y + 1, x + 8, y + 1);
1494: g.drawLine(x + 10, y + 2, x + 9, y + 3);
1495: g.drawLine(x, y + 4, x + 8, y + 4);
1496: g.drawLine(x, y + 5, x, y + 13);
1497:
1498: g.drawLine(x + 2, y + 10, x + 6, y + 6);
1499: g.drawLine(x + 8, y + 9, x + 8, y + 11);
1500: g.drawLine(x + 5, y + 12, x + 8, y + 12);
1501:
1502:
1503: g.setColor(MetalLookAndFeel.getWhite());
1504: if (!b.getModel().isPressed())
1505: {
1506: g.drawLine(x + 2, y + 6, x + 5, y + 6);
1507: g.drawLine(x + 2, y + 7, x + 2, y + 9);
1508: g.drawLine(x + 4, y + 11, x + 7, y + 8);
1509: }
1510:
1511: g.drawLine(x + 1, y + 14, x + 10, y + 14);
1512: g.drawLine(x + 10, y + 5, x + 10, y + 13);
1513:
1514: g.drawLine(x + 9, y + 2, x + 9, y + 2);
1515: g.drawLine(x + 11, y + 4, x + 11, y + 5);
1516: g.drawLine(x + 13, y + 6, x + 14, y + 6);
1517: g.drawLine(x + 14, y + 1, x + 14, y + 5);
1518: g.setColor(savedColor);
1519: }
1520: }
1521:
1522:
1525: private static class InternalFrameMinimizeIcon
1526: implements Icon, UIResource, Serializable
1527: {
1528:
1529:
1532: public InternalFrameMinimizeIcon()
1533: {
1534:
1535: }
1536:
1537:
1542: public int getIconWidth()
1543: {
1544: return 16;
1545: }
1546:
1547:
1552: public int getIconHeight()
1553: {
1554: return 16;
1555: }
1556:
1557:
1565: public void paintIcon(Component c, Graphics g, int x, int y)
1566: {
1567: Color savedColor = g.getColor();
1568:
1569: AbstractButton b = (AbstractButton) c;
1570:
1571: if (b.getModel().isPressed())
1572: g.setColor(MetalLookAndFeel.getBlack());
1573: else
1574:
1575:
1576: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1577:
1578: g.drawLine(x + 12, y + 1, x + 13, y + 1);
1579: g.drawLine(x + 11, y + 2, x + 12, y + 2);
1580: g.drawLine(x + 10, y + 3, x + 11, y + 3);
1581: g.drawLine(x + 8, y + 2, x + 8, y + 3);
1582: g.fillRect(x + 8, y + 4, 3, 3);
1583: g.drawLine(x + 11, y + 6, x + 12, y + 6);
1584:
1585: g.drawLine(x + 1, y + 8, x + 6, y + 8);
1586: g.drawLine(x + 1, y + 9, x + 1, y + 12);
1587: g.drawLine(x + 6, y + 9, x + 6, y + 12);
1588: g.drawLine(x + 1, y + 13, x + 6, y + 13);
1589:
1590: g.drawLine(x + 5, y + 9, x + 5, y + 9);
1591: g.drawLine(x + 2, y + 12, x + 2, y + 12);
1592:
1593: g.setColor(MetalLookAndFeel.getBlack());
1594: g.drawLine(x + 12, y, x + 9, y + 3);
1595: g.drawLine(x + 7, y + 1, x + 8, y + 1);
1596: g.drawLine(x + 7, y + 2, x + 7, y + 6);
1597: g.drawLine(x, y + 7, x + 6, y + 7);
1598: g.drawLine(x, y + 8, x, y + 13);
1599: g.drawLine(x + 3, y + 12, x + 5, y + 12);
1600: g.drawLine(x + 5, y + 10, x + 5, y + 11);
1601: g.drawLine(x + 11, y + 5, x + 12, y + 5);
1602:
1603: g.setColor(MetalLookAndFeel.getWhite());
1604: g.drawLine(x + 9, y + 2, x + 9, y + 2);
1605: g.drawLine(x + 11, y + 4, x + 13, y + 2);
1606: g.drawLine(x + 13, y + 6, x + 13, y + 6);
1607: g.drawLine(x + 8, y + 7, x + 13, y + 7);
1608: g.drawLine(x + 7, y + 9, x + 7, y + 13);
1609: g.drawLine(x + 1, y + 14, x + 7, y + 14);
1610:
1611: if (b.getModel().isPressed())
1612: {
1613: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1614: g.fillRect(x + 2, y + 9, 3, 3);
1615: }
1616: else
1617: {
1618: g.drawLine(x + 2, y + 9, x + 4, y + 9);
1619: g.drawLine(x + 2, y + 10, x + 2, y + 11);
1620: }
1621:
1622: g.setColor(savedColor);
1623: }
1624: }
1625:
1626:
1630: private static class VerticalSliderThumbIcon
1631: implements Icon, UIResource, Serializable
1632: {
1633:
1636: int[][] gradientMask = new int[][] { {0, 12}, {0, 12}, {0, 12}, {0, 12},
1637: {0, 12}, {0, 12}, {0, 12}, {1, 11},
1638: {2, 10}, {3, 9}, {4, 8}, {5, 7},
1639: {6, 6}};
1640:
1641:
1644: public VerticalSliderThumbIcon()
1645: {
1646:
1647: }
1648:
1649:
1654: public int getIconWidth()
1655: {
1656: return 16;
1657: }
1658:
1659:
1664: public int getIconHeight()
1665: {
1666: return 15;
1667: }
1668:
1669:
1679: public void paintIcon(Component c, Graphics g, int x, int y)
1680: {
1681: boolean enabled = false;
1682: boolean focus = false;
1683: if (c != null)
1684: {
1685: enabled = c.isEnabled();
1686: focus = c.hasFocus();
1687: }
1688:
1689:
1690: if (enabled)
1691: g.setColor(MetalLookAndFeel.getBlack());
1692: else
1693: g.setColor(MetalLookAndFeel.getControlDarkShadow());
1694: g.drawLine(x + 1, y, x + 7, y);
1695: g.drawLine(x + 8, y, x + 15, y + 7);
1696: g.drawLine(x + 14, y + 8, x + 8, y + 14);
1697: g.drawLine(x + 8, y + 14, x + 1, y + 14);
1698: g.drawLine(x, y + 13, x, y + 1);
1699:
1700:
1701: if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme
1702: && enabled)
1703: {
1704: String gradient;
1705: if (focus)
1706: gradient = "Slider.focusGradient";
1707: else
1708: gradient = "Slider.gradient";
1709: MetalUtils.paintGradient(g, x + 2, y + 1, 13, 12,
1710: SwingConstants.HORIZONTAL, gradient,
1711: gradientMask);
1712: }
1713: else
1714: {
1715: if (focus)
1716: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1717: else
1718: g.setColor(MetalLookAndFeel.getControl());
1719: g.fillRect(x + 2, y + 1, 7, 13);
1720: g.drawLine(x + 9, y + 2, x + 9, y + 12);
1721: g.drawLine(x + 10, y + 3, x + 10, y + 11);
1722: g.drawLine(x + 11, y + 4, x + 11, y + 10);
1723: g.drawLine(x + 12, y + 5, x + 12, y + 9);
1724: g.drawLine(x + 13, y + 6, x + 13, y + 8);
1725: g.drawLine(x + 14, y + 7, x + 14, y + 7);
1726: }
1727:
1728:
1729: if (enabled
1730: && ! (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme))
1731: {
1732: if (focus)
1733: g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1734: else
1735: g.setColor(MetalLookAndFeel.getBlack());
1736: g.drawLine(x + 3, y + 3, x + 3, y + 3);
1737: g.drawLine(x + 3, y + 7, x + 3, y + 7);
1738: g.drawLine(x + 3, y + 11, x + 3, y + 11);
1739:
1740: g.drawLine(x + 5, y + 5, x + 5, y + 5);
1741: g.drawLine(x + 5, y + 9, x + 5, y + 9);
1742:
1743: g.drawLine(x + 7, y + 3, x + 7, y + 3);
1744: g.drawLine(x + 7, y + 7, x + 7, y + 7);
1745: g.drawLine(x + 7, y + 11, x + 7, y + 11);
1746:
1747:
1748: if (focus)
1749: g.setColor(MetalLookAndFeel.getPrimaryControl());
1750: else
1751: g.setColor(MetalLookAndFeel.getWhite());
1752: g.drawLine(x + 1, y + 1, x + 8, y + 1);
1753: g.drawLine(x + 1, y + 2, x + 1, y + 13);
1754: g.drawLine(x + 2, y + 2, x + 2, y + 2);
1755: g.drawLine(x + 2, y + 6, x + 2, y + 6);
1756: g.drawLine(x + 2, y + 10, x + 2, y + 10);
1757:
1758: g.drawLine(x + 4, y + 4, x + 4, y + 4);
1759: g.drawLine(x + 4, y + 8, x + 4, y + 8);
1760:
1761: g.drawLine(x + 6, y + 2, x + 6, y + 2);
1762: g.drawLine(x + 6, y + 6, x + 6, y + 6);
1763: g.drawLine(x + 6, y + 10, x + 6, y + 10);
1764:
1765: }
1766: }
1767: }
1768:
1769:
1773: public static class TreeControlIcon implements Icon, Serializable
1774: {
1775:
1776:
1777: protected boolean isLight;
1778:
1779:
1780: private boolean collapsed;
1781:
1782:
1788: public TreeControlIcon(boolean isCollapsed)
1789: {
1790: collapsed = isCollapsed;
1791: }
1792:
1793:
1798: public int getIconWidth()
1799: {
1800: return 18;
1801: }
1802:
1807: public int getIconHeight()
1808: {
1809: return 18;
1810: }
1811:
1812:
1820: public void paintIcon(Component c, Graphics g, int x, int y)
1821: {
1822:
1823: Color dark = new Color(99, 130, 191);
1824: Color light = new Color(163, 184, 204);
1825: Color white = Color.white;
1826:
1827: x += 8;
1828: y += 6;
1829:
1830: final int w = 6;
1831: final int wHalf = (w >> 2);
1832: g.setColor(light);
1833: g.drawOval(x, y, w, w);
1834: g.setColor(dark);
1835: g.fillOval(x + 1, y + 1, w - 1, w - 1);
1836:
1837: if (collapsed)
1838: g.fillRect(x + w, y + wHalf + 1, w, 2);
1839: else
1840: g.fillRect(x + wHalf + 1, y + w, 2, w);
1841:
1842: g.setColor(white);
1843: g.fillRect(x + wHalf + 1, y + wHalf + 1, 2, 2);
1844:
1845: }
1846:
1847:
1855: public void paintMe(Component c, Graphics g, int x, int y)
1856: {
1857: paintIcon(c, g, x, y);
1858: }
1859: }
1860:
1861:
1864: public static class TreeFolderIcon extends FolderIcon16
1865: {
1866:
1869: public TreeFolderIcon()
1870: {
1871:
1872: }
1873:
1874:
1880: public int getAdditionalHeight()
1881: {
1882: return 2;
1883: }
1884:
1885:
1890: public int getShift()
1891: {
1892: return -1;
1893: }
1894: }
1895:
1896:
1899: public static class TreeLeafIcon extends FileIcon16
1900: {
1901:
1904: public TreeLeafIcon()
1905: {
1906:
1907: }
1908:
1909:
1915: public int getAdditionalHeight()
1916: {
1917: return 4;
1918: }
1919:
1920:
1925: public int getShift()
1926: {
1927: return 2;
1928: }
1929: }
1930:
1931:
1936: private static class TreeHardDriveIcon
1937: implements Icon, UIResource, Serializable
1938: {
1939:
1940:
1943: public TreeHardDriveIcon()
1944: {
1945:
1946: }
1947:
1948:
1953: public int getIconWidth()
1954: {
1955: return 16;
1956: }
1957:
1958:
1963: public int getIconHeight()
1964: {
1965: return 16;
1966: }
1967:
1968:
1977: public void paintIcon(Component c, Graphics g, int x, int y)
1978: {
1979: Color saved = g.getColor();
1980: g.setColor(MetalLookAndFeel.getBlack());
1981: g.drawLine(x + 1, y + 4, x + 1, y + 5);
1982: g.drawLine(x + 14, y + 4, x + 14, y + 5);
1983: g.drawLine(x + 1, y + 7, x + 1, y + 8);
1984: g.drawLine(x + 14, y + 7, x + 14, y + 8);
1985: g.drawLine(x + 1, y + 10, x + 1, y + 11);
1986: g.drawLine(x + 14, y + 10, x + 14, y + 11);
1987:
1988: g.drawLine(x + 2, y + 3, x + 3, y + 3);
1989: g.drawLine(x + 12, y + 3, x + 13, y + 3);
1990: g.drawLine(x + 2, y + 6, x + 3, y + 6);
1991: g.drawLine(x + 12, y + 6, x + 13, y + 6);
1992: g.drawLine(x + 2, y + 9, x + 3, y + 9);
1993: g.drawLine(x + 12, y + 9, x + 13, y + 9);
1994: g.drawLine(x + 2, y + 12, x + 3, y + 12);
1995: g.drawLine(x + 12, y + 12, x + 13, y + 12);
1996:
1997: g.drawLine(x + 4, y + 2, x + 11, y + 2);
1998: g.drawLine(x + 4, y + 7, x + 11, y + 7);
1999: g.drawLine(x + 4, y + 10, x + 11, y + 10);
2000: g.drawLine(x + 4, y + 13, x + 11, y + 13);
2001:
2002: g.setColor(MetalLookAndFeel.getWhite());
2003: g.fillRect(x + 4, y + 3, 2, 2);
2004: g.drawLine(x + 6, y + 4, x + 6, y + 4);
2005: g.drawLine(x + 7, y + 3, x + 9, y + 3);
2006: g.drawLine(x + 8, y + 4, x + 8, y + 4);
2007: g.drawLine(x + 11, y + 3, x + 11, y + 3);
2008: g.fillRect(x + 2, y + 4, 2, 2);
2009: g.fillRect(x + 2, y + 7, 2, 2);
2010: g.fillRect(x + 2, y + 10, 2, 2);
2011: g.drawLine(x + 4, y + 6, x + 4, y + 6);
2012: g.drawLine(x + 4, y + 9, x + 4, y + 9);
2013: g.drawLine(x + 4, y + 12, x + 4, y + 12);
2014:
2015: g.setColor(MetalLookAndFeel.getControlShadow());
2016: g.drawLine(x + 13, y + 4, x + 13, y + 4);
2017: g.drawLine(x + 12, y + 5, x + 13, y + 5);
2018: g.drawLine(x + 13, y + 7, x + 13, y + 7);
2019: g.drawLine(x + 12, y + 8, x + 13, y + 8);
2020: g.drawLine(x + 13, y + 10, x + 13, y + 10);
2021: g.drawLine(x + 12, y + 11, x + 13, y + 11);
2022:
2023: g.drawLine(x + 10, y + 5, x + 10, y + 5);
2024: g.drawLine(x + 7, y + 6, x + 7, y + 6);
2025: g.drawLine(x + 9, y + 6, x + 9, y + 6);
2026: g.drawLine(x + 11, y + 6, x + 11, y + 6);
2027:
2028: g.drawLine(x + 10, y + 8, x + 10, y + 8);
2029: g.drawLine(x + 7, y + 9, x + 7, y + 9);
2030: g.drawLine(x + 9, y + 9, x + 9, y + 9);
2031: g.drawLine(x + 11, y + 9, x + 11, y + 9);
2032:
2033: g.drawLine(x + 10, y + 11, x + 10, y + 11);
2034: g.drawLine(x + 7, y + 12, x + 7, y + 12);
2035: g.drawLine(x + 9, y + 12, x + 9, y + 12);
2036: g.drawLine(x + 11, y + 12, x + 11, y + 12);
2037:
2038: g.setColor(saved);
2039: }
2040: }
2041:
2042:
2047: private static class TreeFloppyDriveIcon
2048: implements Icon, UIResource, Serializable
2049: {
2050:
2051:
2054: public TreeFloppyDriveIcon()
2055: {
2056:
2057: }
2058:
2059:
2064: public int getIconWidth()
2065: {
2066: return 16;
2067: }
2068:
2069:
2074: public int getIconHeight()
2075: {
2076: return 16;
2077: }
2078:
2079:
2088: public void paintIcon(Component c, Graphics g, int x, int y)
2089: {
2090: Color saved = g.getColor();
2091:
2092: g.setColor(MetalLookAndFeel.getBlack());
2093: g.drawLine(x + 1, y + 1, x + 13, y + 1);
2094: g.drawLine(x + 1, y + 1, x + 1, y + 14);
2095: g.drawLine(x + 1, y + 14, x + 14, y + 14);
2096: g.drawLine(x + 14, y + 2, x + 14, y + 14);
2097:
2098: g.setColor(MetalLookAndFeel.getPrimaryControl());
2099: g.fillRect(x + 2, y + 2, 12, 12);
2100:
2101: g.setColor(MetalLookAndFeel.getControlShadow());
2102: g.fillRect(x + 5, y + 2, 6, 5);
2103: g.drawLine(x + 4, y + 8, x + 11, y + 8);
2104: g.drawLine(x + 3, y + 9, x + 3, y + 13);
2105: g.drawLine(x + 12, y + 9, x + 12, y + 13);
2106:
2107: g.setColor(MetalLookAndFeel.getWhite());
2108: g.fillRect(x + 8, y + 3, 2, 3);
2109: g.fillRect(x + 4, y + 9, 8, 5);
2110:
2111: g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
2112: g.drawLine(x + 5, y + 10, x + 9, y + 10);
2113: g.drawLine(x + 5, y + 12, x + 8, y + 12);
2114:
2115: g.setColor(saved);
2116: }
2117: }
2118:
2119:
2124: private static class TreeComputerIcon
2125: implements Icon, UIResource, Serializable
2126: {
2127:
2128:
2131: public TreeComputerIcon()
2132: {
2133:
2134: }
2135:
2136:
2141: public int getIconWidth()
2142: {
2143: return 16;
2144: }
2145:
2146:
2151: public int getIconHeight()
2152: {
2153: return 16;
2154: }
2155:
2156:
2165: public void paintIcon(Component c, Graphics g, int x, int y)
2166: {
2167: Color saved = g.getColor();
2168:
2169: g.setColor(MetalLookAndFeel.getBlack());
2170: g.drawLine(x + 3, y + 1, x + 12, y + 1);
2171: g.drawLine(x + 2, y + 2, x + 2, y + 8);
2172: g.drawLine(x + 13, y + 2, x + 13, y + 8);
2173: g.drawLine(x + 3, y + 9, x + 3, y + 9);
2174: g.drawLine(x + 12, y + 9, x + 12, y + 9);
2175: g.drawRect(x + 1, y + 10, 13, 4);
2176: g.drawLine(x + 5, y + 3, x + 10, y + 3);
2177: g.drawLine(x + 5, y + 8, x + 10, y + 8);
2178: g.drawLine(x + 4, y + 4, x + 4, y + 7);
2179: g.drawLine(x + 11, y + 4, x + 11, y + 7);
2180:
2181: g.setColor(MetalLookAndFeel.getPrimaryControl());
2182: g.fillRect(x + 5, y + 4, 6, 4);
2183:
2184: g.setColor(MetalLookAndFeel.getControlShadow());
2185: g.drawLine(x + 6, y + 12, x + 8, y + 12);
2186: g.drawLine(x + 10, y + 12, x + 12, y + 12);
2187: g.setColor(saved);
2188: }
2189: }
2190:
2191:
2192: private static Icon checkBoxIcon;
2193:
2194:
2195: private static Icon checkBoxMenuItemIcon;
2196:
2197:
2198: private static Icon fileChooserDetailViewIcon;
2199:
2200:
2201: private static Icon fileChooserHomeFolderIcon;
2202:
2203:
2204: private static Icon fileChooserListViewIcon;
2205:
2206:
2207: private static Icon fileChooserNewFolderIcon;
2208:
2209:
2210: private static Icon fileChooserUpFolderIcon;
2211:
2212:
2213: private static RadioButtonIcon radioButtonIcon;
2214:
2215:
2216: private static Icon radioButtonMenuItemIcon;
2217:
2218:
2219: private static Icon internalFrameDefaultMenuIcon;
2220:
2221:
2222: private static Icon treeComputerIcon;
2223:
2224:
2225: private static Icon treeFloppyDriveIcon;
2226:
2227:
2228: private static Icon treeHardDriveIcon;
2229:
2230:
2231: private static Icon horizontalSliderThumbIcon;
2232:
2233:
2234: private static Icon verticalSliderThumbIcon;
2235:
2236:
2240: public MetalIconFactory()
2241: {
2242:
2243: }
2244:
2245:
2252: public static Icon getCheckBoxIcon()
2253: {
2254: if (checkBoxIcon == null)
2255: checkBoxIcon = new MetalCheckBoxIcon();
2256: return checkBoxIcon;
2257: }
2258:
2259:
2265: public static Icon getCheckBoxMenuItemIcon()
2266: {
2267: if (checkBoxMenuItemIcon == null)
2268: checkBoxMenuItemIcon = new CheckBoxMenuItemIcon();
2269: return checkBoxMenuItemIcon;
2270: }
2271:
2272:
2277: public static Icon getFileChooserDetailViewIcon()
2278: {
2279: if (fileChooserDetailViewIcon == null)
2280: fileChooserDetailViewIcon = new FileChooserDetailViewIcon();
2281: return fileChooserDetailViewIcon;
2282: }
2283:
2284:
2289: public static Icon getFileChooserHomeFolderIcon()
2290: {
2291: if (fileChooserHomeFolderIcon == null)
2292: fileChooserHomeFolderIcon = new FileChooserHomeFolderIcon();
2293: return fileChooserHomeFolderIcon;
2294: }
2295:
2296:
2301: public static Icon getFileChooserListViewIcon()
2302: {
2303: if (fileChooserListViewIcon == null)
2304: fileChooserListViewIcon = new FileChooserListViewIcon();
2305: return fileChooserListViewIcon;
2306: }
2307:
2308:
2313: public static Icon getFileChooserNewFolderIcon()
2314: {
2315: if (fileChooserNewFolderIcon == null)
2316: fileChooserNewFolderIcon = new FileChooserNewFolderIcon();
2317: return fileChooserNewFolderIcon;
2318: }
2319:
2320:
2325: public static Icon getFileChooserUpFolderIcon()
2326: {
2327: if (fileChooserUpFolderIcon == null)
2328: fileChooserUpFolderIcon = new FileChooserUpFolderIcon();
2329: return fileChooserUpFolderIcon;
2330: }
2331:
2332:
2337: public static Icon getRadioButtonIcon()
2338: {
2339: if (radioButtonIcon == null)
2340: radioButtonIcon = new RadioButtonIcon();
2341: return radioButtonIcon;
2342: }
2343:
2344:
2349: public static Icon getRadioButtonMenuItemIcon()
2350: {
2351: if (radioButtonMenuItemIcon == null)
2352: radioButtonMenuItemIcon = new RadioButtonMenuItemIcon();
2353: return radioButtonMenuItemIcon;
2354: }
2355:
2356:
2362: public static Icon getHorizontalSliderThumbIcon()
2363: {
2364: if (horizontalSliderThumbIcon == null)
2365: horizontalSliderThumbIcon = new HorizontalSliderThumbIcon();
2366: return horizontalSliderThumbIcon;
2367: }
2368:
2369:
2377: public static Icon getInternalFrameCloseIcon(int size)
2378: {
2379: return new InternalFrameCloseIcon(size);
2380: }
2381:
2382:
2388: public static Icon getInternalFrameDefaultMenuIcon()
2389: {
2390: if (internalFrameDefaultMenuIcon == null)
2391: internalFrameDefaultMenuIcon = new InternalFrameDefaultMenuIcon();
2392: return internalFrameDefaultMenuIcon;
2393: }
2394:
2395:
2404: public static Icon getInternalFrameMaximizeIcon(int size)
2405: {
2406: return new InternalFrameMaximizeIcon();
2407: }
2408:
2409:
2417: public static Icon getInternalFrameMinimizeIcon(int size)
2418: {
2419: return new InternalFrameMinimizeIcon();
2420: }
2421:
2422:
2432: public static Icon getInternalFrameAltMaximizeIcon(int size)
2433: {
2434: return new InternalFrameAltMaximizeIcon(size);
2435: }
2436:
2437:
2443: public static Icon getVerticalSliderThumbIcon()
2444: {
2445: if (verticalSliderThumbIcon == null)
2446: verticalSliderThumbIcon = new VerticalSliderThumbIcon();
2447: return verticalSliderThumbIcon;
2448: }
2449:
2450:
2455: public static Icon getTreeFolderIcon()
2456: {
2457: return new TreeFolderIcon();
2458: }
2459:
2460:
2465: public static Icon getTreeLeafIcon()
2466: {
2467: return new TreeLeafIcon();
2468: }
2469:
2470:
2478: public static Icon getTreeControlIcon(boolean isCollapsed)
2479: {
2480: return new TreeControlIcon(isCollapsed);
2481: }
2482:
2483:
2488: public static Icon getTreeComputerIcon()
2489: {
2490: if (treeComputerIcon == null)
2491: treeComputerIcon = new TreeComputerIcon();
2492: return treeComputerIcon;
2493: }
2494:
2495:
2500: public static Icon getTreeFloppyDriveIcon()
2501: {
2502: if (treeFloppyDriveIcon == null)
2503: treeFloppyDriveIcon = new TreeFloppyDriveIcon();
2504: return treeFloppyDriveIcon;
2505: }
2506:
2507:
2512: public static Icon getTreeHardDriveIcon()
2513: {
2514: if (treeHardDriveIcon == null)
2515: treeHardDriveIcon = new TreeHardDriveIcon();
2516: return treeHardDriveIcon;
2517: }
2518:
2519:
2526: public static Icon getMenuArrowIcon()
2527: {
2528: if (menuArrow == null)
2529: menuArrow = new Icon()
2530: {
2531: public int getIconHeight()
2532: {
2533: return 8;
2534: }
2535:
2536: public int getIconWidth()
2537: {
2538: return 4;
2539: }
2540:
2541: public void paintIcon(Component c, Graphics g, int x, int y)
2542: {
2543: Color saved = g.getColor();
2544: g.setColor(Color.BLACK);
2545: for (int i = 0; i < 4; i++)
2546: g.drawLine(x + i, y + i, x + i, y + 7 - i);
2547: g.setColor(saved);
2548: }
2549: };
2550: return menuArrow;
2551: }
2552:
2553:
2559: public static Icon getMenuItemArrowIcon()
2560: {
2561: if (menuItemArrow == null)
2562: menuItemArrow = new Icon()
2563: {
2564: public int getIconHeight()
2565: {
2566: return 8;
2567: }
2568:
2569: public int getIconWidth()
2570: {
2571: return 4;
2572: }
2573:
2574: public void paintIcon(Component c, Graphics g, int x, int y)
2575: {
2576: Color saved = g.getColor();
2577: g.setColor(Color.BLACK);
2578: for (int i = 0; i < 4; i++)
2579: g.drawLine(x + i, y + i, x + i, y + 7 - i);
2580: g.setColor(saved);
2581: }
2582: };
2583: return menuItemArrow;
2584: }
2585:
2586:
2591: public static Icon getMenuItemCheckIcon()
2592: {
2593: return new Icon()
2594: {
2595: public int getIconHeight()
2596: {
2597: return 13;
2598: }
2599:
2600: public int getIconWidth()
2601: {
2602: return 13;
2603: }
2604:
2605: public void paintIcon(Component c, Graphics g, int x, int y)
2606: {
2607: Color saved = g.getColor();
2608: g.setColor(Color.BLACK);
2609: g.drawLine(3 + x, 5 + y, 3 + x, 9 + y);
2610: g.drawLine(4 + x, 5 + y, 4 + x, 9 + y);
2611: g.drawLine(5 + x, 7 + y, 9 + x, 3 + y);
2612: g.drawLine(5 + x, 8 + y, 9 + x, 4 + y);
2613: g.setColor(saved);
2614: }
2615: };
2616: }
2617: }