|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectDialogUtils
public class DialogUtils
Static utility methods for common dialog and GUI related tasks.
| Constructor Summary | |
|---|---|
DialogUtils()
|
|
| Method Summary | ||
|---|---|---|
static
|
getChildComponents(Class<T> clazz,
Container parent,
boolean includeNested)
Gets all child components that are, or derive from, the given class. |
|
static Dimension |
getHtmlLabelTextExtent(String labelText,
int fixedDimSize,
boolean width)
Calculates the dimensions that a given text string requires when rendered as HTML text in a label component. |
|
static String |
getString(String input,
String fallback)
Returns input if not null or empty, otherwise returns
fallback. |
|
static void |
showCentred(Window dialog)
Shows a dialog centred on the screen. |
|
static void |
showCentredOnParent(Window parent,
Window dialog)
Shows a dialog centred on its parent. |
|
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DialogUtils()
| Method Detail |
|---|
public static void showCentred(Window dialog)
dialog - the dialog
public static void showCentredOnParent(Window parent,
Window dialog)
parent is null the dialog
is centred on the screen.
parent - the parent componentdialog - the dialog
public static <T extends JComponent> List<T> getChildComponents(Class<T> clazz,
Container parent,
boolean includeNested)
T - Swing type derived from JComponentclazz - the component classparent - the parent containerincludeNested - whether to recursively collect nested components
public static String getString(String input,
String fallback)
input if not null or empty, otherwise returns
fallback. This is handy for setting dialog titles etc. Note that
the input string is considered empty if input.trim().length() == 0.
input - input stringfallback - fallback string (may be null)
input unless it is null or empty, in which case
fallback is returned
public static Dimension getHtmlLabelTextExtent(String labelText,
int fixedDimSize,
boolean width)
The method used is adapted from that described in a blog post by Morten Nobel:
http://blog.nobel-joergensen.com/2009/01/18/changing-preferred-size-of-a-html-jlabel/
labelText - the text to render, optionally enclosed in <html>...</html> tagsfixedDimSize - the size of the fixed dimension (either width or heightwidth - true if the fixed dimension is width; false for height
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||