org.omegahat.Graphics.Primitives
Class StringIcon

java.lang.Object
  |
  +--org.omegahat.Graphics.Primitives.GraphicalObject
        |
        +--org.omegahat.Graphics.Primitives.RGO
              |
              +--org.omegahat.Graphics.Primitives.TextPrimitive
                    |
                    +--org.omegahat.Graphics.Primitives.StringIcon
All Implemented Interfaces:
GraphicalComponentInt, javax.swing.Icon

public class StringIcon
extends TextPrimitive
implements javax.swing.Icon

A string used as an icon, for graphics.

This class implements the Swing Icon interface, and extends the rectangular graphical object so that string icons can be used as graphical objects in plots.

While this class does not extend the IconPrimitive class, a string icon can be converted into an IconPrimitive by calling its toIcon method. Basically, the two classes are alternatives in supplying icons for plotting, the text case more economical but less general.


Field Summary
static boolean verbose
           
 
Fields inherited from class org.omegahat.Graphics.Primitives.TextPrimitive
angle, text
 
Fields inherited from class org.omegahat.Graphics.Primitives.RGO
region
 
Fields inherited from class org.omegahat.Graphics.Primitives.GraphicalObject
ACTIVE, fontSize, lastDevice, lastHeightCM, lastRegion, lastWidthCM, parents, status, VISIBLE
 
Constructor Summary
StringIcon()
           
StringIcon(double x, double y)
           
StringIcon(java.lang.String text, double x, double y)
           
StringIcon(java.lang.String text, double x, double y, int Unit)
           
 
Method Summary
 void draw(RectRegion rr, Scale sx, Scale sy, int origin, double widthCM, double heightCM, int fontSize, OutputDevice od, GraphicalContainerInt parentId)
           
 int getIconHeight()
           
 int getIconWidth()
          the iconWidth and iconHeight (actually only defined in the context of a graphics object).
 void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
           
static boolean setVerbose(boolean on)
           
 IconPrimitive toIcon(javax.swing.Icon i)
           
 
Methods inherited from class org.omegahat.Graphics.Primitives.TextPrimitive
draw, getAngle, getText, setAngle, setText, toString
 
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, wait, wait, wait
 

Field Detail

verbose

public static boolean verbose
Constructor Detail

StringIcon

public StringIcon()

StringIcon

public StringIcon(java.lang.String text,
                  double x,
                  double y,
                  int Unit)

StringIcon

public StringIcon(java.lang.String text,
                  double x,
                  double y)

StringIcon

public StringIcon(double x,
                  double y)
Method Detail

getIconWidth

public int getIconWidth()
the iconWidth and iconHeight (actually only defined in the context of a graphics object).

Calling this outside of a graphics drawing context gets the last value computed during a drawing operation.

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

toIcon

public IconPrimitive toIcon(javax.swing.Icon i)

draw

public void draw(RectRegion rr,
                 Scale sx,
                 Scale sy,
                 int origin,
                 double widthCM,
                 double heightCM,
                 int fontSize,
                 OutputDevice od,
                 GraphicalContainerInt parentId)

setVerbose

public static boolean setVerbose(boolean on)