edu.northwestern.at.utils.swing.icons
Class SmallIcons

java.lang.Object
  extended by edu.northwestern.at.utils.swing.icons.SmallIcons

public class SmallIcons
extends java.lang.Object

SmallIcons.

SmallIcons are small icons. The ".gif" files reside in a specified subdirectory of the package directory.

The SmallIcons class provides methods to manage and encapsulate access to collections of small icons. See the Emoticons and StarIcons classes for examples.


Field Summary
protected  javax.swing.ImageIcon[] icons
          Icon cache.
protected  java.lang.String[] names
          Small icon names.
protected  java.lang.String path
          Path for icons.
 
Constructor Summary
protected SmallIcons(java.lang.String[] names, java.lang.String path)
          Create small icons accessor.
 
Method Summary
 javax.swing.ImageIcon get(int index)
          Gets an icon by index.
 javax.swing.ImageIcon get(java.lang.String name)
          Gets an emoticon by name.
 int indexOf(javax.swing.ImageIcon icon)
          Gets the index of an emoticon.
 javax.swing.JPopupMenu popup(java.awt.event.ActionListener listener)
          Creates and returns a popup menu for all the emoticons.
 javax.swing.JPopupMenu popup(int[] order, java.awt.event.ActionListener listener)
          Creates and returns a popup menu for all the emoticons in a specified order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

names

protected java.lang.String[] names
Small icon names.


path

protected java.lang.String path
Path for icons.


icons

protected javax.swing.ImageIcon[] icons
Icon cache.

Constructor Detail

SmallIcons

protected SmallIcons(java.lang.String[] names,
                     java.lang.String path)
Create small icons accessor.

Parameters:
names - Names of icons.
path - Class path to icons.
Method Detail

get

public javax.swing.ImageIcon get(int index)
Gets an icon by index.

Parameters:
index - The index of the icon.
Returns:
The image icon.

get

public javax.swing.ImageIcon get(java.lang.String name)
Gets an emoticon by name.

Parameters:
name - The emoticon name.
Returns:
The image icon for the emoticon.

popup

public javax.swing.JPopupMenu popup(java.awt.event.ActionListener listener)
Creates and returns a popup menu for all the emoticons.

Parameters:
listener - Shared action listener for all the menu items.
Returns:
The popup menu.

popup

public javax.swing.JPopupMenu popup(int[] order,
                                    java.awt.event.ActionListener listener)
Creates and returns a popup menu for all the emoticons in a specified order.

Parameters:
order - An array of integer indexes in the order in which the emoticons should appear in the menu.
listener - Shared action listener for all the menu items.
Returns:
The popup menu.

indexOf

public int indexOf(javax.swing.ImageIcon icon)
Gets the index of an emoticon.

Parameters:
icon - The image icon.
Returns:
The index.