/[classpath]/classpath/javax/swing/plaf/metal/MetalIconFactory.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/metal/MetalIconFactory.java

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

revision 1.11 by trebligd, Thu Sep 8 14:57:06 2005 UTC revision 1.12 by trebligd, Sat Sep 10 21:06:24 2005 UTC
# Line 43  import java.awt.Component; Line 43  import java.awt.Component;
43  import java.awt.Graphics;  import java.awt.Graphics;
44  import java.io.Serializable;  import java.io.Serializable;
45    
46    import javax.swing.AbstractButton;
47  import javax.swing.Icon;  import javax.swing.Icon;
48  import javax.swing.JCheckBox;  import javax.swing.JCheckBox;
49  import javax.swing.JCheckBoxMenuItem;  import javax.swing.JCheckBoxMenuItem;
# Line 662  public class MetalIconFactory implements Line 663  public class MetalIconFactory implements
663      }      }
664                    
665    }    }
666      
667      /**
668       * An icon used by the {@link MetalInternalFrameUI} class when the frame
669       * is displayed as a palette.
670       *
671       * @since 1.3
672       */
673      public static class PaletteCloseIcon implements Icon, Serializable
674      {
675        /**
676         * Returns the width of the icon, in pixels.
677         *
678         * @return The width of the icon.
679         */
680        public int getIconWidth()
681        {
682          return 7;
683        }
684        
685        /**
686         * Returns the height of the icon, in pixels.
687         *
688         * @return The height of the icon.
689         */
690        public int getIconHeight()
691        {
692          return 7;
693        }
694        
695        /**
696         * Paints the icon using colors from the {@link MetalLookAndFeel}.
697         *
698         * @param c  the component (ignored).
699         * @param g  the graphics device.
700         * @param x  the x-coordinate for the top-left of the icon.
701         * @param y  the y-coordinate for the top-left of the icon.
702         */
703        public void paintIcon(Component c, Graphics g, int x, int y)
704        {
705          Color savedColor = g.getColor();
706          AbstractButton button = (AbstractButton) c;
707          if (button.getModel().isPressed())
708            g.setColor(MetalLookAndFeel.getBlack());
709          else
710            g.setColor(MetalLookAndFeel.getControlDarkShadow());
711          g.fillRect(x + 2, y + 2, 3, 3);
712          g.drawLine(x + 1, y, x + 1, y + 2);
713          g.drawLine(x, y + 1, x + 2, y + 1);
714          g.drawLine(x + 5, y, x + 5, y + 2);
715          g.drawLine(x + 4, y + 1, x + 6, y + 1);
716          g.drawLine(x + 1, y + 4, x + 1, y + 6);
717          g.drawLine(x, y + 5, x + 2, y + 5);
718          g.drawLine(x + 5, y + 4, x + 5, y + 6);
719          g.drawLine(x + 4, y + 5, x + 6, y + 5);
720          g.setColor(MetalLookAndFeel.getControlHighlight());
721          g.drawLine(x + 2, y + 6, x + 3, y + 5);
722          g.drawLine(x + 5, y + 3, x + 6, y + 2);
723          g.drawLine(x + 6, y + 6, x + 6, y + 6);
724          g.setColor(savedColor);
725        }        
726      }
727      
728    /**    /**
729     * An {@link Icon} implementation for {@link JCheckBox}es in the     * An {@link Icon} implementation for {@link JCheckBox}es in the
730     * Metal Look & Feel.     * Metal Look & Feel.

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

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