欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

添加窗口尺寸调整图标,窗口尺寸图标,void paintIc

来源: javaer 分享于  点击 34451 次 点评:169

添加窗口尺寸调整图标,窗口尺寸图标,void paintIc


void paintIcon(Component c, Graphics g, int x, int y);    int getIconWidth( );    int getIconHeight( );  private static final int WIDTH = 12;  private static final int HEIGHT = 12;  public int getIconHeight( ) {      return WIDTH;  }  public int getIconWidth( ) {       return HEIGHT;   }  private static final Color SQUARE_COLOR_LEFT = new Color(184, 180, 163);   private static final Color SQUARE_COLOR_TOP_RIGHT = new Color(184, 180, 161);   private static final Color SQUARE_COLOR_BOTTOM_RIGHT = new Color(184, 181, 161);     private void drawSquare(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);     }     private static final Color THREE_D_EFFECT_COLOR = new Color(255, 255, 255);      private void draw3dSquare(Graphics g, int x, int y){          Color oldColor = g.getColor( );          g.setColor(THREE_D_EFFECT_COLOR);          g.fillRect(x,y,2,2);          g.setColor(oldColor);      }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;  //first row  draw3dSquare(g, firstColumn+1, thirdRow+1);  //second row  draw3dSquare(g, secondColumn+1, secondRow+1);  draw3dSquare(g, secondColumn+1, thirdRow+1);  //third row  draw3dSquare(g, thirdColumn+1, firstRow+1);  draw3dSquare(g, thirdColumn+1, secondRow+1);  draw3dSquare(g, thirdColumn+1, thirdRow+1);  //first row  drawSquare(g, firstColumn, thirdRow);  //second row  drawSquare(g, secondColumn, secondRow);  drawSquare(g, secondColumn, thirdRow);  //third row  drawSquare(g, thirdColumn, firstRow);  drawSquare(g, thirdColumn, secondRow);  drawSquare(g, thirdColumn, thirdRow); private static final int WIDTH = 13; private static final int HEIGHT = 13; public int getIconHeight( ) {     return WIDTH; } public int getIconWidth( ) {     return HEIGHT; } public void paintIcon(Component c, Graphics g, int x, int y) {    g.setColor(WHITE_LINE_COLOR);    g.drawLine(0,12, 12,0);    g.drawLine(5,12, 12,5);    g.drawLine(10,12, 12,10);    g.setColor(GRAY_LINE_COLOR);    g.drawLine(1,12, 12,1);    g.drawLine(2,12, 12,2);    g.drawLine(3,12, 12,3);    g.drawLine(6,12, 12,6);    g.drawLine(7,12, 12,7);    g.drawLine(8,12, 12,8);    g.drawLine(11,12, 12,11);    g.drawLine(12,12, 12,12); }//该片段来自于http://byrx.net
相关栏目:

用户点评