com.wirefusion.gui.textimage
Class TextImage

java.lang.Object
  extended by com.wirefusion.gui.textimage.TextImage
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public final class TextImage
extends java.lang.Object
implements java.io.Externalizable

TextImage objects can be used for creating PNG images showing text. It is for example used in the advanced mode in the Button widget, for specifying the button label.

See Also:
Serialized Form

Field Summary
static int BUTTON_TEXT_MODE
          TextImage mode suitable for button labels
static int CHECKBOX_TEXT_MODE
          TextImage mode suitable for checkbox labels
static int STANDARD_MODE
          Default TextImage mode
static int TOOLTIP_MODE
          TextImage mode suitable for ToolTip like texts
 
Constructor Summary
TextImage(int mode)
          Constructs a new TextImage object.
 
Method Summary
 TextImage getClone()
          Returns a clone of the object.
 java.lang.String getPlainText()
          Returns the current text in the TextImage.
 java.io.File openEditor(java.awt.Dialog owner)
          Opens the TextImage editor.
 java.io.File openEditor(java.awt.Dialog owner, java.awt.Image backgroundImage)
          Opens the TextImage editor.
 void setImageDimension(java.awt.Dimension dimension)
          Sets the default text image dimension that will be used in the TextImage editor.
 void setImageName(java.lang.String string)
          Sets the name of the image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 

Field Detail

STANDARD_MODE

public static final int STANDARD_MODE
Default TextImage mode

See Also:
Constant Field Values

TOOLTIP_MODE

public static final int TOOLTIP_MODE
TextImage mode suitable for ToolTip like texts

See Also:
Constant Field Values

BUTTON_TEXT_MODE

public static final int BUTTON_TEXT_MODE
TextImage mode suitable for button labels

See Also:
Constant Field Values

CHECKBOX_TEXT_MODE

public static final int CHECKBOX_TEXT_MODE
TextImage mode suitable for checkbox labels

See Also:
Constant Field Values
Constructor Detail

TextImage

public TextImage(int mode)
Constructs a new TextImage object.

Parameters:
mode - the TextImage mode
Method Detail

getClone

public TextImage getClone()
Returns a clone of the object.

Returns:
a clone.

openEditor

public java.io.File openEditor(java.awt.Dialog owner)
Opens the TextImage editor. If the user clicks OK in the editor, the editor state and result is saved in the TextImage object and the resulting image file returned. If the user cancels the editor, null is returned from this method.

Parameters:
owner - the owner dialog
Returns:
The resulting text image file, or null if the user cancels the editor

openEditor

public java.io.File openEditor(java.awt.Dialog owner,
                               java.awt.Image backgroundImage)
Opens the TextImage editor. If a background image is supplied, it will be shown as background in the editor pane. If the user clicks OK in the editor, the editor state and result is saved in the TextImage object and the resulting image file returned. If the user cancels the editor, null is returned from this method.

Parameters:
owner -
backgroundImage -
Returns:
an image file

getPlainText

public java.lang.String getPlainText()
Returns the current text in the TextImage. Can for example be usefull if one wants to detect if text has been entered (getPlainText.trim().equals("")).

Returns:
the current text

setImageName

public void setImageName(java.lang.String string)
Sets the name of the image. This name will be a part of the filename that TextImage creates.

Parameters:
string - an image name

setImageDimension

public void setImageDimension(java.awt.Dimension dimension)
Sets the default text image dimension that will be used in the TextImage editor.

Parameters:
dimension - the text input pane dimension