FileDocCategorySizeDatePackage
TrinagleSquareWindowsCornerIcon.javaAPI DocExample2781Mon Jan 09 11:01:58 GMT 2006None

TrinagleSquareWindowsCornerIcon

public class TrinagleSquareWindowsCornerIcon extends Object implements Icon
Created by IntelliJ IDEA. User: Jonathan Simon Date: Oct 5, 2004 Time: 6:03:57 PM To change this template use File | Settings | File Templates.

Fields Summary
private static final Color
THREE_D_EFFECT_COLOR
private static final Color
SQUARE_COLOR_LEFT
private static final Color
SQUARE_COLOR_TOP_RIGHT
private static final Color
SQUARE_COLOR_BOTTOM_RIGHT
private static final int
WIDTH
private static final int
HEIGHT
Constructors Summary
Methods Summary
private voiddraw3dSquare(java.awt.Graphics g, int x, int y)

        Color oldColor = g.getColor(); //cache the old color
        g.setColor(THREE_D_EFFECT_COLOR); //set the white color
        g.fillRect(x,y,2,2); //draw the square
        g.setColor(oldColor); //reset the old color
    
private voiddrawSquare(java.awt.Graphics g, int x, int y)

        Color oldColor = g.getColor();
        g.setColor(SQUARE_COLOR_LEFT);
        g.drawLine(x,y, x,y+1);
        g.setColor(SQUARE_COLOR_TOP_RIGHT);
        g.drawLine(x+1,y, x+1,y);
        g.setColor(SQUARE_COLOR_BOTTOM_RIGHT);
        g.drawLine(x+1,y+1, x+1,y+1);
        g.setColor(oldColor);
    
public intgetIconHeight()




       
        return WIDTH;
    
public intgetIconWidth()

        return HEIGHT;
    
public voidpaintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)


        //Layout a row and column "grid"
        int firstRow = 0;
        int firstColumn = 0;
        int rowDiff = 4;
        int columnDiff = 4;

        int secondRow = firstRow + rowDiff;
        int secondColumn = firstColumn + columnDiff;
        int thirdRow = secondRow + rowDiff;
        int thirdColumn = secondColumn + columnDiff;


        //Draw the white squares first, so the gray squares will overlap
        draw3dSquare(g, firstColumn+1, thirdRow+1);

        draw3dSquare(g, secondColumn+1, secondRow+1);
        draw3dSquare(g, secondColumn+1, thirdRow+1);

        draw3dSquare(g, thirdColumn+1, firstRow+1);
        draw3dSquare(g, thirdColumn+1, secondRow+1);
        draw3dSquare(g, thirdColumn+1, thirdRow+1);

        //draw the gray squares overlapping the white background squares
        drawSquare(g, firstColumn, thirdRow);

        drawSquare(g, secondColumn, secondRow);
        drawSquare(g, secondColumn, thirdRow);

        drawSquare(g, thirdColumn, firstRow);
        drawSquare(g, thirdColumn, secondRow);
        drawSquare(g, thirdColumn, thirdRow);