Package com.inductiveautomation.rm.base
Class RMAWTUtils
java.lang.Object
com.inductiveautomation.rm.base.RMListenerList
com.inductiveautomation.rm.base.RMObject
com.inductiveautomation.rm.base.RMAWTUtils
- All Implemented Interfaces:
- RMPropertyChanger,- Cloneable
This class has a bunch of convenience utility methods from drawing lines, RMRects, buttons, etc.
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voiddrawButton(Graphics2D g, double x, double y, double w, double h, boolean isPressed) Draws a button for the given rect with an option for pressed.static voiddrawButton(Graphics2D g, RMRect aRect, boolean isPressed) Draws a button for the given rect with an option for pressed.static voiddrawLine(Graphics2D g, double p1x, double p1y, double p2x, double p2y) Draws a line between the given points.static voiddrawLine(Graphics2D g, RMPoint p1, RMPoint p2) Draws a line between the given points.static voiddrawRect(Graphics2D g, double x, double y, double w, double h) Strokes the given rect.static voidfill3DRect(Graphics2D g, double x, double y, double w, double h, boolean isRaised) Fills the given rect with simple 3D button effect.static voidfill3DRect(Graphics2D g, RMRect aRect, boolean isRaised) Fills the given rect with simple 3D button effect.static voidfillRect(Graphics2D g, double x, double y, double w, double h) Fills the given rect.static ColorfromStringColor(String aString) Returns a Color from a String/hex representation.static InsetsfromStringInsets(String aString) Returns an Insets instance from given string.static BufferedImagegetBufferedImage(int aWidth, int aHeight, boolean withAlpha) Returns a compatible buffered image for width and height with given transparency.static BufferedImagegetBufferedImage(Image anImage) Returns a buffered image for an AWT image with transparency.static BufferedImagegetBufferedImage(Image anImage, boolean withAlpha) Returns a buffered image for an AWT image.static byte[]getBytesJPEG(Image anImage) Returns a JPeg byte array for the given buffered image.static byte[]getBytesPNG(Image anImage) Returns a PNG byte array for the given buffered image.static CursorA method to hide the cursor.static ImagegetImageForString(String aString, Font aFont) Returns an image for the given string and font.static CursorgetResizeCursor(int anEdgeMask) Returns a resize cursor for a rect edge mask.static BasicStrokegetStroke(float aStrokeWidth) Returns a basic stroke with the given stroke width.static booleanisCommandDown(InputEvent anEvent) Returns whether the given event has command down.static booleanisControlDown(InputEvent anEvent) Returns whether the given input event has control down.static booleansetAntialiasing(Graphics2D g, boolean aFlag) Turns antialiasing on or off for a given graphics (returns previous state).static StringtoStringColor(Color aColor) Returns a String/hex representation of a given color (eg, "#FF00D8").static StringtoStringInsets(Insets theInsets) Returns a string representation of a given Insets.Methods inherited from class com.inductiveautomation.rm.base.RMObjectaddPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChange, toStringMethods inherited from class com.inductiveautomation.rm.base.RMListenerListaddListener, clone, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
- 
Field Details- 
Stroke1
- 
StrokeDash1
- 
COMMAND_MASKpublic static final int COMMAND_MASK
- 
CONTROL_MASKpublic static final int CONTROL_MASK
- 
Arial8
- 
Arial10
- 
ArialBold10
- 
Arial11
- 
ArialBold11
- 
Arial12
- 
ArialBold12
- 
Arial14
- 
ArialBold14
- 
Helvetica10
- 
Helvetica11
- 
HelveticaBold11
- 
Helvetica12
- 
HelveticaBold12
 
- 
- 
Constructor Details- 
RMAWTUtilspublic RMAWTUtils()
 
- 
- 
Method Details- 
isCommandDownReturns whether the given event has command down.
- 
isControlDownReturns whether the given input event has control down.
- 
getStrokeReturns a basic stroke with the given stroke width.
- 
drawLineDraws a line between the given points.
- 
drawLineDraws a line between the given points.
- 
drawRectStrokes the given rect.
- 
fillRectFills the given rect.
- 
fill3DRectFills the given rect with simple 3D button effect.
- 
fill3DRectpublic static void fill3DRect(Graphics2D g, double x, double y, double w, double h, boolean isRaised) Fills the given rect with simple 3D button effect.
- 
drawButtonDraws a button for the given rect with an option for pressed.
- 
drawButtonpublic 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.
- 
setAntialiasingTurns antialiasing on or off for a given graphics (returns previous state).
- 
toStringInsetsReturns a string representation of a given Insets.
- 
fromStringInsetsReturns an Insets instance from given string.
- 
toStringColorReturns a String/hex representation of a given color (eg, "#FF00D8").
- 
fromStringColorReturns a Color from a String/hex representation.
- 
getResizeCursorReturns a resize cursor for a rect edge mask.
- 
getBytesJPEGReturns a JPeg byte array for the given buffered image.
- 
getBytesPNGReturns a PNG byte array for the given buffered image.
- 
getBufferedImageReturns a buffered image for an AWT image with transparency.
- 
getBufferedImageReturns a buffered image for an AWT image.
- 
getBufferedImageReturns a compatible buffered image for width and height with given transparency.
- 
getImageForStringReturns an image for the given string and font.
- 
getHiddenCursorA method to hide the cursor.
 
-