|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jminor.common.ui.UiUtil
public final class UiUtil
A static utility class.
Nested Class Summary | |
---|---|
static class |
UiUtil.DialogDisposeAction
|
Field Summary | |
---|---|
static Cursor |
DEFAULT_CURSOR
|
static Dimension |
DIMENSION_TEXT_FIELD_SQUARE
A square dimension which sides are the same as the preferred height of a JTextField. |
static Cursor |
WAIT_CURSOR
|
Method Summary | ||
---|---|---|
static void |
addAcceptSingleFileDragAndDrop(JTextComponent textComponent)
Makes the text component accept files during drag and drop operations and insert the absolute path of the dropped file (the first file in a list if more than one file is dropped) |
|
static void |
addInitialFocusHack(JComponent component,
Action onFocusAction)
http://bugs.sun.com/bugdatabase/view_bug.do? |
|
static void |
addKeyEvent(JComponent component,
int keyEvent,
Action action)
|
|
static void |
addKeyEvent(JComponent component,
int keyEvent,
int modifiers,
Action action)
|
|
static void |
addKeyEvent(JComponent component,
int keyEvent,
int modifiers,
int condition,
Action action)
|
|
static void |
addKeyEvent(JComponent component,
int keyEvent,
int modifiers,
int condition,
boolean onKeyRelease,
Action action)
|
|
static void |
addLookupDialog(JTextField txtField,
ValueCollectionProvider valueListProvider)
|
|
static void |
centerWindow(Window window)
|
|
static File |
chooseFileToSave(JComponent dialogParent,
String startDir,
String defaultFileName)
|
|
static JFormattedTextField |
createFormattedField(SimpleDateFormat maskFormat,
Object initialValue)
|
|
static JFormattedTextField |
createFormattedField(String mask)
|
|
static JFormattedTextField |
createFormattedField(String mask,
boolean valueContainsLiteralCharacter)
|
|
static JFormattedTextField |
createFormattedField(String mask,
boolean valueContainsLiteralCharacter,
boolean charsAsUpper)
|
|
static JFrame |
createFrame(Image icon)
|
|
static JTextField |
createMemoryUsageField(int updateInterval)
|
|
static void |
expandAll(JTree tree,
TreePath parent,
boolean expand)
|
|
static TabbedPaneUI |
getBorderlessTabbedPaneUI()
|
|
static Action |
getBrowseAction(JTextField txtFilename)
|
|
static Date |
getDateFromUser(Date startDate,
String message,
Container parent)
|
|
static JDialog |
getParentDialog(Component container)
|
|
static JFrame |
getParentFrame(Component container)
|
|
static
|
getParentOfType(Component container,
Class<T> clazz)
|
|
static Window |
getParentWindow(Component container)
|
|
static int |
getPreferredScrollBarWidth()
|
|
static int |
getPreferredTextFieldHeight()
|
|
static Dimension |
getPreferredTextFieldSize()
|
|
static Dimension |
getScreenSizeRatio(double ratio)
|
|
static String |
getStartDir(String text)
|
|
static Action |
linkToEnabledState(StateObserver enabledState,
Action action)
|
|
static JComponent |
linkToEnabledState(StateObserver enabledState,
JComponent component)
|
|
static JTextComponent |
makeLowerCase(JTextComponent textField)
Makes textField convert all upper case input to lower case |
|
static JTextComponent |
makeUpperCase(JTextComponent textField)
Makes textField convert all lower case input to upper case |
|
static TextFieldPlus |
makeUpperCase(TextFieldPlus textField)
|
|
static void |
moveCaretToEndOnFocusGained(JTextComponent textComponent)
Sets the caret position to the right of the last character in the given text component when it gains focus |
|
static void |
moveCaretToStartOnFocusGained(JTextComponent textComponent)
Sets the caret position to 0 in the given text component when it gains focus |
|
static JPanel |
northCenterPanel(JComponent north,
JComponent center)
|
|
static void |
resizeWindow(Window window,
double screenSizeRatio)
|
|
static void |
resizeWindow(Window window,
double screenSizeRatio,
Dimension minimumSize)
|
|
static void |
selectAllOnFocusGained(JTextComponent textComponent)
Selects all text in the given component when it gains focus and clears the selection when focus is lost |
|
static File |
selectDirectory(JComponent dialogParent,
String startDir)
|
|
static File |
selectDirectory(JComponent dialogParent,
String startDir,
String dialogTitle)
|
|
static File |
selectFile(JComponent dialogParent,
String startDir)
|
|
static Object |
selectValue(JComponent dialogOwner,
Collection<?> values)
|
|
static Object |
selectValue(JComponent dialogOwner,
Collection<?> values,
String dialogTitle)
|
|
static void |
setSizeWithinScreenBounds(Window window)
|
|
static void |
setWaitCursor(boolean on,
JComponent component)
|
|
static void |
showImage(String imagePath,
JComponent dialogParent)
|
|
static void |
showImage(String imagePath,
JComponent dialogParent,
Collection<String> acceptedFileTypes)
|
|
static JDialog |
showInDialog(Container owner,
JComponent componentToShow,
boolean modal,
String title,
Dimension size,
JButton defaultButton,
EventObserver closeEvent)
|
|
static JDialog |
showInDialog(Window owner,
JComponent componentToShow,
boolean modal,
String title,
boolean includeButtonPanel,
boolean disposeOnOk,
Action okAction)
|
|
static JDialog |
showInDialog(Window owner,
JComponent componentToShow,
boolean modal,
String title,
boolean includeButtonPanel,
boolean disposeOnOk,
Action okAction,
Dimension size)
|
|
static JDialog |
showInDialog(Window owner,
JComponent componentToShow,
boolean modal,
String title,
boolean includeButtonPanel,
boolean disposeOnOk,
Action okAction,
Dimension size,
Point location,
Action closeAction)
|
|
static void |
showToolTip(JComponent component)
|
|
static void |
transferFocusOnEnter(JComponent component)
Attaches a key listener to the component which transfers focus on enter, and backwards if shift is down |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Cursor WAIT_CURSOR
public static final Cursor DEFAULT_CURSOR
public static final Dimension DIMENSION_TEXT_FIELD_SQUARE
Method Detail |
---|
public static JTextField createMemoryUsageField(int updateInterval)
public static File selectDirectory(JComponent dialogParent, String startDir) throws CancelException
CancelException
public static File selectDirectory(JComponent dialogParent, String startDir, String dialogTitle) throws CancelException
CancelException
public static File selectFile(JComponent dialogParent, String startDir) throws CancelException
CancelException
public static File chooseFileToSave(JComponent dialogParent, String startDir, String defaultFileName) throws CancelException
CancelException
public static Date getDateFromUser(Date startDate, String message, Container parent)
public static JFormattedTextField createFormattedField(SimpleDateFormat maskFormat, Object initialValue)
public static JFormattedTextField createFormattedField(String mask)
public static JFormattedTextField createFormattedField(String mask, boolean valueContainsLiteralCharacter)
public static JFormattedTextField createFormattedField(String mask, boolean valueContainsLiteralCharacter, boolean charsAsUpper)
public static Action linkToEnabledState(StateObserver enabledState, Action action)
public static JComponent linkToEnabledState(StateObserver enabledState, JComponent component)
public static JFrame createFrame(Image icon)
public static Dimension getScreenSizeRatio(double ratio)
ratio
- a ratio, 0.0 - 1.0
public static void setSizeWithinScreenBounds(Window window)
public static void resizeWindow(Window window, double screenSizeRatio)
public static void resizeWindow(Window window, double screenSizeRatio, Dimension minimumSize)
public static Window getParentWindow(Component container)
public static JFrame getParentFrame(Component container)
public static JDialog getParentDialog(Component container)
public static <T> T getParentOfType(Component container, Class<T> clazz)
public static void centerWindow(Window window)
public static void expandAll(JTree tree, TreePath parent, boolean expand)
public static void setWaitCursor(boolean on, JComponent component)
public static int getPreferredScrollBarWidth()
public static Dimension getPreferredTextFieldSize()
public static int getPreferredTextFieldHeight()
public static TabbedPaneUI getBorderlessTabbedPaneUI()
public static JPanel northCenterPanel(JComponent north, JComponent center)
public static void showToolTip(JComponent component)
public static JTextComponent makeUpperCase(JTextComponent textField)
textField
convert all lower case input to upper case
textField
- the text field
public static TextFieldPlus makeUpperCase(TextFieldPlus textField)
public static JTextComponent makeLowerCase(JTextComponent textField)
textField
convert all upper case input to lower case
textField
- the text field
public static void transferFocusOnEnter(JComponent component)
component
- the componentpublic static void selectAllOnFocusGained(JTextComponent textComponent)
textComponent
- the text componentpublic static void moveCaretToStartOnFocusGained(JTextComponent textComponent)
textComponent
- the text componentpublic static void moveCaretToEndOnFocusGained(JTextComponent textComponent)
textComponent
- the text componentpublic static JDialog showInDialog(Window owner, JComponent componentToShow, boolean modal, String title, boolean includeButtonPanel, boolean disposeOnOk, Action okAction)
public static JDialog showInDialog(Window owner, JComponent componentToShow, boolean modal, String title, boolean includeButtonPanel, boolean disposeOnOk, Action okAction, Dimension size)
public static JDialog showInDialog(Window owner, JComponent componentToShow, boolean modal, String title, boolean includeButtonPanel, boolean disposeOnOk, Action okAction, Dimension size, Point location, Action closeAction)
public static JDialog showInDialog(Container owner, JComponent componentToShow, boolean modal, String title, Dimension size, JButton defaultButton, EventObserver closeEvent)
public static void addAcceptSingleFileDragAndDrop(JTextComponent textComponent)
textComponent
- the text componentpublic static void addKeyEvent(JComponent component, int keyEvent, Action action)
public static void addKeyEvent(JComponent component, int keyEvent, int modifiers, Action action)
public static void addKeyEvent(JComponent component, int keyEvent, int modifiers, int condition, Action action)
public static void addKeyEvent(JComponent component, int keyEvent, int modifiers, int condition, boolean onKeyRelease, Action action)
public static void addLookupDialog(JTextField txtField, ValueCollectionProvider valueListProvider)
public static Object selectValue(JComponent dialogOwner, Collection<?> values)
public static Object selectValue(JComponent dialogOwner, Collection<?> values, String dialogTitle)
public static Action getBrowseAction(JTextField txtFilename)
public static String getStartDir(String text)
public static void showImage(String imagePath, JComponent dialogParent) throws IOException
imagePath
- the path to the image to showdialogParent
- the component to use as dialog parent
IOException
- in case of an IO exceptionpublic static void showImage(String imagePath, JComponent dialogParent, Collection<String> acceptedFileTypes) throws IOException
imagePath
- the path to the image to show, if the file has a file type suffix it
is checked against the acceptedFileTypes
collection.dialogParent
- the component to use as dialog parentacceptedFileTypes
- a collection of lower case file type suffixes, "gif", "jpeg"...
IOException
- in case of an IO exception
IllegalArgumentException
- in case the file type is not acceptedpublic static void addInitialFocusHack(JComponent component, Action onFocusAction)
component
- the component, in case of text fields the caret is moved to the end of the textonFocusAction
- the action to run when the focus has been requested
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |