|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.fx.IconAndText
IconAndText is a special type of IImage that draws an Icon and then a line of text. It is used by a number of UI objects, including Menu, buttons, etc.
IconAndText also supports multiple images and text placed at a particular position along the width of the image. This is used by some controls to display images and text lined up in columns (e.g. the ewe.filechooser.FileChooser).
IconAndText objects are mutable/re-usable. You can change the icon and text and add and remove columns dynamically.
When using the IconAndText in column mode, the background of the image is drawn using the background of the destination graphics if the background field is null. If the destination graphics background is null, then the background will not be drawn.
| Field Summary | |
Color |
background
A background color. |
FontMetrics |
fontMetrics
The FontMetrics being used. |
int |
height
This is the height of the IconAndText |
IImage |
icon
The icon being used. |
String[] |
lines
The text being used if it consists of multiple lines. |
int |
multiLineTextAlignment
If multiple lines are used for the text this denotes how those lines are aligned within the space allocated for the text. |
String |
text
The text being used. |
Color |
textColor
If this is null, then the text will be drawn in the foreground color of the destination Graphics context. |
int |
textHeight
This is the height of the text. |
int |
textPosition
The textPosition which can be Graphics.Right, Left, Up or Down. |
int |
textWidth
This is the height of the text. |
int |
width
This is the width of the IconAndText |
| Fields inherited from interface ewe.fx.IImage |
DISABLED, OUTLINED |
| Fields inherited from interface ewe.fx.ImageRefresher |
KEEP_VISIBLE |
| Constructor Summary | |
IconAndText()
|
|
IconAndText(IImage icon,
String text,
FontMetrics fontMetrics)
Create an IconAndText for the specified icon and text. |
|
IconAndText(IImage icon,
String text,
FontMetrics fontMetrics,
int textPosition)
Create an IconAndText for the specified icon and text. |
|
IconAndText(String text,
String iconName,
Object maskOrColor,
FontMetrics fm)
Create an IconAndText using the ImageCache. |
|
| Method Summary | |
void |
addColumn(Object textOrIcon)
This adds a new column of data along the line. |
void |
addColumn(Object textOrIcon,
int width,
int anchor)
This adds a new column of data along the line. |
void |
addColumn(Object textOrIcon,
int width,
int anchor,
int addIndex)
This adds a new column of data along the line. |
void |
changeFontMetrics(FontMetrics fontMetrics)
Change the Font used by the IconAndText and recalculate its size. |
boolean |
changeRefresher(ImageRefresher newRefresher,
ImageRefresher oldRefresher)
Change the ImageRefresher for the Image only if the old Refresher is the same as the one specified. |
void |
changeTextPosition(int textPosition,
int multiLineTextAlignment)
Change the text alignment parameters and recalculate the IconAndText size. |
void |
clear()
Set the icon and text to null and clear all column information. |
void |
clearColumns()
Clear all column information for this IconAndText. |
void |
draw(Graphics g,
int x,
int y,
int options)
Draw the full image at the specified co-ordinates in the graphics provided. |
void |
free()
This frees system resources associated with the Image. |
Color |
getBackground()
This returns a background color if one is set for the image. |
int |
getHeight()
This returns the height of the image. |
int[] |
getPixels(int[] dest,
int offset,
int x,
int y,
int width,
int height,
int options)
This always returns null. |
ImageRefresher |
getRefresher()
Retrieve the ImageRefresher for the image which is weakly referenced by the OnScreenImage. |
int |
getWidth()
This returns the width of the image. |
void |
refresh(IImage icon,
int options)
|
void |
set(IImage icon,
String text)
This can be used to change the icon and text, clearing any extra column data if any is present. |
void |
set(IImage icon,
String text,
FontMetrics fontMetrics,
int textPosition)
This can be used to reset the IconAndText to new icon and text. |
IconAndText |
setColor(Color textColor,
Color backgroundColor)
Set the text and background colors. |
void |
setRefresher(ImageRefresher refresher)
Weakly set the ImageRefresher for the Image. |
boolean |
usesAlpha()
This always returns false. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Field Detail |
public IImage icon
public String text
public String[] lines
public FontMetrics fontMetrics
public int textPosition
public int multiLineTextAlignment
public Color background
public Color textColor
public int width
public int height
public int textHeight
public int textWidth
| Constructor Detail |
public IconAndText()
public IconAndText(IImage icon,
String text,
FontMetrics fontMetrics,
int textPosition)
icon - The image to use for the icon.text - The text to display with the icon.fontMetrics - optional FontMetrics and Font to be used with the icon.
public IconAndText(IImage icon,
String text,
FontMetrics fontMetrics)
icon - The image to use for the icon.text - The text to display with the icon.fontMetrics - optional FontMetrics and Font to be used with the icon.
public IconAndText(String text,
String iconName,
Object maskOrColor,
FontMetrics fm)
text - The text for the IconAndTexticonName - The name of the saved image.maskOrColor - A name of a mask image or a color mask, or null.fm - optional FontMetrics to be used.| Method Detail |
public int[] getPixels(int[] dest,
int offset,
int x,
int y,
int width,
int height,
int options)
getPixels in interface IImagedest - The destination int array. If this is null then a new array should be created.offset - The offset into the array to start placing pixels.x - the x co-ordinate within the image.y - the y co-ordinate within the image.width - the width of the pixel block to get.height - the height of the pixel block to get.options - options for retrieving pixels - currently unused.
public boolean usesAlpha()
usesAlpha in interface IImagepublic void setRefresher(ImageRefresher refresher)
OnScreenImage
setRefresher in interface OnScreenImagepublic ImageRefresher getRefresher()
OnScreenImage
getRefresher in interface OnScreenImage
public boolean changeRefresher(ImageRefresher newRefresher,
ImageRefresher oldRefresher)
OnScreenImage
changeRefresher in interface OnScreenImagenewRefresher - The new ImageRefresher for the image.oldRefresher - What the old ImageRefresher was expected to be.
public void refresh(IImage icon,
int options)
refresh in interface ImageRefresher
public IconAndText setColor(Color textColor,
Color backgroundColor)
public void changeTextPosition(int textPosition,
int multiLineTextAlignment)
public void changeFontMetrics(FontMetrics fontMetrics)
public void set(IImage icon,
String text)
icon - The new icon to use.text - The new text to use.
public void set(IImage icon,
String text,
FontMetrics fontMetrics,
int textPosition)
icon - The new icon to use.text - The new text to use.public void clear()
public void clearColumns()
public void addColumn(Object textOrIcon,
int width,
int anchor)
textOrIcon - either a String or an IImage to display in this column.width - The width of this new column. If this is -1 then the width will be calculated.anchor - The anchor (either Graphics.RIGHT or LEFT OR'ed with TOP or BOTTOM) for the text or image.
public void addColumn(Object textOrIcon,
int width,
int anchor,
int addIndex)
textOrIcon - either a String or an IImage to display in this column.width - The width of this new column. If this is -1 then the width will be calculated.anchor - The anchor (one of Graphics.RIGHT or LEFT OR'ed with TOP or BOTTOM) for the text or image.addIndex - The index at which the column will be inserted, which may be -1 to
indicate that it should be added to the end.public void addColumn(Object textOrIcon)
textOrIcon - either a String or an IImage to display in this column.public int getHeight()
IImage
getHeight in interface IImagepublic int getWidth()
IImage
getWidth in interface IImage
public void draw(Graphics g,
int x,
int y,
int options)
IImage
draw in interface IImagepublic Color getBackground()
IImage
getBackground in interface IImagepublic void free()
IImage
free in interface IImage
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||