public final class JaxoUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LINE_SEPARATOR
The system-dependent line separator.
|
Modifier and Type | Method and Description |
---|---|
static void |
drawImageArea(java.awt.Image m,
int x,
int y,
int width,
int height,
java.awt.Graphics g)
Draw the part (x,y,width,height) of the image 'm' on 'g', at the same position (x,y).
|
static void |
drawImageArea(java.awt.Image m,
int x,
int y,
int width,
int height,
java.awt.Graphics g,
int gx,
int gy)
Draw the part (x,y,width,height) of the image 'm' on 'g' at (gx,gy).
|
static boolean |
equal(float a,
float b)
Compares the two floats.
|
static boolean |
equal(float a,
float b,
float epsilon)
Compares the two floats within a certain accuracy.
|
static boolean |
equals(java.lang.Object[] expected,
java.lang.Object[] actual)
Check if two arrays are equal.
|
static boolean |
equivalent(java.lang.Object[] expected,
java.lang.Object[] actual)
Check if two arrays are equivalent.
|
static java.awt.Image |
getChooserImage(java.awt.Color iconColor)
Returns an image with a box of 40x15 pixels size,
of the given color.
|
static java.awt.Image |
getChooserImage(java.awt.Color iconColor,
java.awt.Dimension size)
Returns an image with a box of the given pixels size,
of the given color.
|
static javax.swing.ImageIcon |
getChooserImageIcon(java.awt.Color iconColor)
Returns an image icon with a box of 40x15 pixels size,
of the given color.
|
static javax.swing.ImageIcon |
getChooserImageIcon(java.awt.Color iconColor,
java.awt.Dimension size)
Returns an image icon with a box of the given pixels size,
of the given color.
|
static boolean |
isButton1(java.awt.event.MouseEvent e)
Check for button 1 mouse events.
|
static boolean |
isButton2(java.awt.event.MouseEvent e)
Check for button 2 mouse events.
|
static boolean |
isButton3(java.awt.event.MouseEvent e)
Check for button 3 mouse events.
|
static boolean |
isDoubleClick(java.awt.event.MouseEvent e)
Check for double click mouse events.
|
static java.awt.Image |
newImage(java.lang.String resourceName)
Image from /resources/icons/ icon resource.
|
static javax.swing.ImageIcon |
newImageIcon(java.lang.String resourceName)
ImageIcon from /resources/icons/ icon resource.
|
static java.lang.String |
toString(java.lang.Object[] array)
This is intended to be equivalent to
Arrays.toString(a)
but also compatible with JDK 1.4. |
static boolean |
zero(double a)
Checks if the given double is zero.
|
public static final java.lang.String LINE_SEPARATOR
public static boolean equal(float a, float b, float epsilon)
a
- First float to compare.b
- Second float to compare.epsilon
- the desired accuracy. Has to be non-negative.public static boolean equal(float a, float b)
a
- First float to compare.b
- Second float to compare.public static boolean zero(double a)
a
- The double to check.public static void drawImageArea(java.awt.Image m, int x, int y, int width, int height, java.awt.Graphics g)
m
- The image.x
- The x coordinate.y
- The y coordinate.width
- The width.height
- The height.g
- The graphics context.public static void drawImageArea(java.awt.Image m, int x, int y, int width, int height, java.awt.Graphics g, int gx, int gy)
m
- The image.x
- The x coordinate.y
- The y coordinate.width
- The width.height
- The height.g
- The graphics context.gx
- The x coordinate of the new origin.gy
- The y coordinate of the new origin.public static javax.swing.ImageIcon newImageIcon(java.lang.String resourceName)
resourceName
- The name of the resource.public static java.awt.Image newImage(java.lang.String resourceName)
resourceName
- The name of the resource file.public static java.awt.Image getChooserImage(java.awt.Color iconColor)
iconColor
- The color of theimage.public static java.awt.Image getChooserImage(java.awt.Color iconColor, java.awt.Dimension size)
iconColor
- The color of theimage.size
- The size ofthe image.public static javax.swing.ImageIcon getChooserImageIcon(java.awt.Color iconColor)
iconColor
- The color of theimage.public static javax.swing.ImageIcon getChooserImageIcon(java.awt.Color iconColor, java.awt.Dimension size)
iconColor
- The color of theimage.size
- The size ofthe image.public static boolean isButton1(java.awt.event.MouseEvent e)
e
- The MouseEvent.public static boolean isButton2(java.awt.event.MouseEvent e)
e
- The MouseEvent.public static boolean isButton3(java.awt.event.MouseEvent e)
e
- The MouseEvent.public static boolean isDoubleClick(java.awt.event.MouseEvent e)
e
- The MouseEvent.public static java.lang.String toString(java.lang.Object[] array)
Arrays.toString(a)
but also compatible with JDK 1.4.
This concatenates the results of calling String.valueOf() on each element
of the array, so this won't work well for multi-dimensional arrays.array
- An array.public static boolean equals(java.lang.Object[] expected, java.lang.Object[] actual)
expected
- one array to be tested for equality.actual
- the other array to be tested for equality.Arrays.equals(java.lang.Object[],java.lang.Object[])
public static boolean equivalent(java.lang.Object[] expected, java.lang.Object[] actual)
This implementation uses
Arrays.sort(java.lang.Object[])
to bring the elements
of each array into natural order, before they are checked for equality.
Therefore, the elements of each array must implement the
Comparable interface and they must be mutually comparable.
expected
- one array to be tested for equivalence.actual
- the other array to be tested for equivalence.Arrays.equals(java.lang.Object[],java.lang.Object[])
,
Arrays.sort(java.lang.Object[])
Licensed under GPL. For more information, see http://jaxodraw.sourceforge.net/license.html or the LICENSE file in the jaxodraw distribution.