Code example for Icon

Methods: getIconHeightgetIconWidthpaintIcon

0
        this.icon = icon; 
        shadowIcon = new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon)icon).getImage())); 
    }  
  
    public int getIconHeight(){  
        return icon.getIconWidth(); 
    }  
  
    public int getIconWidth(){  
        return icon.getIconHeight(); 
    }  
  
    public void paintIcon(Component c, Graphics g, int x, int y){ 
      Color highlight = UIManager.getColor("VLDocking.highlight");
      Color shadow = UIManager.getColor("VLDocking.shadow");
      g.setColor(highlight);
      g.fillRect(x, y, getIconWidth(), getIconHeight());
      shadowIcon.paintIcon(c, g, x + shadowWidth-1, y + shadowHeight-1); 
      icon.paintIcon(c, g, x-1,  y-1); 
    }  
 
 
   
}