|
JGraphpad Pro
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jgraph.pad.dialog.JGraphpadDialogs
Singleton class that provides a set of standard dialogs.
| Nested Class Summary | |
static class |
JGraphpadDialogs.CancelException
|
static class |
JGraphpadDialogs.FontDialog
A simple font dialog. |
| Field Summary | |
protected static JGraphpadDialogs.FontDialog |
fontDialog
Shared simple font dialog. |
protected JFileChooser |
openEditorChooser
Holds the various file choosers to preserve their states between uses. |
protected JFileChooser |
openImageChooser
Holds the various file choosers to preserve their states between uses. |
protected JFileChooser |
saveEditorChooser
Holds the various file choosers to preserve their states between uses. |
protected JFileChooser |
saveImageChooser
Holds the various file choosers to preserve their states between uses. |
protected static JGraphpadDialogs |
sharedInstance
Shared singleton instance. |
| Constructor Summary | |
protected |
JGraphpadDialogs()
Singleton constructor. |
| Method Summary | |
Color |
colorDialog(Component component,
String title,
Color color)
Displays a color dialog using JColorChooser.showDialog(java.awt.Component, java.lang.String, java.awt.Color). |
boolean |
confirmDialog(Component component,
String message,
boolean yesNo,
boolean cancel)
Displays a confirmation dialog using JOptionPane.showConfirmDialog(java.awt.Component, java.lang.Object, java.lang.String, int)
and JGraphpad.APPTITLE for the title. |
double |
doubleDialog(String title,
double initialValue,
boolean allowNegative,
boolean allowZero)
Shortcut method to valueDialog(String, String) that returns the
user input as a double. |
String |
editorFileDialog(Component component,
String title,
String filename,
boolean open,
File directory)
Displays a JFileChooser using
showFileChooser(Component, JFileChooser, boolean). |
void |
errorDialog(Component component,
String message)
Shortcut method to messageDialog(Component, String, int) that
display a dialog of type JOptionPane.ERROR_MESSAGE. |
String |
fileDialog(Component component,
String title,
boolean open,
String extension,
String desc,
File directory)
Displays a JFileChooser using
showFileChooser(Component, JFileChooser, boolean) for files with
the specified extension. |
float |
floatDialog(String title,
float initialValue,
boolean allowNegative,
boolean allowZero)
Shortcut method to valueDialog(String, String) that returns the
user input as a float. |
Font |
fontDialog(Component component,
String title)
Displays a simple font dialog using JGraphpadDialogs.FontDialog. |
static JGraphpadDialogs |
getSharedInstance()
Returns the singleton instance. |
String |
imageFileDialog(Component component,
String title,
boolean open,
File directory)
Displays a JFileChooser using
showFileChooser(Component, JFileChooser, boolean). |
void |
informationDialog(Component component,
String message)
Shortcut method to messageDialog(Component, String, int) that
display a dialog of type JOptionPane.INFORMATION_MESSAGE. |
int |
intDialog(String title,
int initialValue,
boolean allowNegative,
boolean allowZero)
Shortcut method to valueDialog(String, String) that returns the
user input as an int. |
void |
messageDialog(Component component,
String message,
int type)
Displays a message dialog using JOptionPane.showMessageDialog(java.awt.Component, java.lang.Object, java.lang.String, int)
and JGraphpad.APPTITLE for the title. |
protected String |
showFileChooser(Component component,
JFileChooser chooser,
boolean open)
Helper method to display the specified chooser using JFileChooser.showOpenDialog(java.awt.Component) or
JFileChooser.showSaveDialog(java.awt.Component) making sure that
the returned file has the extension of the selected filter. |
String |
valueDialog(String title)
Shortcut method to valueDialog(String, String) with an empty
initial value. |
String |
valueDialog(String title,
String initialValue)
Displays a value dialog using JOptionPane.showInputDialog(java.awt.Component, java.lang.Object). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static JGraphpadDialogs sharedInstance
protected static JGraphpadDialogs.FontDialog fontDialog
protected JFileChooser saveEditorChooser
protected JFileChooser openEditorChooser
protected JFileChooser saveImageChooser
protected JFileChooser openImageChooser
| Constructor Detail |
protected JGraphpadDialogs()
| Method Detail |
public static JGraphpadDialogs getSharedInstance()
sharedInstance.
public Color colorDialog(Component component,
String title,
Color color)
JColorChooser.showDialog(java.awt.Component, java.lang.String, java.awt.Color).
component - The parent component for the dialog to be displayed.title - The title of the dialog to be displayed.color - The default color to use in the dialog.
public Font fontDialog(Component component,
String title)
JGraphpadDialogs.FontDialog.
component - The parent component for the dialog to be displayed.title - The title of the dialog to be displayed.
public String valueDialog(String title)
valueDialog(String, String) with an empty
initial value.
title - The title of the dialog to be displayed.
public String valueDialog(String title,
String initialValue)
JOptionPane.showInputDialog(java.awt.Component, java.lang.Object).
title - The title of the dialog to be displayed.initialValue - The intitial value to be displayed.
public int intDialog(String title,
int initialValue,
boolean allowNegative,
boolean allowZero)
valueDialog(String, String) that returns the
user input as an int.
title - The title of the dialog to be displayed.initialValue - The initial value to be displayed.allowNegative - Specifies whether negative values are allowed as input.allowZero - Specifies whether zero is a valid input.
IllegalArgumentException - If a value <= 0 is entered.
JGraphpadDialogs.CancelException - if the user clicks cancel
public float floatDialog(String title,
float initialValue,
boolean allowNegative,
boolean allowZero)
valueDialog(String, String) that returns the
user input as a float.
title - The title of the dialog to be displayed.initialValue - The initial value to be displayed.allowNegative - Specifies whether negative values are allowed as input.allowZero - Specifies whether zero is a valid input.
IllegalArgumentException - If a value <= 0 is entered.
JGraphpadDialogs.CancelException - if the user clicks cancel
public double doubleDialog(String title,
double initialValue,
boolean allowNegative,
boolean allowZero)
valueDialog(String, String) that returns the
user input as a double.
title - The title of the dialog to be displayed.initialValue - The initial value to be displayed.
IllegalArgumentException - If a value <= 0 is entered.
JGraphpadDialogs.CancelException - if the user clicks cancel
public boolean confirmDialog(Component component,
String message,
boolean yesNo,
boolean cancel)
throws JGraphpadDialogs.CancelException
JOptionPane.showConfirmDialog(java.awt.Component, java.lang.Object, java.lang.String, int)
and JGraphpad.APPTITLE for the title.
component - The parent component for the dialog to be displayed.message - The message to be confirmed.yesNo - Whether to display yes/no or ok/cancel options.cancel - Whether to display a cancel option for yes/no dialogs.
JGraphpadDialogs.CancelException - If the user clicks cancel.
public void informationDialog(Component component,
String message)
messageDialog(Component, String, int) that
display a dialog of type JOptionPane.INFORMATION_MESSAGE.
component - The parent component for the dialog to be displayed.message - The message to be displayed.
public void errorDialog(Component component,
String message)
messageDialog(Component, String, int) that
display a dialog of type JOptionPane.ERROR_MESSAGE.
component - The parent component for the dialog to be displayed.message - The message to be displayed.
public void messageDialog(Component component,
String message,
int type)
JOptionPane.showMessageDialog(java.awt.Component, java.lang.Object, java.lang.String, int)
and JGraphpad.APPTITLE for the title.
component - The parent component for the dialog to be displayed.message - The message to be confirmed.type - The type of message dialog to be displayed.
public String fileDialog(Component component,
String title,
boolean open,
String extension,
String desc,
File directory)
JFileChooser using
showFileChooser(Component, JFileChooser, boolean) for files with
the specified extension. The dialog will show description
for file of this type. The full extension including the dot must be
specified. If the selected filename does not end with
extension then the extension is appended to the filename.
component - The parent component for the dialog to be displayed.title - The title of the dialog to be displayed.open - Whether to display an open or save dialog.extension - The extension to be used for filtering files.desc - The description of the file format.directory - The default directory to use for the dialog.
public String editorFileDialog(Component component,
String title,
String filename,
boolean open,
File directory)
JFileChooser using
showFileChooser(Component, JFileChooser, boolean). This
implementation adds two file filters to the chooser, one for .xml files
and the other for .xml.gz files.
component - The parent component for the dialog to be displayed.title - The title of the dialog to be displayed.open - Whether to display an open or save dialog.directory - The default directory to use for the dialog.
public String imageFileDialog(Component component,
String title,
boolean open,
File directory)
JFileChooser using
showFileChooser(Component, JFileChooser, boolean). This
implementation adds two file filters to the chooser, one for .jpg files
and the other for .png files.
component - The parent component for the dialog to be displayed.title - The title of the dialog to be displayed.open - Whether to display an open or save dialog.directory - The default directory to use for the dialog.
protected String showFileChooser(Component component,
JFileChooser chooser,
boolean open)
JFileChooser.showOpenDialog(java.awt.Component) or
JFileChooser.showSaveDialog(java.awt.Component) making sure that
the returned file has the extension of the selected filter. This
implementation displays a confirmation dialog if a file will be
overwritten and returns null if the user chooses not to overwrite it.
component - The parent component for the dialog to be displayed.chooser - The dialog to be displayed. Whether to display an open or save
dialog.open - Whether to display an open or save dialog.
|
JGraphpad Pro
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||