org.beanfabrics.swing
Class ErrorIconPainter

java.lang.Object
  extended by org.beanfabrics.swing.ErrorIconPainter
All Implemented Interfaces:
java.io.Serializable

public class ErrorIconPainter
extends java.lang.Object
implements java.io.Serializable

The ErrorIconPainter is a helper class for painting an error icon on top of any component.

See Also:
Serialized Form

Constructor Summary
ErrorIconPainter()
          Creates a new ErrorIconPainter with the default settings.
 
Method Summary
protected  void checkHorizontalKey(int key)
          Checks if the given integer is a valid key for horizontal alignment and throws an IllegalArgumentException if the key is invalid.
protected  void checkVerticalKey(int key)
          Checks if the given integer is a valid key for vertical alignment and throws an IllegalArgumentException if the key is invalid.
 java.awt.Dimension getDimension()
          Gets the size of the error icon.
 javax.swing.ImageIcon getErrorIcon()
          Gets the error icon that is used when the component has no focus.
 javax.swing.ImageIcon getErrorIconFocused()
          Returns the error icon that is used when the component has the focus.
 int getHorizontalAlignment()
          Returns the horizontal alignment of the icon.
 java.awt.Insets getMargin()
          Returns the margin of the error icon.
 java.awt.Point getOffset()
          Returns the icon's offset position.
 int getVerticalAlignment()
          Returns the vertical alignment of the icon.
 void paint(java.awt.Graphics g, java.awt.Component c)
          Paints the error icon onto the given Graphics object by using the given component to calculate the icons loacation.
 void setErrorIcon(javax.swing.ImageIcon aErrorIcon)
          Sets the error icon that sould be rendered when the component has no focus.
 void setErrorIconFocused(javax.swing.ImageIcon aErrorIconFocused)
          Sets the error icon that sould be rendered when the component has the focus.
 void setHorizontalAlignment(int horizontalAlignment)
          Sets the horizontal alignment of the icon.
 void setMargin(java.awt.Insets margin)
          Sets the margin of the error icon.
 void setOffset(java.awt.Point offset)
          Sets the icon's offset position.
 void setVerticalAlignment(int verticalAlignment)
          Sets the vertical alignment of the icon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorIconPainter

public ErrorIconPainter()
Creates a new ErrorIconPainter with the default settings.

Method Detail

getMargin

public java.awt.Insets getMargin()
Returns the margin of the error icon.

Returns:

setMargin

public void setMargin(java.awt.Insets margin)
Sets the margin of the error icon.

Parameters:
margin -

getHorizontalAlignment

public int getHorizontalAlignment()
Returns the horizontal alignment of the icon.

Returns:
the horizontal alignment of the icon.

setHorizontalAlignment

public void setHorizontalAlignment(int horizontalAlignment)
Sets the horizontal alignment of the icon.

Parameters:
horizontalAlignment -

checkHorizontalKey

protected void checkHorizontalKey(int key)
Checks if the given integer is a valid key for horizontal alignment and throws an IllegalArgumentException if the key is invalid.

Parameters:
key -

getVerticalAlignment

public int getVerticalAlignment()
Returns the vertical alignment of the icon.

Returns:
the vertical alignment of the icon

setVerticalAlignment

public void setVerticalAlignment(int verticalAlignment)
Sets the vertical alignment of the icon.

Parameters:
verticalAlignment -

checkVerticalKey

protected void checkVerticalKey(int key)
Checks if the given integer is a valid key for vertical alignment and throws an IllegalArgumentException if the key is invalid.

Parameters:
key -

getOffset

public java.awt.Point getOffset()
Returns the icon's offset position.

Returns:

setOffset

public void setOffset(java.awt.Point offset)
Sets the icon's offset position.

Parameters:
offset -

getDimension

public java.awt.Dimension getDimension()
Gets the size of the error icon.

Returns:
size of the error icon.

getErrorIcon

public javax.swing.ImageIcon getErrorIcon()
Gets the error icon that is used when the component has no focus.

Returns:
the error icon that is used when the component has no focus

setErrorIcon

public void setErrorIcon(javax.swing.ImageIcon aErrorIcon)
Sets the error icon that sould be rendered when the component has no focus.

Parameters:
aErrorIcon -

getErrorIconFocused

public javax.swing.ImageIcon getErrorIconFocused()
Returns the error icon that is used when the component has the focus.

Returns:
the error icon that is used when the component has the focus

setErrorIconFocused

public void setErrorIconFocused(javax.swing.ImageIcon aErrorIconFocused)
Sets the error icon that sould be rendered when the component has the focus.

Parameters:
aErrorIconFocused -

paint

public void paint(java.awt.Graphics g,
                  java.awt.Component c)
Paints the error icon onto the given Graphics object by using the given component to calculate the icons loacation.

Parameters:
g -
c -