public class TextAnnotationPositioned
extends java.lang.Object
A class to encapsulate a text annotation positioned left or right and top or bottom with row offset relative to an abstract rectanglular frame.
Constructor and Description |
---|
TextAnnotationPositioned(java.lang.String string,
boolean fromLeft,
boolean fromTop,
int textRow) |
Modifier and Type | Method and Description |
---|---|
static void |
drawHorizontallyCenteredString(java.lang.String string,
boolean fromTop,
java.awt.Graphics2D g2d,
java.awt.Component window,
int topAndBottomMargin) |
static void |
drawPositionedString(java.lang.String string,
boolean fromLeft,
boolean fromTop,
int textRow,
java.awt.Graphics2D g2d,
java.awt.Component window,
int topAndBottomMargin,
int leftAndRightMargin) |
static void |
drawPositionedString(java.lang.String string,
boolean fromLeft,
boolean fromTop,
int textRow,
java.awt.Graphics2D g2d,
java.awt.FontMetrics fontMetrics,
int stringHeight,
int displayedAreaWidth,
int displayedAreaHeight,
int topAndBottomMargin,
int leftAndRightMargin) |
static void |
drawPositionedString(TextAnnotationPositioned annotation,
java.awt.Graphics2D g2d,
java.awt.Component window,
int topAndBottomMargin,
int leftAndRightMargin) |
static void |
drawPositionedString(TextAnnotationPositioned annotation,
java.awt.Graphics2D g2d,
java.awt.FontMetrics fontMetrics,
int stringHeight,
int displayedAreaWidth,
int displayedAreaHeight,
int topAndBottomMargin,
int leftAndRightMargin) |
static void |
drawPositionedString(TextAnnotationPositioned annotation,
java.awt.Graphics2D g2d,
int displayedAreaWidth,
int displayedAreaHeight,
int topAndBottomMargin,
int leftAndRightMargin) |
static void |
drawVerticallyCenteredString(java.lang.String string,
boolean fromLeft,
java.awt.Graphics2D g2d,
java.awt.Component window,
int leftAndRightMargin) |
static void |
drawVerticallyCenteredString(java.lang.String string,
boolean fromLeft,
java.awt.Graphics2D g2d,
java.awt.Component window,
int verticalOffset,
int leftAndRightMargin) |
java.lang.String |
getString()
Get the text of the annotation.
|
int |
getTextRow()
Get the text row.
|
boolean |
isLeft()
Get the position relative to the left or right of the frame.
|
boolean |
isTop()
Get the position relative to the top or bottom of the frame.
|
public TextAnnotationPositioned(java.lang.String string, boolean fromLeft, boolean fromTop, int textRow)
string
- the annotationfromLeft
- true if positioned at the left of the frame, false if rightfromTop
- true if positioned at the top of the frame, false if bottomtextRow
- the number of text rows from the top or bottom (numbered from 0)public static void drawHorizontallyCenteredString(java.lang.String string, boolean fromTop, java.awt.Graphics2D g2d, java.awt.Component window, int topAndBottomMargin)
string
- the text to be drawnfromTop
- true if positioned at the top of the frame, false if bottomg2d
- the drawing contextwindow
- the actual component being drawn intotopAndBottomMargin
- the margin to allow at the top and bottom of the frame, in pixelspublic static void drawPositionedString(java.lang.String string, boolean fromLeft, boolean fromTop, int textRow, java.awt.Graphics2D g2d, java.awt.Component window, int topAndBottomMargin, int leftAndRightMargin)
string
- the text to be drawnfromLeft
- true if positioned at the left of the frame, false if rightfromTop
- true if positioned at the top of the frame, false if bottomtextRow
- the number of text rows from the top or bottom (numbered from 0)g2d
- the drawing contextwindow
- the actual component being drawn intotopAndBottomMargin
- the margin to allow at the top and bottom of the frame, in pixelsleftAndRightMargin
- the margin to allow at the left and right of the frame, in pixelspublic static void drawPositionedString(java.lang.String string, boolean fromLeft, boolean fromTop, int textRow, java.awt.Graphics2D g2d, java.awt.FontMetrics fontMetrics, int stringHeight, int displayedAreaWidth, int displayedAreaHeight, int topAndBottomMargin, int leftAndRightMargin)
string
- the text to be drawnfromLeft
- true if positioned at the left of the frame, false if rightfromTop
- true if positioned at the top of the frame, false if bottomtextRow
- the number of text rows from the top or bottom (numbered from 0)g2d
- the drawing contextfontMetrics
- the font metrics (already extracted from g2d, with which it must be consistent)stringHeight
- the height used for all rows of text (already extracted from fontMetrics, with which it must be consistent)displayedAreaWidth
- the width of the frame being drawn into, in pixelsdisplayedAreaHeight
- the height of the frame being drawn into, in pixelstopAndBottomMargin
- the margin to allow at the top and bottom of the frame, in pixelsleftAndRightMargin
- the margin to allow at the left and right of the frame, in pixelspublic static void drawPositionedString(TextAnnotationPositioned annotation, java.awt.Graphics2D g2d, java.awt.Component window, int topAndBottomMargin, int leftAndRightMargin)
annotation
- the text and position to be drawng2d
- the drawing contextwindow
- the actual component being drawn intotopAndBottomMargin
- the margin to allow at the top and bottom of the frame, in pixelsleftAndRightMargin
- the margin to allow at the left and right of the frame, in pixelspublic static void drawPositionedString(TextAnnotationPositioned annotation, java.awt.Graphics2D g2d, java.awt.FontMetrics fontMetrics, int stringHeight, int displayedAreaWidth, int displayedAreaHeight, int topAndBottomMargin, int leftAndRightMargin)
annotation
- the text and position to be drawng2d
- the drawing contextfontMetrics
- the font metrics (already extracted from g2d, with which it must be consistent)stringHeight
- the height used for all rows of text (already extracted from fontMetrics, with which it must be consistent)displayedAreaWidth
- the width of the frame being drawn into, in pixelsdisplayedAreaHeight
- the height of the frame being drawn into, in pixelstopAndBottomMargin
- the margin to allow at the top and bottom of the frame, in pixelsleftAndRightMargin
- the margin to allow at the left and right of the frame, in pixelspublic static void drawPositionedString(TextAnnotationPositioned annotation, java.awt.Graphics2D g2d, int displayedAreaWidth, int displayedAreaHeight, int topAndBottomMargin, int leftAndRightMargin)
annotation
- the text and position to be drawng2d
- the drawing contextdisplayedAreaWidth
- the width of the frame being drawn into, in pixelsdisplayedAreaHeight
- the height of the frame being drawn into, in pixelstopAndBottomMargin
- the margin to allow at the top and bottom of the frame, in pixelsleftAndRightMargin
- the margin to allow at the left and right of the frame, in pixelspublic static void drawVerticallyCenteredString(java.lang.String string, boolean fromLeft, java.awt.Graphics2D g2d, java.awt.Component window, int leftAndRightMargin)
string
- the text to be drawnfromLeft
- true if positioned at the left of the frame, false if rightg2d
- the drawing contextwindow
- the actual component being drawn intoleftAndRightMargin
- the margin to allow at the left and right of the frame, in pixelspublic static void drawVerticallyCenteredString(java.lang.String string, boolean fromLeft, java.awt.Graphics2D g2d, java.awt.Component window, int verticalOffset, int leftAndRightMargin)
string
- the text to be drawnfromLeft
- true if positioned at the left of the frame, false if rightg2d
- the drawing contextwindow
- the actual component being drawn intoverticalOffset
- a downwards offset from the vertical center, in text rows (not pixels)leftAndRightMargin
- the margin to allow at the left and right of the frame, in pixelspublic java.lang.String getString()
Get the text of the annotation.
public int getTextRow()
Get the text row.
public boolean isLeft()
Get the position relative to the left or right of the frame.
public boolean isTop()
Get the position relative to the top or bottom of the frame.