Package com.reportmill.base
Class RMAWTUtils
- java.lang.Object
-
- com.reportmill.base.RMObject
-
- com.reportmill.base.RMAWTUtils
-
- All Implemented Interfaces:
RMArchiver.Archiving
,java.lang.Cloneable
public class RMAWTUtils extends RMObject
This class has a bunch of convenience utility methods from drawing lines, RMRects, buttons, etc.
-
-
Field Summary
Fields Modifier and Type Field Description static java.awt.Font
Arial8
static int
COMMAND_MASK
static int
CONTROL_MASK
static java.awt.Font
Helvetica10
static java.awt.Font
Helvetica11
static java.awt.Font
Helvetica12
static java.awt.Font
Helvetica14
static java.awt.Font
HelveticaBold10
static java.awt.Font
HelveticaBold11
static java.awt.Font
HelveticaBold12
static java.awt.Font
HelveticaBold14
static java.awt.BasicStroke
Stroke1
static java.awt.BasicStroke
StrokeDash1
-
Constructor Summary
Constructors Constructor Description RMAWTUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
drawButton(java.awt.Graphics2D g, float x, float y, float w, float h, boolean isPressed)
Draws a button for the given rect with an option for pressed.static void
drawButton(java.awt.Graphics2D g, RMRect aRect, boolean isPressed)
Draws a button for the given rect with an option for pressed.static void
drawLine(java.awt.Graphics2D g, float p1x, float p1y, float p2x, float p2y)
Draws a line between the given points.static void
drawLine(java.awt.Graphics2D g, RMPoint p1, RMPoint p2)
Draws a line between the given points.static void
drawRect(java.awt.Graphics2D g, float x, float y, float w, float h)
Strokes the given rect.static void
fill3DRect(java.awt.Graphics2D g, float x, float y, float w, float h, boolean isRaised)
Fills the given rect with simple 3D button effect.static void
fill3DRect(java.awt.Graphics2D g, RMRect aRect, boolean isRaised)
Fills the given rect with simple 3D button effect.static void
fillRect(java.awt.Graphics2D g, float x, float y, float w, float h)
Fills the given rect.static java.awt.image.BufferedImage
getBufferedImage(java.awt.Image anImage)
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.BasicStroke
getStroke(float aStrokeWidth)
Returns a basic stroke with the given stroke width.static boolean
isCommandDown(java.awt.event.InputEvent anEvent)
Returns whether the given event has command down.static boolean
isControlDown(java.awt.event.InputEvent anEvent)
Returns whether the given input event has control down.static void
setAntialiasing(java.awt.Graphics2D g, boolean aFlag)
Turns antialiasing on or off for a given graphics.-
Methods inherited from class com.reportmill.base.RMObject
clone, copy, didChange, didUndo, getAnimAttribute, getClassNameShort, initWithArchiver, undoClone, undoCopy, undoEquals
-
-
-
-
Field Detail
-
Stroke1
public static final java.awt.BasicStroke Stroke1
-
StrokeDash1
public static final java.awt.BasicStroke StrokeDash1
-
COMMAND_MASK
public static final int COMMAND_MASK
-
CONTROL_MASK
public static final int CONTROL_MASK
-
Arial8
public static java.awt.Font Arial8
-
Helvetica10
public static java.awt.Font Helvetica10
-
HelveticaBold10
public static java.awt.Font HelveticaBold10
-
Helvetica11
public static java.awt.Font Helvetica11
-
HelveticaBold11
public static java.awt.Font HelveticaBold11
-
Helvetica12
public static java.awt.Font Helvetica12
-
HelveticaBold12
public static java.awt.Font HelveticaBold12
-
Helvetica14
public static java.awt.Font Helvetica14
-
HelveticaBold14
public static java.awt.Font HelveticaBold14
-
-
Method Detail
-
isCommandDown
public static boolean isCommandDown(java.awt.event.InputEvent anEvent)
Returns whether the given event has command down.
-
isControlDown
public static boolean isControlDown(java.awt.event.InputEvent anEvent)
Returns whether the given input event has control down.
-
getStroke
public static java.awt.BasicStroke getStroke(float aStrokeWidth)
Returns a basic stroke with the given stroke width.
-
drawLine
public static void drawLine(java.awt.Graphics2D g, RMPoint p1, RMPoint p2)
Draws a line between the given points.
-
drawLine
public static void drawLine(java.awt.Graphics2D g, float p1x, float p1y, float p2x, float p2y)
Draws a line between the given points.
-
drawRect
public static void drawRect(java.awt.Graphics2D g, float x, float y, float w, float h)
Strokes the given rect.
-
fillRect
public static void fillRect(java.awt.Graphics2D g, float x, float y, float w, float h)
Fills the given rect.
-
fill3DRect
public static void fill3DRect(java.awt.Graphics2D g, RMRect aRect, boolean isRaised)
Fills the given rect with simple 3D button effect.
-
fill3DRect
public static void fill3DRect(java.awt.Graphics2D g, float x, float y, float w, float h, boolean isRaised)
Fills the given rect with simple 3D button effect.
-
drawButton
public static void drawButton(java.awt.Graphics2D g, RMRect aRect, boolean isPressed)
Draws a button for the given rect with an option for pressed.
-
drawButton
public static void drawButton(java.awt.Graphics2D g, float x, float y, float w, float h, boolean isPressed)
Draws a button for the given rect with an option for pressed.
-
setAntialiasing
public static void setAntialiasing(java.awt.Graphics2D g, boolean aFlag)
Turns antialiasing on or off for a given graphics.
-
getBytesJPEG
public static byte[] getBytesJPEG(java.awt.Image anImage)
Returns a JPeg byte array for the given buffered image.
-
getBytesPNG
public static byte[] getBytesPNG(java.awt.Image anImage)
Returns a PNG byte array for the given buffered image.
-
getBufferedImage
public static java.awt.image.BufferedImage getBufferedImage(java.awt.Image anImage)
Returns a buffered image for an AWT image.
-
-