/[classpath]/classpath/javax/swing/plaf/basic/BasicIconFactory.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicIconFactory.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6.2.3 by gnu_andrew, Sun Aug 7 18:34:11 2005 UTC revision 1.6.2.4 by gnu_andrew, Sat Sep 10 15:31:51 2005 UTC
# Line 1  Line 1 
1  /* BasicIconFactory.java --  /* BasicIconFactory.java --
2     Copyright (C) 2002, 2004  Free Software Foundation, Inc.     Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 44  import java.awt.Graphics; Line 44  import java.awt.Graphics;
44  import java.awt.Polygon;  import java.awt.Polygon;
45  import java.io.Serializable;  import java.io.Serializable;
46    
 import javax.swing.AbstractButton;  
47  import javax.swing.Icon;  import javax.swing.Icon;
48  import javax.swing.UIDefaults;  import javax.swing.JCheckBoxMenuItem;
 import javax.swing.UIManager;  
49    
50  /**  /**
51   * STUBBED   * Creates icons for the {@link BasicLookAndFeel}.
52   */   */
53  public class BasicIconFactory implements Serializable  public class BasicIconFactory implements Serializable
54  {  {
# Line 115  public class BasicIconFactory implements Line 113  public class BasicIconFactory implements
113    }    }
114    
115    /**    /**
116       * The icon used for {@link JCheckBoxMenuItem}s in the
117       * {@link BasicLookAndFeel}. This icon has a size of 9x9 pixels.
118       */
119      static class CheckBoxMenuItemIcon
120        implements Icon
121      {
122        /**
123         * Returns the height of the icon in pixels.
124         *
125         * @return the height of the icon
126         */
127        public int getIconHeight()
128        {
129          return 9;
130        }
131    
132        /**
133         * Returns the width of the icon in pixels.
134         *
135         * @return the height of the icon
136         */
137        public int getIconWidth()
138        {
139          return 9;
140        }
141    
142        /**
143         * Paints the icon.
144         *
145         * @param c the component to be painted
146         * @param g the Graphics context to be painted with
147         * @param x the x position of the icon
148         * @param y the y position of the icon
149         */
150        public void paintIcon(Component c, Graphics g, int x, int y)
151        {
152          JCheckBoxMenuItem item = (JCheckBoxMenuItem) c;
153          if (item.isSelected())
154            {
155              // paint the check...
156              g.setColor(Color.black);
157              g.drawLine(x + 1, y + 3, x + 1, y + 4);
158              g.drawLine(x + 2, y + 4, x + 2, y + 5);
159              for (int i = 0; i < 5; i++)
160                g.drawLine(x + 3 + i, y + 5 - i, x + 3 + i, y + 6 - i);    
161            }
162        }
163      }
164    
165      /**
166     * The icon used for RadioButtons in the BasicLookAndFeel. This is an empty     * The icon used for RadioButtons in the BasicLookAndFeel. This is an empty
167     * icon with a size of 13x13 pixels.     * icon with a size of 13x13 pixels.
168     */     */
# Line 253  public class BasicIconFactory implements Line 301  public class BasicIconFactory implements
301      return radioButtonIcon;      return radioButtonIcon;
302    }    }
303    
304      /**
305       * Creates and returns an icon used when rendering {@link JCheckBoxMenuItem}
306       * components.
307       *
308       * @return An icon.
309       */
310    public static Icon getCheckBoxMenuItemIcon()    public static Icon getCheckBoxMenuItemIcon()
311    {    {
312      return getCheckBoxIcon();      return new CheckBoxMenuItemIcon();
313    }    }
314        
315    public static Icon getRadioButtonMenuItemIcon()    public static Icon getRadioButtonMenuItemIcon()

Legend:
Removed from v.1.6.2.3  
changed lines
  Added in v.1.6.2.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26