/[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.15 by trebligd, Fri Sep 16 09:19:02 2005 UTC revision 1.16 by trebligd, Wed Sep 28 10:29:17 2005 UTC
# Line 1868  public class MetalIconFactory implements Line 1868  public class MetalIconFactory implements
1868        return 2;        return 2;
1869      }      }
1870    }    }
1871    
1872      /**
1873       * An icon representing a hard disk.
1874       *
1875       * @see MetalIconFactory#getTreeHardDriveIcon()
1876       */
1877      private static class TreeHardDriveIcon
1878          implements Icon, Serializable
1879      {
1880    
1881        /**
1882         * Creates a new icon instance.
1883         */
1884        public TreeHardDriveIcon()
1885        {
1886        }
1887    
1888        /**
1889         * Returns the width of the icon, in pixels.
1890         *
1891         * @return <code>16</code>.
1892         */
1893        public int getIconWidth()
1894        {
1895          return 16;
1896        }
1897    
1898        /**
1899         * Returns the height of the icon, in pixels.
1900         *
1901         * @return <code>16</code>.
1902         */
1903        public int getIconHeight()  
1904        {
1905          return 16;
1906        }
1907    
1908        /**
1909         * Paints the icon at the specified location, using colors from the
1910         * current theme.
1911         *
1912         * @param c  the component (ignored).
1913         * @param g  the graphics device.
1914         * @param x  the x-coordinate for the top-left of the icon.
1915         * @param y  the y-coordinate for the top-left of the icon.
1916         */
1917        public void paintIcon(Component c, Graphics g, int x, int y)
1918        {
1919          Color saved = g.getColor();
1920          g.setColor(MetalLookAndFeel.getBlack());
1921          g.drawLine(x + 1, y + 4, x + 1, y + 5);
1922          g.drawLine(x + 14, y + 4, x + 14, y + 5);
1923          g.drawLine(x + 1, y + 7, x + 1, y + 8);
1924          g.drawLine(x + 14, y + 7, x + 14, y + 8);
1925          g.drawLine(x + 1, y + 10, x + 1, y + 11);
1926          g.drawLine(x + 14, y + 10, x + 14, y + 11);
1927          
1928          g.drawLine(x + 2, y + 3, x + 3, y + 3);
1929          g.drawLine(x + 12, y + 3, x + 13, y + 3);
1930          g.drawLine(x + 2, y + 6, x + 3, y + 6);
1931          g.drawLine(x + 12, y + 6, x + 13, y + 6);
1932          g.drawLine(x + 2, y + 9, x + 3, y + 9);
1933          g.drawLine(x + 12, y + 9, x + 13, y + 9);
1934          g.drawLine(x + 2, y + 12, x + 3, y + 12);
1935          g.drawLine(x + 12, y + 12, x + 13, y + 12);
1936          
1937          g.drawLine(x + 4, y + 2, x + 11, y + 2);
1938          g.drawLine(x + 4, y + 7, x + 11, y + 7);
1939          g.drawLine(x + 4, y + 10, x + 11, y + 10);
1940          g.drawLine(x + 4, y + 13, x + 11, y + 13);
1941          
1942          g.setColor(MetalLookAndFeel.getWhite());
1943          g.fillRect(x + 4, y + 3, 2, 2);
1944          g.drawLine(x + 6, y + 4, x + 6, y + 4);
1945          g.drawLine(x + 7, y + 3, x + 9, y + 3);
1946          g.drawLine(x + 8, y + 4, x + 8, y + 4);
1947          g.drawLine(x + 11, y + 3, x + 11, y + 3);
1948          g.fillRect(x + 2, y + 4, 2, 2);
1949          g.fillRect(x + 2, y + 7, 2, 2);
1950          g.fillRect(x + 2, y + 10, 2, 2);
1951          g.drawLine(x + 4, y + 6, x + 4, y + 6);
1952          g.drawLine(x + 4, y + 9, x + 4, y + 9);
1953          g.drawLine(x + 4, y + 12, x + 4, y + 12);
1954          
1955          g.setColor(MetalLookAndFeel.getControlShadow());
1956          g.drawLine(x + 13, y + 4, x + 13, y + 4);
1957          g.drawLine(x + 12, y + 5, x + 13, y + 5);
1958          g.drawLine(x + 13, y + 7, x + 13, y + 7);
1959          g.drawLine(x + 12, y + 8, x + 13, y + 8);
1960          g.drawLine(x + 13, y + 10, x + 13, y + 10);
1961          g.drawLine(x + 12, y + 11, x + 13, y + 11);
1962          
1963          g.drawLine(x + 10, y + 5, x + 10, y + 5);
1964          g.drawLine(x + 7, y + 6, x + 7, y + 6);
1965          g.drawLine(x + 9, y + 6, x + 9, y + 6);
1966          g.drawLine(x + 11, y + 6, x + 11, y + 6);
1967    
1968          g.drawLine(x + 10, y + 8, x + 10, y + 8);
1969          g.drawLine(x + 7, y + 9, x + 7, y + 9);
1970          g.drawLine(x + 9, y + 9, x + 9, y + 9);
1971          g.drawLine(x + 11, y + 9, x + 11, y + 9);
1972    
1973          g.drawLine(x + 10, y + 11, x + 10, y + 11);
1974          g.drawLine(x + 7, y + 12, x + 7, y + 12);
1975          g.drawLine(x + 9, y + 12, x + 9, y + 12);
1976          g.drawLine(x + 11, y + 12, x + 11, y + 12);
1977    
1978          g.setColor(saved);
1979        }        
1980      }  
1981      
1982      /**
1983       * An icon representing a floppy disk.
1984       *
1985       * @see MetalIconFactory#getTreeFloppyDriveIcon()
1986       */
1987      private static class TreeFloppyDriveIcon
1988          implements Icon, Serializable
1989      {
1990    
1991        /**
1992         * Creates a new icon instance.
1993         */
1994        public TreeFloppyDriveIcon()
1995        {
1996        }
1997    
1998        /**
1999         * Returns the width of the icon, in pixels.
2000         *
2001         * @return <code>16</code>.
2002         */
2003        public int getIconWidth()
2004        {
2005          return 16;
2006        }
2007    
2008        /**
2009         * Returns the height of the icon, in pixels.
2010         *
2011         * @return <code>16</code>.
2012         */
2013        public int getIconHeight()  
2014        {
2015          return 16;
2016        }
2017    
2018        /**
2019         * Paints the icon at the specified location, using colors from the
2020         * current theme.
2021         *
2022         * @param c  the component (ignored).
2023         * @param g  the graphics device.
2024         * @param x  the x-coordinate for the top-left of the icon.
2025         * @param y  the y-coordinate for the top-left of the icon.
2026         */
2027        public void paintIcon(Component c, Graphics g, int x, int y)
2028        {
2029          Color saved = g.getColor();
2030          
2031          g.setColor(MetalLookAndFeel.getBlack());
2032          g.drawLine(x + 1, y + 1, x + 13, y + 1);
2033          g.drawLine(x + 1, y + 1, x + 1, y + 14);
2034          g.drawLine(x + 1, y + 14, x + 14, y + 14);
2035          g.drawLine(x + 14, y + 2, x + 14, y + 14);
2036          
2037          g.setColor(MetalLookAndFeel.getPrimaryControl());
2038          g.fillRect(x + 2, y + 2, 12, 12);
2039          
2040          g.setColor(MetalLookAndFeel.getControlShadow());
2041          g.fillRect(x + 5, y + 2, 6, 5);
2042          g.drawLine(x + 4, y + 8, x + 11, y + 8);
2043          g.drawLine(x + 3, y + 9, x + 3, y + 13);
2044          g.drawLine(x + 12, y + 9, x + 12, y + 13);
2045          
2046          g.setColor(MetalLookAndFeel.getWhite());
2047          g.fillRect(x + 8, y + 3, 2, 3);
2048          g.fillRect(x + 4, y + 9, 8, 5);
2049          
2050          g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
2051          g.drawLine(x + 5, y + 10, x + 9, y + 10);
2052          g.drawLine(x + 5, y + 12, x + 8, y + 12);
2053    
2054          g.setColor(saved);
2055        }        
2056      }  
2057    
2058      /**
2059       * An icon representing a computer.
2060       *
2061       * @see MetalIconFactory#getTreeComputerIcon()
2062       */
2063      private static class TreeComputerIcon implements Icon, Serializable
2064      {
2065    
2066        /**
2067         * Creates a new icon instance.
2068         */
2069        public TreeComputerIcon()
2070        {
2071        }
2072    
2073        /**
2074         * Returns the width of the icon, in pixels.
2075         *
2076         * @return <code>16</code>.
2077         */
2078        public int getIconWidth()
2079        {
2080          return 16;
2081        }
2082    
2083        /**
2084         * Returns the height of the icon, in pixels.
2085         *
2086         * @return <code>16</code>.
2087         */
2088        public int getIconHeight()  
2089        {
2090          return 16;
2091        }
2092    
2093        /**
2094         * Paints the icon at the specified location, using colors from the
2095         * current theme.
2096         *
2097         * @param c  the component (ignored).
2098         * @param g  the graphics device.
2099         * @param x  the x-coordinate for the top-left of the icon.
2100         * @param y  the y-coordinate for the top-left of the icon.
2101         */
2102        public void paintIcon(Component c, Graphics g, int x, int y)
2103        {
2104          Color saved = g.getColor();
2105          
2106          g.setColor(MetalLookAndFeel.getBlack());
2107          g.drawLine(x + 3, y + 1, x + 12, y + 1);
2108          g.drawLine(x + 2, y + 2, x + 2, y + 8);
2109          g.drawLine(x + 13, y + 2, x + 13, y + 8);
2110          g.drawLine(x + 3, y + 9, x + 3, y + 9);
2111          g.drawLine(x + 12, y + 9, x + 12, y + 9);
2112          g.drawRect(x + 1, y + 10, 13, 4);
2113          g.drawLine(x + 5, y + 3, x + 10, y + 3);
2114          g.drawLine(x + 5, y + 8, x + 10, y + 8);
2115          g.drawLine(x + 4, y + 4, x + 4, y + 7);
2116          g.drawLine(x + 11, y + 4, x + 11, y + 7);
2117    
2118          g.setColor(MetalLookAndFeel.getPrimaryControl());
2119          g.fillRect(x + 5, y + 4, 6, 4);
2120          
2121          g.setColor(MetalLookAndFeel.getControlShadow());
2122          g.drawLine(x + 6, y + 12, x + 8, y + 12);
2123          g.drawLine(x + 10, y + 12, x + 12, y + 12);
2124          g.setColor(saved);
2125        }        
2126      }  
2127            
2128    /** The cached RadioButtonIcon instance. */    /** The cached RadioButtonIcon instance. */
2129    private static RadioButtonIcon radioButtonIcon;    private static RadioButtonIcon radioButtonIcon;
# Line 2096  public class MetalIconFactory implements Line 2352  public class MetalIconFactory implements
2352      return new TreeControlIcon(isCollapsed);      return new TreeControlIcon(isCollapsed);
2353    }    }
2354    
2355      /**
2356       * Returns a 16x16 icon representing a computer.
2357       *
2358       * @return The icon.
2359       */
2360      public static Icon getTreeComputerIcon()
2361      {
2362        return new TreeComputerIcon();        
2363      }
2364        
2365      /**
2366       * Returns a 16x16 icon representing a floppy disk.
2367       *
2368       * @return The icon.
2369       */
2370      public static Icon getTreeFloppyDriveIcon()
2371      {
2372        return new TreeFloppyDriveIcon();
2373      }
2374        
2375      /**
2376       * Returns a 16x16 icon representing a hard disk.
2377       *
2378       * @return The icon.
2379       */
2380      public static Icon getTreeHardDriveIcon()
2381      {
2382        return new TreeHardDriveIcon();
2383      }
2384    
2385  }  }

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

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