equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
49 * |
49 * |
50 * @author David Kloba |
50 * @author David Kloba |
51 * @author Georges Saab |
51 * @author Georges Saab |
52 * @author Rich Schiavi |
52 * @author Rich Schiavi |
53 */ |
53 */ |
|
54 @SuppressWarnings("serial") // Same-version serialization only |
54 public class WindowsIconFactory implements Serializable |
55 public class WindowsIconFactory implements Serializable |
55 { |
56 { |
56 private static Icon frame_closeIcon; |
57 private static Icon frame_closeIcon; |
57 private static Icon frame_iconifyIcon; |
58 private static Icon frame_iconifyIcon; |
58 private static Icon frame_maxIcon; |
59 private static Icon frame_maxIcon; |
158 frame_resizeIcon = new ResizeIcon(); |
159 frame_resizeIcon = new ResizeIcon(); |
159 return frame_resizeIcon; |
160 return frame_resizeIcon; |
160 } |
161 } |
161 |
162 |
162 |
163 |
|
164 @SuppressWarnings("serial") // Same-version serialization only |
163 private static class FrameButtonIcon implements Icon, Serializable { |
165 private static class FrameButtonIcon implements Icon, Serializable { |
164 private Part part; |
166 private Part part; |
165 |
167 |
166 private FrameButtonIcon(Part part) { |
168 private FrameButtonIcon(Part part) { |
167 this.part = part; |
169 this.part = part; |
294 } |
296 } |
295 } |
297 } |
296 |
298 |
297 |
299 |
298 |
300 |
|
301 @SuppressWarnings("serial") // Same-version serialization only |
299 private static class ResizeIcon implements Icon, Serializable { |
302 private static class ResizeIcon implements Icon, Serializable { |
300 public void paintIcon(Component c, Graphics g, int x, int y) { |
303 public void paintIcon(Component c, Graphics g, int x, int y) { |
301 g.setColor(UIManager.getColor("InternalFrame.resizeIconHighlight")); |
304 g.setColor(UIManager.getColor("InternalFrame.resizeIconHighlight")); |
302 g.drawLine(0, 11, 11, 0); |
305 g.drawLine(0, 11, 11, 0); |
303 g.drawLine(4, 11, 11, 4); |
306 g.drawLine(4, 11, 11, 4); |
313 } |
316 } |
314 public int getIconWidth() { return 13; } |
317 public int getIconWidth() { return 13; } |
315 public int getIconHeight() { return 13; } |
318 public int getIconHeight() { return 13; } |
316 }; |
319 }; |
317 |
320 |
|
321 @SuppressWarnings("serial") // Same-version serialization only |
318 private static class CheckBoxIcon implements Icon, Serializable |
322 private static class CheckBoxIcon implements Icon, Serializable |
319 { |
323 { |
320 final static int csize = 13; |
324 final static int csize = 13; |
321 public void paintIcon(Component c, Graphics g, int x, int y) { |
325 public void paintIcon(Component c, Graphics g, int x, int y) { |
322 JCheckBox cb = (JCheckBox) c; |
326 JCheckBox cb = (JCheckBox) c; |
426 return csize; |
430 return csize; |
427 } |
431 } |
428 } |
432 } |
429 } |
433 } |
430 |
434 |
|
435 @SuppressWarnings("serial") // Same-version serialization only |
431 private static class RadioButtonIcon implements Icon, UIResource, Serializable |
436 private static class RadioButtonIcon implements Icon, UIResource, Serializable |
432 { |
437 { |
433 public void paintIcon(Component c, Graphics g, int x, int y) { |
438 public void paintIcon(Component c, Graphics g, int x, int y) { |
434 AbstractButton b = (AbstractButton) c; |
439 AbstractButton b = (AbstractButton) c; |
435 ButtonModel model = b.getModel(); |
440 ButtonModel model = b.getModel(); |
540 } |
545 } |
541 } |
546 } |
542 } // end class RadioButtonIcon |
547 } // end class RadioButtonIcon |
543 |
548 |
544 |
549 |
|
550 @SuppressWarnings("serial") // Same-version serialization only |
545 private static class CheckBoxMenuItemIcon implements Icon, UIResource, Serializable |
551 private static class CheckBoxMenuItemIcon implements Icon, UIResource, Serializable |
546 { |
552 { |
547 public void paintIcon(Component c, Graphics g, int x, int y) { |
553 public void paintIcon(Component c, Graphics g, int x, int y) { |
548 AbstractButton b = (AbstractButton) c; |
554 AbstractButton b = (AbstractButton) c; |
549 ButtonModel model = b.getModel(); |
555 ButtonModel model = b.getModel(); |
565 public int getIconHeight() { return 9; } |
571 public int getIconHeight() { return 9; } |
566 |
572 |
567 } // End class CheckBoxMenuItemIcon |
573 } // End class CheckBoxMenuItemIcon |
568 |
574 |
569 |
575 |
|
576 @SuppressWarnings("serial") // Same-version serialization only |
570 private static class RadioButtonMenuItemIcon implements Icon, UIResource, Serializable |
577 private static class RadioButtonMenuItemIcon implements Icon, UIResource, Serializable |
571 { |
578 { |
572 public void paintIcon(Component c, Graphics g, int x, int y) { |
579 public void paintIcon(Component c, Graphics g, int x, int y) { |
573 AbstractButton b = (AbstractButton) c; |
580 AbstractButton b = (AbstractButton) c; |
574 ButtonModel model = b.getModel(); |
581 ButtonModel model = b.getModel(); |
581 public int getIconHeight() { return 12; } |
588 public int getIconHeight() { return 12; } |
582 |
589 |
583 } // End class RadioButtonMenuItemIcon |
590 } // End class RadioButtonMenuItemIcon |
584 |
591 |
585 |
592 |
|
593 @SuppressWarnings("serial") // Same-version serialization only |
586 private static class MenuItemCheckIcon implements Icon, UIResource, Serializable{ |
594 private static class MenuItemCheckIcon implements Icon, UIResource, Serializable{ |
587 public void paintIcon(Component c, Graphics g, int x, int y) { |
595 public void paintIcon(Component c, Graphics g, int x, int y) { |
588 /* For debugging: |
596 /* For debugging: |
589 Color oldColor = g.getColor(); |
597 Color oldColor = g.getColor(); |
590 g.setColor(Color.orange); |
598 g.setColor(Color.orange); |
595 public int getIconWidth() { return 9; } |
603 public int getIconWidth() { return 9; } |
596 public int getIconHeight() { return 9; } |
604 public int getIconHeight() { return 9; } |
597 |
605 |
598 } // End class MenuItemCheckIcon |
606 } // End class MenuItemCheckIcon |
599 |
607 |
|
608 @SuppressWarnings("serial") // Same-version serialization only |
600 private static class MenuItemArrowIcon implements Icon, UIResource, Serializable { |
609 private static class MenuItemArrowIcon implements Icon, UIResource, Serializable { |
601 public void paintIcon(Component c, Graphics g, int x, int y) { |
610 public void paintIcon(Component c, Graphics g, int x, int y) { |
602 /* For debugging: |
611 /* For debugging: |
603 Color oldColor = g.getColor(); |
612 Color oldColor = g.getColor(); |
604 g.setColor(Color.green); |
613 g.setColor(Color.green); |
609 public int getIconWidth() { return 4; } |
618 public int getIconWidth() { return 4; } |
610 public int getIconHeight() { return 8; } |
619 public int getIconHeight() { return 8; } |
611 |
620 |
612 } // End class MenuItemArrowIcon |
621 } // End class MenuItemArrowIcon |
613 |
622 |
|
623 @SuppressWarnings("serial") // Same-version serialization only |
614 private static class MenuArrowIcon implements Icon, UIResource, Serializable { |
624 private static class MenuArrowIcon implements Icon, UIResource, Serializable { |
615 public void paintIcon(Component c, Graphics g, int x, int y) { |
625 public void paintIcon(Component c, Graphics g, int x, int y) { |
616 if (WindowsMenuItemUI.isVistaPainting()) { |
626 if (WindowsMenuItemUI.isVistaPainting()) { |
617 XPStyle xp = XPStyle.getXP(); |
627 XPStyle xp = XPStyle.getXP(); |
618 State state = State.NORMAL; |
628 State state = State.NORMAL; |
720 /** |
730 /** |
721 * CheckIcon for JMenuItem, JMenu, JCheckBoxMenuItem and |
731 * CheckIcon for JMenuItem, JMenu, JCheckBoxMenuItem and |
722 * JRadioButtonMenuItem. |
732 * JRadioButtonMenuItem. |
723 * Note: to be used on Vista only. |
733 * Note: to be used on Vista only. |
724 */ |
734 */ |
|
735 @SuppressWarnings("serial") // Same-version serialization only |
725 private static class VistaMenuItemCheckIcon |
736 private static class VistaMenuItemCheckIcon |
726 implements Icon, UIResource, Serializable { |
737 implements Icon, UIResource, Serializable { |
727 |
738 |
728 private final JMenuItem menuItem; |
739 private final JMenuItem menuItem; |
729 private final Class<? extends JMenuItem> type; |
740 private final Class<? extends JMenuItem> type; |