Class RMAWTUtils

All Implemented Interfaces:
RMPropertyChanger, Cloneable

public class RMAWTUtils extends RMObject
This class has a bunch of convenience utility methods from drawing lines, RMRects, buttons, etc.
  • Field Details

    • Stroke1

      public static final BasicStroke Stroke1
    • StrokeDash1

      public static final BasicStroke StrokeDash1
    • COMMAND_MASK

      public static final int COMMAND_MASK
    • CONTROL_MASK

      public static final int CONTROL_MASK
    • Arial8

      public static Font Arial8
    • Arial10

      public static Font Arial10
    • ArialBold10

      public static Font ArialBold10
    • Arial11

      public static Font Arial11
    • ArialBold11

      public static Font ArialBold11
    • Arial12

      public static Font Arial12
    • ArialBold12

      public static Font ArialBold12
    • Arial14

      public static Font Arial14
    • ArialBold14

      public static Font ArialBold14
    • Helvetica10

      public static Font Helvetica10
    • Helvetica11

      public static Font Helvetica11
    • HelveticaBold11

      public static Font HelveticaBold11
    • Helvetica12

      public static Font Helvetica12
    • HelveticaBold12

      public static Font HelveticaBold12
  • Constructor Details

    • RMAWTUtils

      public RMAWTUtils()
  • Method Details

    • isCommandDown

      public static boolean isCommandDown(InputEvent anEvent)
      Returns whether the given event has command down.
    • isControlDown

      public static boolean isControlDown(InputEvent anEvent)
      Returns whether the given input event has control down.
    • getStroke

      public static BasicStroke getStroke(float aStrokeWidth)
      Returns a basic stroke with the given stroke width.
    • drawLine

      public static void drawLine(Graphics2D g, RMPoint p1, RMPoint p2)
      Draws a line between the given points.
    • drawLine

      public static void drawLine(Graphics2D g, double p1x, double p1y, double p2x, double p2y)
      Draws a line between the given points.
    • drawRect

      public static void drawRect(Graphics2D g, double x, double y, double w, double h)
      Strokes the given rect.
    • fillRect

      public static void fillRect(Graphics2D g, double x, double y, double w, double h)
      Fills the given rect.
    • fill3DRect

      public static void fill3DRect(Graphics2D g, RMRect aRect, boolean isRaised)
      Fills the given rect with simple 3D button effect.
    • fill3DRect

      public static void fill3DRect(Graphics2D g, double x, double y, double w, double h, boolean isRaised)
      Fills the given rect with simple 3D button effect.
    • drawButton

      public static void drawButton(Graphics2D g, RMRect aRect, boolean isPressed)
      Draws a button for the given rect with an option for pressed.
    • drawButton

      public static void drawButton(Graphics2D g, double x, double y, double w, double h, boolean isPressed)
      Draws a button for the given rect with an option for pressed.
    • setAntialiasing

      public static boolean setAntialiasing(Graphics2D g, boolean aFlag)
      Turns antialiasing on or off for a given graphics (returns previous state).
    • toStringInsets

      public static String toStringInsets(Insets theInsets)
      Returns a string representation of a given Insets.
    • fromStringInsets

      public static Insets fromStringInsets(String aString)
      Returns an Insets instance from given string.
    • toStringColor

      public static String toStringColor(Color aColor)
      Returns a String/hex representation of a given color (eg, "#FF00D8").
    • fromStringColor

      public static Color fromStringColor(String aString)
      Returns a Color from a String/hex representation.
    • getResizeCursor

      public static Cursor getResizeCursor(int anEdgeMask)
      Returns a resize cursor for a rect edge mask.
    • getBytesJPEG

      public static byte[] getBytesJPEG(Image anImage)
      Returns a JPeg byte array for the given buffered image.
    • getBytesPNG

      public static byte[] getBytesPNG(Image anImage)
      Returns a PNG byte array for the given buffered image.
    • getBufferedImage

      public static BufferedImage getBufferedImage(Image anImage)
      Returns a buffered image for an AWT image with transparency.
    • getBufferedImage

      public static BufferedImage getBufferedImage(Image anImage, boolean withAlpha)
      Returns a buffered image for an AWT image.
    • getBufferedImage

      public static BufferedImage getBufferedImage(int aWidth, int aHeight, boolean withAlpha)
      Returns a compatible buffered image for width and height with given transparency.
    • getImageForString

      public static Image getImageForString(String aString, Font aFont)
      Returns an image for the given string and font.
    • getHiddenCursor

      public static Cursor getHiddenCursor()
      A method to hide the cursor.