org.comedia.ui
Class CEncodedIcon

java.lang.Object
  |
  +--org.comedia.ui.CEncodedIcon
All Implemented Interfaces:
javax.swing.Icon

public class CEncodedIcon
extends java.lang.Object
implements javax.swing.Icon

Presents an icon with transparent encoded image. The class contains a bunch of predefined icons and can draw disabled icons.

Usage examples:

 panel.setLayout(new GridLayout(3, 3));
 panel.add(new JButton(CEncodedIcon.BIG_RIGHT_ARROW));
 panel.add(new JButton(CEncodedIcon.MANY_SIGN));
 panel.add(new JButton(CEncodedIcon.ONE_SIGN));
 panel.add(new JButton(CEncodedIcon.PEN_SIGN));
 panel.add(new JButton(CEncodedIcon.SMALL_LEFT_ARROW));
 panel.add(new JButton(CEncodedIcon.SMALL_RIGHT_ARROW));
 panel.add(new JButton(CEncodedIcon.STAR_SIGN));

 CEncodedIcon icon = new CEncodedIcon(new int[] {0x60, 0x60, 0xf0, 0x60, 0x60},
   6, 5);
 icon.setColor(Color.blue);
 panel.add(new JButton(icon));
 


Field Summary
static CEncodedIcon BIG_RIGHT_ARROW
          The big right arrow sign.
static CEncodedIcon FIRST_SIGN
          The first sign.
static CEncodedIcon LAST_NEW_SIGN
          The last new sign.
static CEncodedIcon LAST_SIGN
          The last sign.
static CEncodedIcon MANY_SIGN
          The many units sign.
static CEncodedIcon NEXT_SIGN
          The next sign.
static CEncodedIcon ONE_SIGN
          The one unit sign.
static CEncodedIcon PEN_SIGN
          The writing pen sign.
static CEncodedIcon PRIOR_SIGN
          The prior sign.
static CEncodedIcon SMALL_DOWN_ARROW
          The big down arrow sign.
static CEncodedIcon SMALL_LEFT_ARROW
          The small left arrow sign.
static CEncodedIcon SMALL_RIGHT_ARROW
          The small right arrow sign.
static CEncodedIcon SMALL_UP_ARROW
          The big up arrow sign.
static CEncodedIcon STAR_SIGN
          The star sign.
 
Constructor Summary
CEncodedIcon(int[] image, int width, int height)
          Constructs this image and assignes main properties.
 
Method Summary
 java.awt.Color getColor()
          Gets the current icon color.
 int getIconHeight()
          Gets the current image height.
 int getIconWidth()
          Gets the current image width.
 int[] getImageArray()
          Gets an image binary array of this icon.
 boolean isEnabled()
          Checks the current enabled status.
static void main(java.lang.String[] args)
          The main routine to run this module as standalone application.
 void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
          Paints the current image in the screen.
 void setColor(java.awt.Color color)
          Sets a new icon color.
 void setEnabled(boolean enabled)
          Sets a new enabled status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIRST_SIGN

public static final CEncodedIcon FIRST_SIGN
The first sign.

PRIOR_SIGN

public static final CEncodedIcon PRIOR_SIGN
The prior sign.

LAST_SIGN

public static final CEncodedIcon LAST_SIGN
The last sign.

LAST_NEW_SIGN

public static final CEncodedIcon LAST_NEW_SIGN
The last new sign.

NEXT_SIGN

public static final CEncodedIcon NEXT_SIGN
The next sign.

BIG_RIGHT_ARROW

public static final CEncodedIcon BIG_RIGHT_ARROW
The big right arrow sign.

SMALL_DOWN_ARROW

public static final CEncodedIcon SMALL_DOWN_ARROW
The big down arrow sign.

SMALL_UP_ARROW

public static final CEncodedIcon SMALL_UP_ARROW
The big up arrow sign.

STAR_SIGN

public static final CEncodedIcon STAR_SIGN
The star sign.

PEN_SIGN

public static final CEncodedIcon PEN_SIGN
The writing pen sign.

SMALL_LEFT_ARROW

public static final CEncodedIcon SMALL_LEFT_ARROW
The small left arrow sign.

SMALL_RIGHT_ARROW

public static final CEncodedIcon SMALL_RIGHT_ARROW
The small right arrow sign.

ONE_SIGN

public static final CEncodedIcon ONE_SIGN
The one unit sign.

MANY_SIGN

public static final CEncodedIcon MANY_SIGN
The many units sign.
Constructor Detail

CEncodedIcon

public CEncodedIcon(int[] image,
                    int width,
                    int height)
Constructs this image and assignes main properties.
Method Detail

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics g,
                      int x,
                      int y)
Paints the current image in the screen.
Specified by:
paintIcon in interface javax.swing.Icon
Parameters:
c - a component to paint.
g - a current graphical context.
x - x coordinate of image.
y - y coordinate of image.

getImageArray

public int[] getImageArray()
Gets an image binary array of this icon.
Parameters:
an - image binary array of this icon.

getIconWidth

public int getIconWidth()
Gets the current image width.
Specified by:
getIconWidth in interface javax.swing.Icon

getIconHeight

public int getIconHeight()
Gets the current image height.
Specified by:
getIconHeight in interface javax.swing.Icon

getColor

public java.awt.Color getColor()
Gets the current icon color.

setColor

public void setColor(java.awt.Color color)
Sets a new icon color.
Parameters:
color - a new icon color.

isEnabled

public boolean isEnabled()
Checks the current enabled status.

setEnabled

public void setEnabled(boolean enabled)
Sets a new enabled status.
Parameters:
color - a new enabled status.

main

public static void main(java.lang.String[] args)
The main routine to run this module as standalone application.