EchoPoint
1.0

echopoint
Class ImageIcon

java.lang.Object
  extended bynextapp.echo.Component
      extended bynextapp.echo.Container
          extended byechopoint.EchoPointComponent
              extended byechopoint.ImageIcon
All Implemented Interfaces:
MouseCursorable, ReflectionSetter, java.io.Serializable, ToolTipPopUpSupport, nextapp.echo.ToolTipSupport

public class ImageIcon
extends EchoPointComponent

The ImageIcon class provides an component that displays an ImageReference. A height and width value can be specified to overide what may be defined in the ImageReference itself. This allows images to be "scaled" to different dimensions.

The advantage of ImageIcon over using a nextapp.echo.Label is that you can scale ImageReference objects that you may not know the dimensions of.

See Also:
Serialized Form

Nested Class Summary
static class ImageIcon.NestedStyleInfo
          Nested public static StyleInfo class.
 
Field Summary
static java.lang.String ACTION_COMMAND_CHANGED_PROPERTY
          property name fired when the actionCommand changes
static int DEFAULT_HEIGHT
          default height is 32
static int DEFAULT_WIDTH
          default width is 32
static java.lang.String ICON_CHANGED_PROPERTY
          property name fired when the imageReference changes
static java.lang.String ICON_DIMENSIONS_CHANGED_PROPERTY
          property name fired when the dimensions changes
static java.lang.String STYLE_ICON
          A style constant for the Icon property.
 
Fields inherited from class echopoint.EchoPointComponent
STYLE_TOOL_TIP_TEXT, TOOL_TIP_TEXT_CHANGED_PROPERTY, toolTipPopUp
 
Fields inherited from class nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, listenerList, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface echopoint.positionable.MouseCursorable
borderStyleSymbolics, CURSOR_AUTO, CURSOR_CROSSHAIR, CURSOR_CUSTOM_URI, CURSOR_DEFAULT, CURSOR_E_RESIZE, CURSOR_HELP, CURSOR_MOVE, CURSOR_N_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_POINTER, CURSOR_S_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE, CURSOR_TEXT, CURSOR_W_RESIZE, CURSOR_WAIT, STYLE_MOUSE_CURSOR, STYLE_MOUSE_CURSOR_URI
 
Constructor Summary
ImageIcon()
          Constructs a ImageIcon with a null ImageReference.
ImageIcon(nextapp.echo.ImageReference imageRef)
          Constructs a ImageIcon and sets the width and height to be that of the ImageReference.
ImageIcon(nextapp.echo.ImageReference imageRef, int width, int height)
          Constructs a ImageIcon with the specified width and height
 
Method Summary
 void addActionListener(nextapp.echo.event.ActionListener l)
          Adds an ActionListener.
 void applyStyle(nextapp.echo.Style style)
           
 void fireActionPerformed(nextapp.echo.event.ActionEvent e)
          Notifies all listeners that have registered for this event type.
 java.lang.String getActionCommand()
          Returns the action command for this ImageIcon.
 int getHeight()
          Returns the height of the ImageIcon.
 nextapp.echo.ImageReference getIcon()
          Returns the ImageReference within.
 int getWidth()
          Returns the width of the ImageIcon.
 void removeActionListener(nextapp.echo.event.ActionListener l)
          Removes an ActionListener.
 java.lang.Object set(java.lang.reflect.Field field, java.lang.Object newValue)
          Called to save the old value of a field, set in a new value and return the old value of a field.
 void setActionCommand(java.lang.String newValue)
          Sets the ImageIcon's action command.
 void setHeight(int newValue)
          Sets the height of the ImageIcon.
 void setIcon(nextapp.echo.ImageReference newValue)
          Sets the ImageReference used by the ImageIcon.
 void setWidth(int newValue)
          Sets the width of the ImageIcon.
 
Methods inherited from class echopoint.EchoPointComponent
getMouseCursor, getMouseCursorURI, getToolTipPopUp, getToolTipText, set, set, set, set, set, set, set, set, set, setEnabledAllChildren, setMouseCursor, setMouseCursorURI, setToolTipText, validate
 
Methods inherited from class nextapp.echo.Component
add, add, addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getComponent, getComponentCount, getComponents, getEchoInstance, getFont, getForeground, getIdentifier, getLocale, getParent, indexOf, init, isAncestorOf, isEnabled, isRegistered, isShowing, isVisible, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setEnabled, setFont, setForeground, setIdentifier, setLocale, setVisible, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_COMMAND_CHANGED_PROPERTY

