Example #1
0
 /**
  * Draw the icon at the specified location. Icon implementations may use the Component argument to
  * get properties useful for painting, e.g. the foreground or background color.
  *
  * @param c Component
  * @param g Graphics
  * @param x X
  * @param y Y
  * @see javax.swing.Icon#paintIcon(Component, Graphics, int, int)
  */
 public void paintIcon(Component c, Graphics g, int x, int y) {
   Graphics2D g2D = (Graphics2D) g;
   Icon icon = CTreeNode.getIcon(m_type);
   if (icon != null) {
     int xI = x + ((WIDTH - icon.getIconWidth()) / 2);
     int yI = y + ((HEIGHT - icon.getIconHeight()) / 2);
     icon.paintIcon(c, g, xI, yI);
   } else //	draw dot
   {
     int size = 10;
     int xI = x + ((WIDTH - size) / 2);
     int yI = y + ((HEIGHT - size) / 2);
     g2D.setColor(Color.magenta);
     g2D.fillOval(xI, yI, size, size);
   }
 } //	PaintIcon
Example #2
0
 /**
  * Constructor
  *
  * @param action image indicator
  */
 public WFIcon(String action) {
   if (action != null) m_type = CTreeNode.getImageIndex(action);
 } //	WFIcon