Class JDRotatableLabel


public class JDRotatableLabel extends JDRectangular
  • Constructor Details

    • JDRotatableLabel

      public JDRotatableLabel(String objectName, String text, int x, int y)
      Construcxt a label.
      Parameters:
      objectName - Name of this label
      text - Text (Single line only)
      x - Up left corner x coordinate
      y - Up left corner y coordinate
  • Method Details

    • isInsideObject

      public boolean isInsideObject(int x, int y)
      Overrides:
      isInsideObject in class JDObject
      Parameters:
      x - X coordinate (pixel)
      y - Y coordinate (pixel)
      Returns:
      whether the specified point is inside this object.
    • copy

      public JDObject copy(int x, int y)
      Description copied from class: JDObject
      Returns a copy of this object at the specified location.
      Specified by:
      copy in class JDObject
      Parameters:
      x - Horizontal position of the copied object (pixel)
      y - Vertical Position of the copied object (pixel)
      Returns:
      The copy of this object.
    • paint

      public void paint(JDrawEditor parent, Graphics g)
      Description copied from class: JDObject
      Paints this object.
      Overrides:
      paint in class JDRectangular
      Parameters:
      parent - JdrawEditor parent (Can be null except for JDSwingObject)
      g - the specified Graphics window
    • setFont

      public void setFont(Font f)
      Sets the Font of this label.
      Parameters:
      f - Font
    • setFont

      public void setFont(Font f, boolean resize)
      Sets the font of this label and resize it if needed and specified.
      Parameters:
      f - Font
      resize - true to resize label when text is out of bounds.
    • getFont

      public Font getFont()
      Returns:
      the current font of this label.
    • setAngle

      public void setAngle(double a)
      Sets the text rotation angle.
    • getAngle

      public double getAngle()
      Returns:
      the current text rotation angle.
      See Also:
    • setText

      public void setText(String s)
      Sets the text of this label.
      Parameters:
      s - Text value
    • setText

      public void setText(String s, boolean resize)
      Sets the text of this label and resize label if desried.
      Parameters:
      s - Text value
      resize - true to resize label when text is out of bounds.
    • getText

      public String getText()
      Returns:
      the current label text.
    • rotate90

      public void rotate90(double x, double y)
      Description copied from class: JDObject
      Rotate the object by 90deg. A call to refresh() is needed after transformation.
      Overrides:
      rotate90 in class JDRectangular
      Parameters:
      x - Rotation center horizontal pos
      y - Rotation center vertical pos
      See Also:
    • restoreTransform

      public void restoreTransform()
      Description copied from class: JDObject
      Restore original shape previously backuped by saveTransform
      Overrides:
      restoreTransform in class JDObject
      See Also:
    • saveTransform

      public void saveTransform()
      Description copied from class: JDObject
      Backup the shape. This can be usefull when making scaling animation, after multiple scale the rounding may result in deformed shape. To avoid this you can use saveTransform() and restoreTransform(). Note: This is done once when JDrawEditor.loadFile() is called().
      Overrides:
      saveTransform in class JDObject
      See Also: