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,- java.lang.Cloneable
 
 public class RMAWTUtils extends RMObject This class has a bunch of convenience utility methods from drawing lines, RMRects, buttons, etc.
- 
- 
Field SummaryFields Modifier and Type Field Description static java.awt.FontArial10static java.awt.FontArial11static java.awt.FontArial12static java.awt.FontArial14static java.awt.FontArial8static java.awt.FontArialBold10static java.awt.FontArialBold11static java.awt.FontArialBold12static java.awt.FontArialBold14static intCOMMAND_MASKstatic intCONTROL_MASKstatic java.awt.FontHelvetica10static java.awt.FontHelvetica11static java.awt.FontHelvetica12static java.awt.FontHelveticaBold11static java.awt.FontHelveticaBold12static java.awt.BasicStrokeStroke1static java.awt.BasicStrokeStrokeDash1
 - 
Constructor SummaryConstructors Constructor Description RMAWTUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddrawButton(java.awt.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(java.awt.Graphics2D g, RMRect aRect, boolean isPressed)Draws a button for the given rect with an option for pressed.static voiddrawLine(java.awt.Graphics2D g, double p1x, double p1y, double p2x, double p2y)Draws a line between the given points.static voiddrawLine(java.awt.Graphics2D g, RMPoint p1, RMPoint p2)Draws a line between the given points.static voiddrawRect(java.awt.Graphics2D g, double x, double y, double w, double h)Strokes the given rect.static voidfill3DRect(java.awt.Graphics2D g, double x, double y, double w, double h, boolean isRaised)Fills the given rect with simple 3D button effect.static voidfill3DRect(java.awt.Graphics2D g, RMRect aRect, boolean isRaised)Fills the given rect with simple 3D button effect.static voidfillRect(java.awt.Graphics2D g, double x, double y, double w, double h)Fills the given rect.static java.awt.ColorfromStringColor(java.lang.String aString)Returns a Color from a String/hex representation.static java.awt.InsetsfromStringInsets(java.lang.String aString)Returns an Insets instance from given string.static java.awt.image.BufferedImagegetBufferedImage(int aWidth, int aHeight, boolean withAlpha)Returns a compatible buffered image for width and height with given transparency.static java.awt.image.BufferedImagegetBufferedImage(java.awt.Image anImage)Returns a buffered image for an AWT image with transparency.static java.awt.image.BufferedImagegetBufferedImage(java.awt.Image anImage, boolean withAlpha)Returns a buffered image for an AWT image.static byte[]getBytesJPEG(java.awt.Image anImage)Returns a JPeg byte array for the given buffered image.static byte[]getBytesPNG(java.awt.Image anImage)Returns a PNG byte array for the given buffered image.static java.awt.CursorgetHiddenCursor()A method to hide the cursor.static java.awt.ImagegetImageForString(java.lang.String aString, java.awt.Font aFont)Returns an image for the given string and font.static java.awt.CursorgetResizeCursor(int anEdgeMask)Returns a resize cursor for a rect edge mask.static java.awt.BasicStrokegetStroke(float aStrokeWidth)Returns a basic stroke with the given stroke width.static booleanisCommandDown(java.awt.event.InputEvent anEvent)Returns whether the given event has command down.static booleanisControlDown(java.awt.event.InputEvent anEvent)Returns whether the given input event has control down.static booleansetAntialiasing(java.awt.Graphics2D g, boolean aFlag)Turns antialiasing on or off for a given graphics (returns previous state).static java.lang.StringtoStringColor(java.awt.Color aColor)Returns a String/hex representation of a given color (eg, "#FF00D8").static java.lang.StringtoStringInsets(java.awt.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, toString
 - 
Methods inherited from class com.inductiveautomation.rm.base.RMListenerListaddListener, clone, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
 
- 
 
- 
- 
- 
Field Detail- 
Stroke1public static final java.awt.BasicStroke Stroke1 
 - 
StrokeDash1public static final java.awt.BasicStroke StrokeDash1 
 - 
COMMAND_MASKpublic static final int COMMAND_MASK 
 - 
CONTROL_MASKpublic static final int CONTROL_MASK 
 - 
Arial8public static java.awt.Font Arial8 
 - 
Arial10public static java.awt.Font Arial10 
 - 
ArialBold10public static java.awt.Font ArialBold10 
 - 
Arial11public static java.awt.Font Arial11 
 - 
ArialBold11public static java.awt.Font ArialBold11 
 - 
Arial12public static java.awt.Font Arial12 
 - 
ArialBold12public static java.awt.Font ArialBold12 
 - 
Arial14public static java.awt.Font Arial14 
 - 
ArialBold14public static java.awt.Font ArialBold14 
 - 
Helvetica10public static java.awt.Font Helvetica10 
 - 
Helvetica11public static java.awt.Font Helvetica11 
 - 
HelveticaBold11public static java.awt.Font HelveticaBold11 
 - 
Helvetica12public static java.awt.Font Helvetica12 
 - 
HelveticaBold12public static java.awt.Font HelveticaBold12 
 
- 
 - 
Method Detail- 
isCommandDownpublic static boolean isCommandDown(java.awt.event.InputEvent anEvent) Returns whether the given event has command down.
 - 
isControlDownpublic static boolean isControlDown(java.awt.event.InputEvent anEvent) Returns whether the given input event has control down.
 - 
getStrokepublic static java.awt.BasicStroke getStroke(float aStrokeWidth) Returns a basic stroke with the given stroke width.
 - 
drawLinepublic static void drawLine(java.awt.Graphics2D g, RMPoint p1, RMPoint p2)Draws a line between the given points.
 - 
drawLinepublic static void drawLine(java.awt.Graphics2D g, double p1x, double p1y, double p2x, double p2y)Draws a line between the given points.
 - 
drawRectpublic static void drawRect(java.awt.Graphics2D g, double x, double y, double w, double h)Strokes the given rect.
 - 
fillRectpublic static void fillRect(java.awt.Graphics2D g, double x, double y, double w, double h)Fills the given rect.
 - 
fill3DRectpublic static void fill3DRect(java.awt.Graphics2D g, RMRect aRect, boolean isRaised)Fills the given rect with simple 3D button effect.
 - 
fill3DRectpublic static void fill3DRect(java.awt.Graphics2D g, double x, double y, double w, double h, boolean isRaised)Fills the given rect with simple 3D button effect.
 - 
drawButtonpublic static void drawButton(java.awt.Graphics2D g, RMRect aRect, boolean isPressed)Draws a button for the given rect with an option for pressed.
 - 
drawButtonpublic static void drawButton(java.awt.Graphics2D g, double x, double y, double w, double h, boolean isPressed)Draws a button for the given rect with an option for pressed.
 - 
setAntialiasingpublic static boolean setAntialiasing(java.awt.Graphics2D g, boolean aFlag)Turns antialiasing on or off for a given graphics (returns previous state).
 - 
toStringInsetspublic static java.lang.String toStringInsets(java.awt.Insets theInsets) Returns a string representation of a given Insets.
 - 
fromStringInsetspublic static java.awt.Insets fromStringInsets(java.lang.String aString) Returns an Insets instance from given string.
 - 
toStringColorpublic static java.lang.String toStringColor(java.awt.Color aColor) Returns a String/hex representation of a given color (eg, "#FF00D8").
 - 
fromStringColorpublic static java.awt.Color fromStringColor(java.lang.String aString) Returns a Color from a String/hex representation.
 - 
getResizeCursorpublic static java.awt.Cursor getResizeCursor(int anEdgeMask) Returns a resize cursor for a rect edge mask.
 - 
getBytesJPEGpublic static byte[] getBytesJPEG(java.awt.Image anImage) Returns a JPeg byte array for the given buffered image.
 - 
getBytesPNGpublic static byte[] getBytesPNG(java.awt.Image anImage) Returns a PNG byte array for the given buffered image.
 - 
getBufferedImagepublic static java.awt.image.BufferedImage getBufferedImage(java.awt.Image anImage) Returns a buffered image for an AWT image with transparency.
 - 
getBufferedImagepublic static java.awt.image.BufferedImage getBufferedImage(java.awt.Image anImage, boolean withAlpha)Returns a buffered image for an AWT image.
 - 
getBufferedImagepublic static java.awt.image.BufferedImage getBufferedImage(int aWidth, int aHeight, boolean withAlpha)Returns a compatible buffered image for width and height with given transparency.
 - 
getImageForStringpublic static java.awt.Image getImageForString(java.lang.String aString, java.awt.Font aFont)Returns an image for the given string and font.
 - 
getHiddenCursorpublic static java.awt.Cursor getHiddenCursor() A method to hide the cursor.
 
- 
 
-