public class GuiUtilities extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
GuiUtilities.IOnCloseListener |
static class |
GuiUtilities.ShpFileFilter |
| Modifier and Type | Field and Description |
|---|---|
static String |
LAST_PATH |
static String |
PREF_STRING_SEPARATORS |
| Constructor and Description |
|---|
GuiUtilities() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addClosingListener(JFrame frame,
GuiUtilities.IOnCloseListener onCloseListener) |
static void |
centerOnScreen(Component component)
Set the location of a component to center it on the screen.
|
static void |
colorButton(JButton button,
Color color,
Integer size)
Create an image to make a color picker button.
|
static void |
copyToClipboard(String text) |
static String |
getFromClipboard() |
static File |
getLastFile()
Handle the last set path preference.
|
static byte[] |
getPreference(String preferenceKey,
byte[] defaultValue) |
static String |
getPreference(String preferenceKey,
String defaultValue)
Get from preference.
|
static String[] |
getPreference(String preferenceKey,
String[] defaultValue) |
static void |
handleError(Component parentComponent,
Exception e) |
static boolean |
openConfirmDialogWithPanel(Component parentComponent,
JPanel panel,
String title) |
static JDialog |
openDialogWithPanel(JPanel panel,
String title,
Dimension dimension,
boolean modal) |
static void |
openDialogWithTable(String title,
String[][] dataMatrix,
String[] columnNames,
Dimension dimension,
boolean modal) |
static void |
openFile(File file) |
static void |
setDefaultLookAndFeel() |
static void |
setFileBrowsingOnWidgets(JTextField pathTextField,
JButton browseButton,
String[] allowedExtensions,
Runnable postRunnable)
Adds to a textfield and button the necessary to browse for a file.
|
static void |
setFolderBrowsingOnWidgets(JTextField pathTextField,
JButton browseButton)
Adds to a textfield and button the necessary to browse for a folder.
|
static void |
setLastPath(String lastPath)
Save the passed path as last path available.
|
static void |
setPreference(String preferenceKey,
byte[] value) |
static void |
setPreference(String preferenceKey,
String value)
Set a preference.
|
static void |
setPreference(String preferenceKey,
String[] valuesArray) |
static String |
showComboDialog(Component parentComponent,
String title,
String message,
String[] values) |
static void |
showErrorMessage(Component parentComponent,
String message) |
static void |
showErrorMessage(Component parentComponent,
String title,
String message) |
static void |
showImage(Component parentComponent,
String title,
BufferedImage image) |
static void |
showInfoMessage(Component parentComponent,
String message) |
static void |
showInfoMessage(Component parentComponent,
String title,
String message) |
static String |
showInputDialog(Component parentComponent,
String message,
String defaultInput) |
static String[] |
showMultiInputDialog(Component parentComponent,
String title,
String[] labels,
String[] defaultValues,
HashMap<String,String[]> fields2ValuesMap)
Create a simple multi input pane, that returns what the use inserts.
|
static File[] |
showOpenFilesDialog(Component parent,
String title,
boolean multiselection,
File initialPath,
FileFilter filter) |
static File[] |
showOpenFolderDialog(Component parent,
String title,
boolean multiselection,
File initialPath) |
static File |
showSaveFileDialog(Component parent,
String title,
File initialPath) |
static void |
showWarningMessage(Component parentComponent,
String message) |
static void |
showWarningMessage(Component parentComponent,
String title,
String message) |
static boolean |
showYesNoDialog(Component parentComponent,
String message) |
public static final String LAST_PATH
public static final String PREF_STRING_SEPARATORS
public static void centerOnScreen(Component component)
component - the component to center.public static File getLastFile()
public static void setLastPath(String lastPath)
lastPath - the last path to save.public static String getPreference(String preferenceKey, String defaultValue)
preferenceKey - the preference key.defaultValue - the default value in case of null.public static byte[] getPreference(String preferenceKey, byte[] defaultValue)
public static void setPreference(String preferenceKey, String value)
preferenceKey - the preference key.value - the value to set.public static void setPreference(String preferenceKey, byte[] value)
public static void copyToClipboard(String text)
public static void openFile(File file) throws IOException
IOExceptionpublic static JDialog openDialogWithPanel(JPanel panel, String title, Dimension dimension, boolean modal)
public static void openDialogWithTable(String title, String[][] dataMatrix, String[] columnNames, Dimension dimension, boolean modal)
public static boolean openConfirmDialogWithPanel(Component parentComponent, JPanel panel, String title)
public static String showInputDialog(Component parentComponent, String message, String defaultInput)
public static String[] showMultiInputDialog(Component parentComponent, String title, String[] labels, String[] defaultValues, HashMap<String,String[]> fields2ValuesMap)
parentComponent - title - the dialog title.labels - the labels to set.defaultValues - a set of default values.fields2ValuesMap - a map that allows to set combos for the various options.public static String showComboDialog(Component parentComponent, String title, String message, String[] values)
public static void setDefaultLookAndFeel()
public static void addClosingListener(JFrame frame, GuiUtilities.IOnCloseListener onCloseListener)
public static void showInfoMessage(Component parentComponent, String title, String message)
public static void showWarningMessage(Component parentComponent, String title, String message)
public static void showErrorMessage(Component parentComponent, String title, String message)
public static void showImage(Component parentComponent, String title, BufferedImage image)
public static void colorButton(JButton button, Color color, Integer size)
button - the button.color - the color to set.size - the optional size of the image.public static void setFileBrowsingOnWidgets(JTextField pathTextField, JButton browseButton, String[] allowedExtensions, Runnable postRunnable)
pathTextField - browseButton - allowedExtensions - public static void setFolderBrowsingOnWidgets(JTextField pathTextField, JButton browseButton)
pathTextField - browseButton - public static File[] showOpenFilesDialog(Component parent, String title, boolean multiselection, File initialPath, FileFilter filter)
public static File showSaveFileDialog(Component parent, String title, File initialPath)
Copyright © 2005-2019 HydroloGIS. All Rights Reserved.