com.togethersoft.openapi.util.ui
Class IconSequence


public class IconSequence
implements Icon

Implements a sequence of Icons being painted in a horizontal line.
Different height icons will be aligned according to Alignment property.

Author:
TogetherSoft
Since: Together 4.0

Field Summary
 final static intBOTTOM
           
 final static intCENTER
           
 private intmyAlignment
           
 private VectormyIcons
           
 final static intTOP
           

Constructor Summary
IconSequence()
          Constructs new icon sequence without icons and with centered alignment.
IconSequence(Icon[] icons, int alignment)
          Constructs new icon sequence with specified icons and alignment.

Method Summary
 voidaddIcon(Icon icon)
          Adds new icon at the end of sequence.
 intgetAlignment()
          Return current alingment.
 IcongetIconAt(int index)
          Returns icon at the specified position of sequence.
 intgetIconCount()
          Returns count of icons in this sequence.
 intgetIconHeight()
          Finds an icon with a maximum height and returns it's height.
 intgetIconWidth()
          Returns width of this sequence
 voidinsertIconAt(Icon icon, int index)
          Insert new icon before specified position.
 voidpaintIcon(Component c, Graphics g, int x, int y)
          Draw the icon at the specified location.
 voidremoveAllIcons()
          Remove all icons from this sequence.
 voidremoveIconAt(int index)
          Remove icon at the specified position.
 voidsetAlignment(int alignment)
          Set new alingment.
 voidsetIconAt(Icon icon, int index)
          Replace icon at specified position with new one.

Field Detail

BOTTOM

public final static int BOTTOM

CENTER

public final static int CENTER

myAlignment

private int myAlignment

myIcons

private Vector myIcons

TOP

public final static int TOP
Constructor Detail

IconSequence

public IconSequence()
Constructs new icon sequence without icons and with centered alignment.

IconSequence

public IconSequence(Icon[] icons, int alignment)
Constructs new icon sequence with specified icons and alignment.
Method Detail

addIcon

public void addIcon(Icon icon)
Adds new icon at the end of sequence.

getAlignment

public int getAlignment()
Return current alingment.

getIconAt

public Icon getIconAt(int index)
Returns icon at the specified position of sequence.

getIconCount

public int getIconCount()
Returns count of icons in this sequence.

getIconHeight

public int getIconHeight()
Finds an icon with a maximum height and returns it's height.

getIconWidth

public int getIconWidth()
Returns width of this sequence

insertIconAt

public void insertIconAt(Icon icon, int index)
Insert new icon before specified position.

paintIcon

public void paintIcon(Component c, Graphics g, int x, int y)
Draw the icon at the specified location. Component argument may be used to get properties useful for painting,
e.g. the foreground or background color.

removeAllIcons

public void removeAllIcons()
Remove all icons from this sequence.

removeIconAt

public void removeIconAt(int index)
Remove icon at the specified position.

setAlignment

public void setAlignment(int alignment)
Set new alingment.
throw IllegalArgumentException if alignment not TOP, CENTER, or BOTTOM.

setIconAt

public void setIconAt(Icon icon, int index)
Replace icon at specified position with new one.

Association Links

to Class java.util.Vector