public final class GUI extends Object
Modifier and Type | Field and Description |
---|---|
static int |
INPUT_COLUMN_INDEX
The index of the column at which the input elements (textfields etc.) are
added to the content panel (for stand-alone dialogs).
|
static int |
KEYS_COLUMN_INDEX
The index of the column at which the keys are added to the content panel
(for stand-alone dialogs).
|
static int |
ROW_SKIP_LAYOUT
The number of rows used for a single 'content' row in the layout (for
stand-alone dialogs).
|
static int |
STD_LAYOUT_GAP
Number of pixels in the gaps of the standard border layout.
|
Modifier and Type | Method and Description |
---|---|
static int |
addRowToPanel(JPanel panel,
String key,
JComponent input,
int currentRow)
Adds a pair of key and input components to the given panel panel.
|
static void |
centerOnScreen(Window window)
Centre a given window on the screen.
|
static JButton |
createIconButton(String iconFileName,
String defaultText)
Creates a button with an icon.
|
static JRadioButton |
createIconRadioButton(String iconFileName,
String defaultText)
Creates a radio button with an icon.
|
static <B extends AbstractButton> |
decorateButtonWithIconOrText(B button,
ImageIcon icon,
String defaultText)
Decorate button with icon or text.
|
static Font |
getDefaultFontBold()
Gets the default bold font.
|
static Font |
getDefaultFontLarge()
Gets the large default font.
|
static JFileChooser |
getDirectoryChooser(String dialogTitle)
Gets a file chooser configured to select a directory.
|
static JLabel |
getLabelToWait()
Gets the label to wait.
|
static BorderLayout |
getStdBorderLayout()
Get standard border layout.
|
static boolean |
isHeadless()
Checks the headless mode.
|
static void |
printErrorMessage(Component parent,
String title,
Object message)
Prints an error message.
|
static void |
printErrorMessage(Component parent,
String title,
Object message,
Throwable throwable)
Prints an error message and the stack trace of the corresponding exception.
|
static void |
printErrorMessage(String title,
Throwable throwable)
Prints an error message with the P3J main window as parent instance.
|
static void |
printMessage(Component parent,
String title,
Object message)
Prints a message.
|
static boolean |
printQuestion(Component parent,
String title,
Object message)
Prints a question message.
|
static void |
replaceListContents(DefaultListModel<Object> model,
List<?> newContent)
Replaces the contents o a default list model.
|
static ImageIcon |
retrieveIcon(String iconFileName)
Retrieves icon.
|
static void |
setHeadless(boolean headless)
Sets the head-less mode.
|
static void |
showModalDialog(JDialog dialogToShow)
Shows modal dialog without blocking (by setting visible to true via a
separate runnable in the EDT).
|
public static final int STD_LAYOUT_GAP
public static final int ROW_SKIP_LAYOUT
public static final int KEYS_COLUMN_INDEX
public static final int INPUT_COLUMN_INDEX
public static BorderLayout getStdBorderLayout()
public static void centerOnScreen(Window window)
window
- a Windowpublic static void setHeadless(boolean headless)
headless
- the new head-less modepublic static boolean isHeadless()
public static void printErrorMessage(Component parent, String title, Object message)
parent
- the parent component for the dialogtitle
- the title of the error dialogmessage
- the message to be displayedpublic static void printErrorMessage(Component parent, String title, Object message, Throwable throwable)
parent
- the parent component for the dialogtitle
- the title of the error dialogmessage
- the message to be displayedthrowable
- the throwable (may provide additional info)public static void printErrorMessage(String title, Throwable throwable)
P3J.getInstance()
to retrieve it.title
- the title of the error dialogthrowable
- the throwable (may provide additional info)public static JButton createIconButton(String iconFileName, String defaultText)
iconFileName
- the icon file namedefaultText
- the default text to be displayed when the icon cannot be loadedpublic static JRadioButton createIconRadioButton(String iconFileName, String defaultText)
iconFileName
- the icon file namedefaultText
- the default text to be displayed when the icon cannot be loadedpublic static <B extends AbstractButton> B decorateButtonWithIconOrText(B button, ImageIcon icon, String defaultText)
B
- the generic type of the buttonbutton
- the buttonicon
- the icondefaultText
- the default textpublic static ImageIcon retrieveIcon(String iconFileName)
iconFileName
- the icon file namepublic static void printMessage(Component parent, String title, Object message)
parent
- the parent component for the dialogtitle
- the title of the error dialogmessage
- the message to be displayedpublic static boolean printQuestion(Component parent, String title, Object message)
parent
- the parent component for the dialogtitle
- the title of the dialogmessage
- the questionpublic static void replaceListContents(DefaultListModel<Object> model, List<?> newContent)
model
- the list model to be fillednewContent
- the list containing the contentpublic static void showModalDialog(JDialog dialogToShow)
dialogToShow
- the dialog to showpublic static JFileChooser getDirectoryChooser(String dialogTitle)
dialogTitle
- the dialog titlepublic static JLabel getLabelToWait()
public static Font getDefaultFontLarge()
public static Font getDefaultFontBold()
public static int addRowToPanel(JPanel panel, String key, JComponent input, int currentRow)
panel
- the panelkey
- the name of the label to be usedinput
- the input componentcurrentRow
- the current row in the layoutCopyright © 2013. All Rights Reserved.