Package eu.bandm.tools.graficUtils
Class Draw
java.lang.Object
eu.bandm.tools.graficUtils.Draw
Provides static methods for more complex drawings.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
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
-
Method Details
-
drawText
public 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. UsesLineBreakMeasurer
to split the text into lines, andAffineTransform
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
- Parameters:
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 alignment
-
drawText
public 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. UsesLineBreakMeasurer
to split the text into lines. The positions can be described like this:--------------*p2 | bla bla bla | | foo | | | p1*--------------
- Parameters:
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 alignment
-
drawLine
Draws a line between two points. -
drawArrowPoints
public static void drawArrowPoints(Graphics gr, Point2D head, Point2D feathers, double len, double wid) Draws a line with one arrow head between two points. EmploysGeom.arrowEdges(Point2D,Point2D,double,double)
.- Parameters:
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 head
-
copyCoordinates
copies all coordinates, both position and size.- Parameters:
rect
- defines the coordinatescomp
- gets new coordinates
-
copyCoordinates
copies the position.- Parameters:
pos
- defines the positioncomp
- gets a new position
-
getCoordinates
delivers the coordinates as a rectangle
-