1   package org.wcb.gui.component;
2   
3   import javax.swing.Icon;
4   import java.awt.Color;
5   import java.awt.Component;
6   import java.awt.Graphics;
7   
8   /**
9    * This library is free software; you can redistribute it and/or
10   * modify it under the terms of the GNU Lesser General Public
11   * License as published by the Free Software Foundation; either
12   * version 2.1 of the License, or (at your option) any later version.
13   *
14   * This library is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17   * Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this library; if not, write to the Free Software
21   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22   */
23  
24  public class AngledLinesWindowsCornerIcon implements Icon {
25  
26      //RGB values discovered using ZoomIn
27      private static final Color WHITE_LINE_COLOR = new Color(255, 255, 255);
28      private static final Color GRAY_LINE_COLOR = new Color(172, 168, 153);
29  
30      //Dimensions
31      private static final int WIDTH = 13;
32      private static final int HEIGHT = 13;
33  
34      /**
35       * The height of the icon.
36       * @return The triangled image.
37       */
38      public int getIconHeight() {
39          return WIDTH;
40      }
41  
42      /**
43       * The width of the image.
44       * @return  the width.
45       */
46      public int getIconWidth() {
47          return HEIGHT;
48      }
49  
50      /**
51       * Paints the component icon.
52       * @param c component to paint on.
53       * @param g Graphics reference.
54       * @param x position
55       * @param y position.
56       */
57      public void paintIcon(Component c, Graphics g, int x, int y) {
58  
59          g.setColor(WHITE_LINE_COLOR);
60          g.drawLine(0, 12, 12, 0);
61          g.drawLine(5, 12, 12, 5);
62          g.drawLine(10, 12, 12, 10);
63  
64          g.setColor(GRAY_LINE_COLOR);
65          g.drawLine(1, 12, 12, 1);
66          g.drawLine(2, 12, 12, 2);
67          g.drawLine(3, 12, 12, 3);
68  
69          g.drawLine(6, 12, 12, 6);
70          g.drawLine(7, 12, 12, 7);
71          g.drawLine(8, 12, 12, 8);
72  
73          g.drawLine(11, 12, 12, 11);
74          g.drawLine(12, 12, 12, 12);
75  
76      }
77  }