|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent gov.nih.mipav.view.MipavUtil
public class MipavUtil
A collection of static methods and frequently used and useful constants are in this utility class.
Nested Class Summary | |
---|---|
static class |
MipavUtil.ActionAdapter
Static abstract class similar to mouseAdapter to allow the catching of actionevents from components without having to implement ActionListener. |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static Cursor |
addPointCursor
Standard cursor: add a point (hand). |
static Font |
arial13
A 13 point, plain, arial font. |
static Font |
arial13B
A 13 point, bold, arial font. |
static Cursor |
blankCursor
Custom cursor: no cursor. |
static Font |
courier10
A 10 point, plain, courier font. |
static Font |
courier12
A 12 point, plain, courier font. |
static Font |
courier12B
A 12 point, bold, courier font. |
static Font |
courier13
A 13 point, plain, courier font. |
static Font |
courier13B
A 13 point, bold, courier font. |
static Cursor |
crosshairCursor
A crosshair cursor. |
static int |
DEFAULT_ICON_HEIGHT
DOCUMENT ME! |
static int |
DEFAULT_ICON_WIDTH
DOCUMENT ME! |
static Font |
defaultAcceleratorFont
DOCUMENT ME! |
static Dimension |
defaultButtonSize
The default size that all buttons should be. |
static Cursor |
defaultCursor
Standard cursor: default. |
static Font |
defaultMenuFont
DOCUMENT ME! |
static Font |
font10
A 10 point, plain, serif font. |
static Font |
font12
A 12 point, plain, serif font. |
static Font |
font12B
A 12 point, bold, serif font. |
static Font |
font12I
A 12 point, italic, serif font. |
static Font |
font13
A 13 point, plain, serif font. |
static Font |
font13B
A 13 point, bold, serif font. |
static Font |
font13I
A 13 point, italic, serif font. |
static Font |
font14
A 14 point, plain, serif font. |
static Font |
font14B
A 14 point, bold, serif font. |
static Font |
font14I
A 14 point, italic, serif font. |
static Font |
font16B
A 16 point, bold, serif font. |
static Font |
font18B
A 18 point, bold, serif font. |
static int[] |
functionKeys
DOCUMENT ME! |
static Cursor |
handCursor
A hand cursor. |
static Cursor |
magnifyCursor
DOCUMENT ME! |
static Cursor |
magRegionCursor
Custom cursor: magnify region. |
static int |
MENU_Y_PADDING
DOCUMENT ME! |
static Cursor |
moveCursor
A move cursor. |
static Cursor |
pointCursor
Standard cursor: point (resize, NE). |
static Cursor |
probeCursor
DOCUMENT ME! |
static Cursor |
quickLUTcursor
Custom cursor: quick LUT. |
static Cursor |
resizeCursor
A resizing cursor. |
static Cursor |
smallPointerCursor
Custom cursor: small pointer. |
static Cursor |
textCursor
Cursor for doing annotations. |
static Cursor |
unmagnifyCursor
DOCUMENT ME! |
protected static String |
version
The current version number, coded as a String, read and then cached by getVersion(). |
static Cursor |
waitCursor
Standard cursor: wait. |
static Cursor |
wandCursor
Standard cursor: wand (hand). |
static Dimension |
widenButtonSize
The horizontally widen size that all buttons should be. |
static Cursor |
winLevelCursor
DOCUMENT ME! |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
MipavUtil()
|
Method Summary | |
---|---|
static void |
buildCursors()
DOCUMENT ME! |
static void |
buildDefaultFonts()
This should only be called once when MIPAV starts, and then if the user changes the font options through Program Options to rebuild the fonts used in GUI building. |
static TitledBorder |
buildTitledBorder(String title)
Builds a titled border with the given title, an etched border, and the proper font and color. |
static void |
centerInComponent(Component parentComponent,
JDialog dialog)
Sets the location of the dialog to the center of the parent component. |
static void |
centerInWindow(Window parentWindow,
Window childWindow)
Sets the location of the window to the center of the parent window. |
static void |
centerOnScreen(Window window)
Sets the location of the window to the center of the screen. |
static String |
convertToFileURL(String filename)
Convert from a filename to a file URL. |
static void |
displayError(String error)
Pops up a message dialog to display an error. |
static void |
displayInfo(String info)
Pops up a message dialog to display information. |
static void |
displayWarning(String warning)
Pops up a message dialog to display a warning. |
static Color |
extractColor(String preferencesColorString)
Makes a series of ints, corresponding to a color string stored in the Mipav.preferences file which looks like a color string defined in web pages ("RRGGBB"). and returns a java.awt.Color based on those values. |
static boolean |
getBoolean(StringTokenizer st)
Get a boolean value from a string tokenizer. |
static float |
getFloat(StringTokenizer st)
Get a float value from a string tokenizer. |
static ImageIcon |
getIcon(String name)
Finds the icon of the specified name. |
static Image |
getIconImage(String name)
Finds the image of the specified name. |
static int |
getInt(StringTokenizer st)
Get an integer value from a string tokenizer. |
static String |
getVersion()
Gets the MIPAV Version number from the about.txt file. |
static String |
makeColorString(Color aColor)
Takes a java.awt.Color and forms a string representing its color. the string appears as 6 hex digits and looks like the color coding used in html files, as in: "RRGGBB". |
static String |
makeFloatString(float number,
int decPts)
Makes a string of a float with a specific number of decimal points. |
static String |
makeHTMLFontString(Color color,
String name,
int size,
int style,
boolean doU,
String text)
DOCUMENT ME! |
static void |
makeNumericsOnly(JTextField txt,
boolean allowFloatingPoint)
Takes a text field and forces the text field to accept numbers, backspace and delete-key entries. |
static void |
makeNumericsOnly(JTextField txt,
boolean allowFloatingPoint,
boolean allowNegativeNumbers)
Takes a txt field, and forces the textfield to accept numbers, backspace and delete-key entries. |
static void |
setComponentsEnabled(Container container,
boolean enabled)
DOCUMENT ME! |
static void |
setFonts(Component[] comp)
DOCUMENT ME! |
static void |
showHelp(String ID)
Pops up the MIPAV help for a given help ID. |
static boolean |
testParameter(String str,
double minValue,
double maxValue)
Tests that the entered parameter is in range. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static Font defaultMenuFont
public static Font defaultAcceleratorFont
public static Font font10
public static Font font12
public static Font font12B
public static Font font12I
public static Font font13
public static Font font13B
public static Font font13I
public static Font font14
public static Font font14B
public static Font font14I
public static Font font16B
public static Font font18B
public static Font courier10
public static Font courier12
public static Font courier12B
public static Font courier13
public static Font courier13B
public static Font arial13
public static Font arial13B
public static final Cursor defaultCursor
public static final Cursor crosshairCursor
public static final Cursor moveCursor
public static final Cursor pointCursor
public static final Cursor resizeCursor
public static final Cursor handCursor
public static Cursor blankCursor
public static Cursor magRegionCursor
public static final Cursor addPointCursor
public static Cursor smallPointerCursor
public static Cursor probeCursor
public static Cursor magnifyCursor
public static Cursor unmagnifyCursor
public static Cursor quickLUTcursor
public static final Cursor textCursor
public static final Cursor waitCursor
public static final Cursor wandCursor
public static Cursor winLevelCursor
protected static String version
public static final Dimension defaultButtonSize
public static final Dimension widenButtonSize
public static final int DEFAULT_ICON_WIDTH
public static final int DEFAULT_ICON_HEIGHT
public static int MENU_Y_PADDING
public static final int[] functionKeys
Constructor Detail |
---|
public MipavUtil()
Method Detail |
---|
public static void buildCursors()
public static void buildDefaultFonts()
public static final TitledBorder buildTitledBorder(String title)
title
- Title of the border
public static void centerInComponent(Component parentComponent, JDialog dialog)
parentComponent
- the parent component.dialog
- the dialog which is to be displayed.public static void centerInWindow(Window parentWindow, Window childWindow)
parentWindow
- the window where the child will be centered on.childWindow
- the window that is to be displayed centered on the parent windowpublic static void centerOnScreen(Window window)
window
- Window that is to be displayedpublic static final String convertToFileURL(String filename) throws MalformedURLException
filename
- the file name to convert
MalformedURLException
- if there is a problem converting the file namepublic static void displayError(String error)
Use when an operation has failed, preventing some operation critical for MIPAV to continue running normally or an operation can neither be completed nor its errors accomodated.
error
- the message text of the errorJOptionPane.showMessageDialog(java.awt.Component, java.lang.Object, java.lang.String, int, javax.swing.Icon)
public static void displayInfo(String info)
Use for brief notices such as completion of an operation or where to find logging information. It is not meant to notify a user of an error in processing.
info
- the information stringpublic static void displayWarning(String warning)
Use when an operation has failed, but the can be completed but the output may display inaccuratly; ie., errors can be accomodated.
warning
- the message text of the warning.public static Color extractColor(String preferencesColorString)
Call with extractColor(Preferences.getProperty("OneOfThoseColors"));
if preferencesColorString is null, or incomplete, returns black.
preferencesColorString
- -- this class pre-arranges the colors to be
Color
public static final boolean getBoolean(StringTokenizer st) throws TokenizerException
st
- the tokenizer to get the boolean from
TokenizerException
- thrown if the string retrieved is not a boolean valuepublic static final float getFloat(StringTokenizer st) throws TokenizerException
st
- the tokenizer to get the float from
TokenizerException
- thrown if the string retrieved is not a float valuepublic static ImageIcon getIcon(String name)
name
- name of the icon
public static Image getIconImage(String name) throws FileNotFoundException
name
- name of the image
FileNotFoundException
- if we can't find the icon filepublic static final int getInt(StringTokenizer st) throws TokenizerException
st
- the tokenizer to get the integer from
TokenizerException
- thrown if the string retrieved is not an integer valuepublic static String getVersion()
public static String makeColorString(Color aColor)
aColor
- the color to be converted to a hexidecimal
public static final String makeFloatString(float number, int decPts)
number
- number to be converted to a stringdecPts
- the number of decimal points
public static final String makeHTMLFontString(Color color, String name, int size, int style, boolean doU, String text)
color
- Colorname
- Stringsize
- intstyle
- intdoU
- booleantext
- String
public static void makeNumericsOnly(JTextField txt, boolean allowFloatingPoint)
txt
- Text field to modify.allowFloatingPoint
- true
will force the text field to also allow the use of the '.' key to
permit entering floating point numbers.public static void makeNumericsOnly(JTextField txt, boolean allowFloatingPoint, boolean allowNegativeNumbers)
txt
- the text field to make only accept numeric textallowFloatingPoint
- true will forces the text field to also allow the use of the '.' key to permit entering
floating point numbersallowNegativeNumbers
- true causes textfield to allow the entry of a single minus sign ('-') in front of the
text. An additional '-' removes minus sign from the field to give it the opposite sign.public static final void setComponentsEnabled(Container container, boolean enabled)
container
- DOCUMENT ME!enabled
- DOCUMENT ME!public static final void setFonts(Component[] comp)
comp
- DOCUMENT ME!public static void showHelp(String ID)
ID
- The ID of the help topic to open.public static final boolean testParameter(String str, double minValue, double maxValue)
str
- the value entered by the userminValue
- the minimum value this variable may be set tomaxValue
- the maximum value this variable may be set to
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |