ij.gui
Class TextRoi

java.lang.Object
  extended by ij.gui.Roi
      extended by ij.gui.TextRoi
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class TextRoi
extends Roi

This class is a rectangular ROI containing text.

See Also:
Serialized Form

Field Summary
static int CENTER
           
static int LEFT
           
static int RIGHT
           
 
Fields inherited from class ij.gui.Roi
ANGLE, asp_bk, aspect, cachedMask, center, clipboard, clipHeight, clipWidth, clipX, clipY, COMPOSITE, constrain, CONSTRUCTING, defaultFillColor, fillColor, FREELINE, FREEROI, HANDLE_SIZE, handleColor, ic, imp, instanceColor, LINE, lineWidth, mag, MOVING, MOVING_HANDLE, nonScalable, NORMAL, NOT_PASTING, oldHeight, oldWidth, oldX, oldY, onePixelWide, OVAL, overlay, pasteMode, POINT, POLYGON, POLYLINE, previousRoi, RECTANGLE, RESIZING, ROIColor, stroke, strokeColor, TRACED_ROI, type, updateFullWindow, wideLine, xMax, yMax
 
Constructor Summary
TextRoi(double x, double y, java.lang.String text)
          Creates a TextRoi using sub-pixel coordinates.
TextRoi(double x, double y, java.lang.String text, java.awt.Font font)
          Creates a TextRoi with the specified sub-pixel location and Font.
TextRoi(int x, int y, ImagePlus imp)
           
TextRoi(int x, int y, java.lang.String text)
          Creates a TextRoi.
TextRoi(int x, int y, java.lang.String text, java.awt.Font font)
          Creates a TextRoi with the specified location and Font.
TextRoi(int x, int y, java.lang.String text, java.awt.Font font, java.awt.Color color)
          Deprecated.  
 
Method Summary
 void addChar(char c)
          This method is used by the text tool to add typed characters to displayed text selections.
 void clear(ImageProcessor ip)
           
 java.lang.Object clone()
          Returns a copy of this TextRoi.
 void draw(java.awt.Graphics g)
          Draws the text on the screen, clipped to the ROI.
 void drawOverlay(java.awt.Graphics g)
           
 void drawPixels(ImageProcessor ip)
          Renders the text on the image.
 boolean getAntialiased()
          Returns the state of the 'antialiased' instance variable.
 java.awt.Font getCurrentFont()
          Returns the current (instance) font.
static java.lang.String getFont()
          Returns the name of the global font.
static int getGlobalJustification()
          Returns the value of the 'justification' instance variable (LEFT, CENTER or RIGHT).
 int getJustification()
          Returns the value of the 'justification' instance variable (LEFT, CENTER or RIGHT).
 java.lang.String getMacroCode(ImageProcessor ip)
           
static int getSize()
          Returns the global font size.
static int getStyle()
          Returns the global font style.
 java.lang.String getText()
           
protected  void handleMouseUp(int screenX, int screenY)
           
static boolean isAntialiased()
          Returns the state of global 'antialiasedText' variable, which is used by the "Fonts" widget.
 boolean isDrawingTool()
          Returns 'true' if this is an ROI primarily used from drawing (e.g., TextRoi or Arrow).
static void recordSetFont()
           
 void setAntialiased(boolean antialiased)
          Sets the 'antialiased' instance variable.
 void setCurrentFont(java.awt.Font font)
          Set the current (instance) font.
static void setFont(java.lang.String fontName, int fontSize, int fontStyle)
          Sets the global font face, size and style that will be used by TextROIs interactively created using the text tool.
static void setFont(java.lang.String fontName, int fontSize, int fontStyle, boolean antialiased)
          Sets the font face, size, style and antialiasing mode that will be used by TextROIs interactively created using the text tool.
static void setGlobalJustification(int justification)
          Sets the 'justification' instance variable (must be LEFT, CENTER or RIGHT)
 void setJustification(int justification)
          Sets the 'justification' instance variable (must be LEFT, CENTER or RIGHT)
 
