org.omegahat.Graphics.Primitives
Class IconPrimitive
java.lang.Object
|
+--org.omegahat.Graphics.Primitives.GraphicalObject
|
+--org.omegahat.Graphics.Primitives.RGO
|
+--org.omegahat.Graphics.Primitives.IconPrimitive
- All Implemented Interfaces:
- GraphicalComponentInt, javax.swing.Icon
- public class IconPrimitive
- extends RGO
- implements javax.swing.Icon
General Swing-style icons as rectangular graphical objects.
Objects from this class contain an icon object; that is, an object
that implements the Swing Icon interface.
While this class can be used directly to display arbitrary icons, it is
likely to be more useful to extend the class.
For one thing, icons as such are defined in fixed, pixel units, so
re-scaling of the drawn object is not directly supported, making icons
less flexible than most graphical objects.
| Fields inherited from class org.omegahat.Graphics.Primitives.RGO |
region |
|
Method Summary |
Region |
draw(RectRegion rr,
ScaleInt sx,
ScaleInt sy,
int origin,
double widthCM,
double heightCM,
int fontSize,
OutputDevice od,
GraphicalContainerInt parentId)
draw the object in the rectangular region rr, using scales sx and sy. |
javax.swing.Icon |
getIcon()
|
int |
getIconHeight()
|
int |
getIconWidth()
|
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
|
void |
setIcon(javax.swing.Icon icon)
|
| Methods inherited from class org.omegahat.Graphics.Primitives.RGO |
center, centre, createRegionDescription, createRegionDescription, getRegion, height, height, setHJust, setRegion, setVJust, width, width, x, x, y, y |
| Methods inherited from class org.omegahat.Graphics.Primitives.GraphicalObject |
cacheSize, getFontSize, getFontSize, getParameters, getParents, getStatus, isActive, isVisible, lastHeightCM, lastRegion, lastWidthCM, parent, parent, parents, setActive, setParameters, setParents, setVisible |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IconPrimitive
public IconPrimitive()
IconPrimitive
public IconPrimitive(javax.swing.Icon i,
double x,
double y,
int Unit)
getIconWidth
public int getIconWidth()
- Specified by:
getIconWidth in interface javax.swing.Icon
getIconHeight
public int getIconHeight()
- Specified by:
getIconHeight in interface javax.swing.Icon
paintIcon
public void paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
- Specified by:
paintIcon in interface javax.swing.Icon
getIcon
public javax.swing.Icon getIcon()
setIcon
public void setIcon(javax.swing.Icon icon)
draw
public Region draw(RectRegion rr,
ScaleInt sx,
ScaleInt sy,
int origin,
double widthCM,
double heightCM,
int fontSize,
OutputDevice od,
GraphicalContainerInt parentId)
- Description copied from class:
GraphicalObject
- draw the object in the rectangular region rr, using scales sx and sy.
- Overrides:
draw in class GraphicalObject
- Following copied from interface:
org.omegahat.Graphics.Primitives.GraphicalComponentInt
- Parameters:
rr - the parents RectRegion in normalized device coordinates (NDC).sx - the parent's horizontal scale for transforming between arbitrary units.sy - the parent's vertical scale for transforming between arbitrary units.origin - the parent's origin position.