public final class CommonTools extends Object
| Modifier and Type | Field and Description |
|---|---|
private static org.apache.log4j.Logger |
logger
Custom class logger.
|
private static int |
toolTipDismissDelay
The dismiss delay for the ToolTipManager.
|
private static int |
toolTipInitDelay
The initial delay for the ToolTipManager.
|
private static int |
toolTipReshowDelay
The re-show delay for the
ToolTipManager. |
| Constructor and Description |
|---|
CommonTools() |
| Modifier and Type | Method and Description |
|---|---|
static String |
arrayToString(Object[] array)
|
static double[] |
calcAngleAndLegLenghts(AngleROI s)
This method calculates the angle value of a given shape object.
|
static double |
calcLength(Vector<Float> coords)
This method prints the length value of a line
|
static void |
centerFrameOnScreen(Window w)
Centers a specified
Window on the screen. |
static boolean |
checkModifiers(int modifiers,
int mask)
Checks the modifier for a given mask.
|
static BufferedImage |
createSnapshot(Component component)
Creates a buffered image of a given
Component's graphics. |
static void |
disableMainFrameInteraction()
Starts a wait cursor on the the
IMainFrame. |
static void |
disableUserInteraction(JFrame window)
Starts a wait cursor on the specified
JFrame. |
static String |
doubleArrayToString(double[] array)
Aligns all elements of a double array in a single one-line
String
. |
static void |
enableMainFrameInteraction()
Stops the wait cursor and re-enables the user interaction on the
IMainFrame. |
static void |
enableUserInteraction(JFrame window)
Stops the wait cursor and re-enables the user interaction on a given
JFrame. |
static int |
getDefaultToolTipDismissDelay()
This method gets the default toolTipDismissDelay It is called e.g after
jFreeChart
|
static int |
getDefaultToolTipInitDelay()
This method gets the default toolTipInitDelay It is called e.g after
jFreeChart
|
static int |
getDefaultToolTipReshowDelay()
This method gets the default toolTipReshowDelay It is called e.g after
jFreeChart
|
static Point |
getRealPixelPosition(Point2D p,
double zoom)
This method calculates the real image pixel position.
|
static Point |
getRealPixelPosition(Point p,
double zoom)
This method calculates the real image pixel position.
|
static Vector<Float> |
getShapeCoordinates(javax.media.jai.ROIShape roiShape)
This method gets the Polygon (shape) coordinates.
|
static String |
intArrayToString(int[] array)
Aligns all elements of the integer array in a single one-line
String. |
static void |
setDefaultToolTipDelays()
This method sets the default toolTipDelays It is called at startup
|
static void |
setTabForDataType(DataType dataType)
This method sets the tab index in the main frame according to the given
data type.
|
static File |
showFileDialog(int dialogType)
Show a dialog in order to locate a single file.
|
static File |
showFileDialog(int dialogType,
String filename)
Show a dialog in order to locate a single file,
optionally stating the file name.
|
static void |
showImage(BufferedImage image,
String title)
Displays the
BufferedImage in a separate JFrame. |
static void |
showImage(ImageIcon image,
String title)
|
static void |
showImage(Image image,
String title)
|
static javax.media.jai.PlanarImage |
zoomImage(javax.media.jai.PlanarImage pi,
double zoom)
This method zooms an image.
|
private static final org.apache.log4j.Logger logger
private static int toolTipReshowDelay
ToolTipManager. Default is '0'.private static int toolTipDismissDelay
private static int toolTipInitDelay
public static void setDefaultToolTipDelays()
public static int getDefaultToolTipInitDelay()
public static int getDefaultToolTipReshowDelay()
public static int getDefaultToolTipDismissDelay()
public static void centerFrameOnScreen(Window w)
Window on the screen.public static void showImage(BufferedImage image, String title)
BufferedImage in a separate JFrame.image - public static BufferedImage createSnapshot(Component component)
Component's graphics.component - the component to be renderedBufferedImage of type
BufferedImage.TYPE_INT_RGB.public static void disableUserInteraction(JFrame window)
JFrame.window - the frame to be lockedpublic static void enableUserInteraction(JFrame window)
JFrame.window - the frame to be unlockedpublic static void disableMainFrameInteraction()
IMainFrame.public static void enableMainFrameInteraction()
IMainFrame.public static String intArrayToString(int[] array)
String.array - Stringpublic static String doubleArrayToString(double[] array)
String
.array - Stringpublic static String arrayToString(Object[] array)
Object array in a single one-line
String. The standard Object.toString() method is applied to
each element.array - Stringpublic static boolean checkModifiers(int modifiers,
int mask)
modifiers - mask - true if the modifier matches, false
otherwisepublic static javax.media.jai.PlanarImage zoomImage(javax.media.jai.PlanarImage pi,
double zoom)
pi - - the source imagepublic static Point getRealPixelPosition(Point p, double zoom)
p - pixel position of devicezoom - the zoom value in double precisionpublic static Point getRealPixelPosition(Point2D p, double zoom)
p - pixel position of devicezoom - the zoom value in double precisionpublic static double calcLength(Vector<Float> coords)
coords - public static double[] calcAngleAndLegLenghts(AngleROI s)
s - a shape object, e.g. AngleROI0,
the large angle on index 1, the first leg length on
index 2, and the second leg length on index
3public static Vector<Float> getShapeCoordinates(javax.media.jai.ROIShape roiShape)
ROIShapepublic static void setTabForDataType(DataType dataType)
dataType - the DataTypepublic static File showFileDialog(int dialogType)
dialogType - JFileChooser.SAVE_DIALOG, or
JFileChooser.OPEN_DIALOGpublic static File showFileDialog(int dialogType, String filename)
dialogType - JFileChooser.SAVE_DIALOG, or
JFileChooser.OPEN_DIALOGfilename - the file name to be set to the dialogCopyright © 2009–2017 Helmut Ahammer, Philipp Kainz. All rights reserved.