Methods inherited from class ij.gui.Roi
abortPaste, clipRectMargin, contains, copyAttributes, drawPixels, endPaste, equals, getAngle, getBoundingRect, getBounds, getColor, getConvexHull, getCornerDiameter, getCPosition, getCurrentPasteMode, getDefaultFillColor, getDrawOffset, getFeretsDiameter, getFeretValues, getFillColor, getFloatPolygon, getImage, getImageID, getLength, getMagnification, getMask, getName, getPasteMode, getPolygon, getPosition, getPrototypeOverlay, getRoundRectArcSize, getScaledStroke, getState, getStroke, getStrokeColor, getStrokeWidth, getTPosition, getType, getTypeAsString, getZPosition, grow, handleMouseDown, handleMouseDrag, isArea, isHandle, isLine, isVisible, mouseDownInHandle, moveHandle, nudge, nudgeCorner, screenX, screenXD, screenY, screenYD, setColor, setCornerDiameter, setDefaultFillColor, setDrawOffset, setFillColor, setImage, setInstanceColor, setLineWidth, setLocation, setName, setNonScalable, setPasteMode, setPosition, setPosition, setPrototypeOverlay, setRoundRectArcSize, setStroke, setStrokeColor, setStrokeWidth, setStrokeWidth, showStatus, startPaste, subPixelResolution, temporarilyHide, toFloat, toInt, toInt, toIntR, toString, update, updateClipRect, updateWideLine
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
See Also:
Constant Field Values

CENTER

public static final int CENTER
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values
Constructor Detail

TextRoi

public TextRoi(int x,
               int y,
               java.lang.String text)
Creates a TextRoi.


TextRoi

public TextRoi(double x,
               double y,
               java.lang.String text)
Creates a TextRoi using sub-pixel coordinates.


TextRoi

public TextRoi(int x,
               int y,
               java.lang.String text,
               java.awt.Font font)
Creates a TextRoi with the specified location and Font.

See Also:
Roi.setStrokeColor(java.awt.Color), Roi.setNonScalable(boolean), ImagePlus.setOverlay(ij.gui.Overlay)

TextRoi

public TextRoi(double x,
               double y,
               java.lang.String text,
               java.awt.Font font)
Creates a TextRoi with the specified sub-pixel location and Font.


TextRoi

public TextRoi(int x,
               int y,
               java.lang.String text,
               java.awt.Font font,
               java.awt.Color color)
Deprecated. 


TextRoi

public TextRoi(int x,
               int y,
               ImagePlus imp)
Method Detail

addChar

public void addChar(char c)
This method is used by the text tool to add typed characters to displayed text selections.


drawPixels

public void drawPixels(ImageProcessor ip)
Renders the text on the image.

Overrides:
drawPixels in class Roi
See Also:
ImageProcessor.setColor(java.awt.Color), ImageProcessor.setLineWidth(int)

draw

public void draw(java.awt.Graphics g)
Draws the text on the screen, clipped to the ROI.

Overrides:
draw in class Roi

drawOverlay

public void drawOverlay(java.awt.Graphics g)
Overrides:
drawOverlay in class Roi

getFont

public static java.lang.String getFont()
Returns the name of the global font.


getSize

public static int getSize()
Returns the global font size.


getStyle

public static int getStyle()
Returns the global font style.


setCurrentFont

public void setCurrentFont(java.awt.Font font)
Set the current (instance) font.


getCurrentFont

public java.awt.Font getCurrentFont()
Returns the current (instance) font.


isAntialiased

public static boolean isAntialiased()
Returns the state of global 'antialiasedText' variable, which is used by the "Fonts" widget.


setAntialiased

public void setAntialiased(boolean antialiased)
Sets the 'antialiased' instance variable.


getAntialiased

public boolean getAntialiased()
Returns the state of the 'antialiased' instance variable.


setGlobalJustification

public static void setGlobalJustification(int justification)
Sets the 'justification' instance variable (must be LEFT, CENTER or RIGHT)


getGlobalJustification

public static int getGlobalJustification()
Returns the value of the 'justification' instance variable (LEFT, CENTER or RIGHT).


setJustification

public void setJustification(int justification)
Sets the 'justification' instance variable (must be LEFT, CENTER or RIGHT)


getJustification

public int getJustification()
Returns the value of the 'justification' instance variable (LEFT, CENTER or RIGHT).


setFont

public static void setFont(java.lang.String fontName,
                           int fontSize,
                           int fontStyle)
Sets the global font face, size and style that will be used by TextROIs interactively created using the text tool.


setFont

public static void setFont(java.lang.String fontName,
                           int fontSize,
                           int fontStyle,
                           boolean antialiased)
Sets the font face, size, style and antialiasing mode that will be used by TextROIs interactively created using the text tool.


handleMouseUp

protected void handleMouseUp(int screenX,
                             int screenY)
Overrides:
handleMouseUp in class Roi

getMacroCode

public java.lang.String getMacroCode(ImageProcessor ip)

getText

public java.lang.String getText()

recordSetFont

public static void recordSetFont()

isDrawingTool

public boolean isDrawingTool()
Description copied from class: Roi
Returns 'true' if this is an ROI primarily used from drawing (e.g., TextRoi or Arrow).

Overrides:
isDrawingTool in class Roi

clear

public void clear(ImageProcessor ip)

clone

public java.lang.Object clone()
Returns a copy of this TextRoi.

Overrides:
clone in class Roi