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

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

public class StarIcons
extends java.lang.Object

StarIcons.

Star Icons are icons showing five stars partially or fully filled in. Star Icons reside in the "resources/staricons" subdirectory of the package directory.

This static class manages and encapsulates access to the star icons.


Method Summary
static javax.swing.ImageIcon get(int index)
          Gets an icon by index.
static javax.swing.ImageIcon get(java.lang.String name)
          Gets an icon by name.
static javax.swing.ImageIcon[] getIcons(boolean getAll)
          Get icons.
static javax.swing.JLabel[] getLabels(boolean getAll)
          Get icons as list of JLabels.
static int indexOf(javax.swing.ImageIcon icon)
          Gets the index of an emoticon.
static javax.swing.JPopupMenu popup(java.awt.event.ActionListener listener)
          Creates and returns a popup menu for all the star icons.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

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

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

get

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

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

popup

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

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

indexOf

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

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

getLabels

public static javax.swing.JLabel[] getLabels(boolean getAll)
Get icons as list of JLabels.

Parameters:
getAll - True to get all star icons, false to get only the ones for whole numbers.
Returns:
Star icons corresponding to whole numbers as JLabels.

getIcons

public static javax.swing.ImageIcon[] getIcons(boolean getAll)
Get icons.

Parameters:
getAll - True to get all star icons, false to get only the ones for whole numbers.
Returns:
Star icons.