public class Draw extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Draw.Align |
Constructor and Description |
---|
Draw() |
Modifier and Type | Method and Description |
---|---|
static void |
copyCoordinates(Point2D pos,
JComponent comp)
copies the position.
|
static void |
copyCoordinates(Rectangle2D rect,
JComponent comp)
copies all coordinates, both position and size.
|
static void |
drawArrowPoints(Graphics gr,
Point2D head,
Point2D feathers,
double len,
double wid)
Draws a line with one arrow head between two points.
|
static void |
drawLine(Graphics gr,
Point2D f,
Point2D t)
Draws a line between two points.
|
static void |
drawText(Graphics2D gr,
Point2D p1,
Point2D p2,
Point2D p3,
String text,
Draw.Align hori,
Draw.Align vert)
Draws a multitude of text lines in an arbitrary angle.
|
static void |
drawText(Graphics2D gr,
Point2D p1,
Point2D p2,
String text,
Draw.Align hori,
Draw.Align vert)
Draws a multitude of text lines in a orthogonal area.
|
static Rectangle2D.Double |
getCoordinates(JComponent comp)
delivers the coordinates as a rectangle
|
public static void drawText(Graphics2D gr, Point2D p1, Point2D p2, Point2D p3, String text, Draw.Align hori, Draw.Align vert)
LineBreakMeasurer
to split the text into lines,
and AffineTransform
for calculating the text positions.
The positions can be described like this:
____----* p2 ____---- R S T ____---- E F I p1*---- T L I N \T E X \ v * p3
gr
- The graphics to draw to.p1
- left point of the top line of the text blockp2
- right point of the top line of the text blockp3
- left point of the last line of the text block
(may be overstepped if necessary!)text
- text to writehori
- horizontal alignmentvert
- vertical alignmentpublic static void drawText(Graphics2D gr, Point2D p1, Point2D p2, String text, Draw.Align hori, Draw.Align vert)
LineBreakMeasurer
to split the text into lines.
The positions can be described like this:
--------------*p2 | bla bla bla | | foo | | | p1*--------------
gr
- The graphics to draw to.p1
- left point of the bottom line of the text blockp2
- right point of the top line of the text block
(may be overstepped if necessary!)text
- text to writehori
- horizontal alignmentvert
- vertical alignmentpublic static void drawLine(Graphics gr, Point2D f, Point2D t)
public static void drawArrowPoints(Graphics gr, Point2D head, Point2D feathers, double len, double wid)
Geom.arrowEdges(Point2D,Point2D,double,double)
.gr
- The graphics to draw to.head
- the point with the arrow headfeathers
- the point with no headlen
- the depth of the arrow headwid
- the width of the arrow headpublic static void copyCoordinates(Rectangle2D rect, JComponent comp)
rect
- defines the coordinatescomp
- gets new coordinatespublic static void copyCoordinates(Point2D pos, JComponent comp)
pos
- defines the positioncomp
- gets a new positionpublic static Rectangle2D.Double getCoordinates(JComponent comp)
see also the complete user documentation .