Class Draw

java.lang.Object
eu.bandm.tools.graficUtils.Draw

public class Draw extends Object
Provides static methods for more complex drawings.
  • 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. Uses 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
      
      Parameters:
      gr - The graphics to draw to.
      p1 - left point of the top line of the text block
      p2 - right point of the top line of the text block
      p3 - left point of the last line of the text block (may be overstepped if necessary!)
      text - text to write
      hori - horizontal alignment
      vert - 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. Uses LineBreakMeasurer 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 block
      p2 - right point of the top line of the text block (may be overstepped if necessary!)
      text - text to write
      hori - horizontal alignment
      vert - vertical alignment
    • drawLine

      public static void drawLine(Graphics gr, Point2D f, Point2D t)
      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. Employs Geom.arrowEdges(Point2D,Point2D,double,double).
      Parameters:
      gr - The graphics to draw to.
      head - the point with the arrow head
      feathers - the point with no head
      len - the depth of the arrow head
      wid - the width of the arrow head
    • copyCoordinates

      public static void copyCoordinates(Rectangle2D rect, JComponent comp)
      copies all coordinates, both position and size.
      Parameters:
      rect - defines the coordinates
      comp - gets new coordinates
    • copyCoordinates

      public static void copyCoordinates(Point2D pos, JComponent comp)
      copies the position.
      Parameters:
      pos - defines the position
      comp - gets a new position
    • getCoordinates

      public static Rectangle2D.Double getCoordinates(JComponent comp)
      delivers the coordinates as a rectangle