public static final java.lang.String ACTION_COMMAND_CHANGED_PROPERTY
property name fired when the actionCommand changes

See Also:
Constant Field Values

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
default height is 32

See Also:
Constant Field Values

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
default width is 32

See Also:
Constant Field Values

ICON_CHANGED_PROPERTY

public static final java.lang.String ICON_CHANGED_PROPERTY
property name fired when the imageReference changes

See Also:
Constant Field Values

ICON_DIMENSIONS_CHANGED_PROPERTY

public static final java.lang.String ICON_DIMENSIONS_CHANGED_PROPERTY
property name fired when the dimensions changes

See Also:
Constant Field Values

STYLE_ICON

public static final java.lang.String STYLE_ICON
A style constant for the Icon property. Values of this key must be of type nextapp.echo.ImageReference.

See Also:
Constant Field Values
Constructor Detail

ImageIcon

public ImageIcon()
Constructs a ImageIcon with a null ImageReference. The width and height are set to DEFAULT_WIDTH and/or DEFAULT_HEIGHT.


ImageIcon

public ImageIcon(nextapp.echo.ImageReference imageRef)
Constructs a ImageIcon and sets the width and height to be that of the ImageReference. If the image has no dimensions, then the width and height are set to DEFAULT_WIDTH and/or DEFAULT_HEIGHT.

Parameters:
imageRef -

ImageIcon

public ImageIcon(nextapp.echo.ImageReference imageRef,
                 int width,
                 int height)
Constructs a ImageIcon with the specified width and height

Parameters:
imageRef - - the ImageReference to display
width - - the width to scale it to
height - - the height to scale it to
Method Detail

addActionListener

public void addActionListener(nextapp.echo.event.ActionListener l)
Adds an ActionListener.

Parameters:
l - The ActionListener to be added.

applyStyle

public void applyStyle(nextapp.echo.Style style)
Specified by:
applyStyle in interface MouseCursorable
Overrides:
applyStyle in class EchoPointComponent
See Also:
EchoPointComponent.applyStyle(nextapp.echo.Style)

fireActionPerformed

public void fireActionPerformed(nextapp.echo.event.ActionEvent e)
Notifies all listeners that have registered for this event type.

Parameters:
e - The ActionEvent to send.

getActionCommand

public java.lang.String getActionCommand()
Returns the action command for this ImageIcon.

Returns:
The action command for this button.

getHeight

public int getHeight()
Returns the height of the ImageIcon.

Returns:
int - the height of the ImageIcon.

getIcon

public nextapp.echo.ImageReference getIcon()
Returns the ImageReference within.

Returns:
ImageReference - the ImageReference within.

getWidth

public int getWidth()
Returns the width of the ImageIcon.

Returns:
int - the width of the ImageIcon.

removeActionListener

public void removeActionListener(nextapp.echo.event.ActionListener l)
Removes an ActionListener.

Parameters:
l - The ActionListener to be removed.

setActionCommand

public void setActionCommand(java.lang.String newValue)
Sets the ImageIcon's action command.

Parameters:
newValue - The new action command for this ImageIcon.

setHeight

public void setHeight(int newValue)
Sets the height of the ImageIcon. The contained image will be scalled to fit this new value.

Parameters:
newValue -

setIcon

public void setIcon(nextapp.echo.ImageReference newValue)
Sets the ImageReference used by the ImageIcon.

Parameters:
newValue -

setWidth

public void setWidth(int newValue)
Sets the width of the ImageIcon. The contained image will be scalled to fit this new value.

Parameters:
newValue -

set

public java.lang.Object set(java.lang.reflect.Field field,
                            java.lang.Object newValue)
                     throws java.lang.Exception
Description copied from interface: ReflectionSetter
Called to save the old value of a field, set in a new value and return the old value of a field. This interface allows a field set operation to be "delegated" back into the class that has permission to perform the field set.

 public Object set(Field f, Object newValue) throws Exception {
      Object oldValue = f.get(this);
      f.set(this,newValue);
      return oldValue;
 }
 

Parameters:
field - - the field to be set
newValue - - the new value to be set
Returns:
the oldValue of the field
Throws:
java.lang.Exception
See Also:
ReflectionSetter.set(Field, Object)

EchoPoint
1.0