| java.lang.Object com.jgraph.pad.dialog.JGraphpadDialogs
JGraphpadDialogs | public class JGraphpadDialogs (Code) | | Singleton class that provides a set of standard dialogs.
|
Method Summary | |
public Color | colorDialog(Component component, String title, Color color) Displays a color dialog using
JColorChooser.showDialog(java.awt.Componentjava.lang.Stringjava.awt.Color) .
Parameters: component - The parent component for the dialog to be displayed. Parameters: title - The title of the dialog to be displayed. Parameters: color - The default color to use in the dialog. | public boolean | confirmDialog(Component component, String message, boolean yesNo, boolean cancel) Displays a confirmation dialog using
JOptionPane.showConfirmDialog(java.awt.Componentjava.lang.Objectjava.lang.Stringint) and
JGraphpad.APPTITLE for the title.
Parameters: component - The parent component for the dialog to be displayed. Parameters: message - The message to be confirmed. Parameters: yesNo - Whether to display yes/no or ok/cancel options. Parameters: cancel - Whether to display a cancel option for yes/no dialogs. | public double | doubleDialog(String title, double initialValue, boolean allowNegative, boolean allowZero) Shortcut method to
JGraphpadDialogs.valueDialog(String,String) that returns the
user input as a double.
Parameters: title - The title of the dialog to be displayed. Parameters: initialValue - The initial value to be displayed. | public String | editorFileDialog(Component component, String title, String filename, boolean open, File directory) Displays a
JFileChooser using
JGraphpadDialogs.showFileChooser(Component,JFileChooser,boolean) . | public void | errorDialog(Component component, String message) Shortcut method to
JGraphpadDialogs.messageDialog(Component,String,int) that
display a dialog of type
JOptionPane.ERROR_MESSAGE . | public String | fileDialog(Component component, String title, boolean open, String extension, String desc, File directory) Displays a
JFileChooser using
JGraphpadDialogs.showFileChooser(Component,JFileChooser,boolean) for files with
the specified extension. | public float | floatDialog(String title, float initialValue, boolean allowNegative, boolean allowZero) Shortcut method to
JGraphpadDialogs.valueDialog(String,String) that returns the
user input as a float.
Parameters: title - The title of the dialog to be displayed. Parameters: initialValue - The initial value to be displayed. Parameters: allowNegative - Specifies whether negative values are allowed as input. Parameters: allowZero - Specifies whether zero is a valid input. | public Font | fontDialog(Component component, String title) Displays a simple font dialog using
FontDialog .
Parameters: component - The parent component for the dialog to be displayed. Parameters: title - The title of the dialog to be displayed. | public static JGraphpadDialogs | getSharedInstance() Returns the singleton instance. | public String | imageFileDialog(Component component, String title, boolean open, File directory) Displays a
JFileChooser using
JGraphpadDialogs.showFileChooser(Component,JFileChooser,boolean) . | public void | informationDialog(Component component, String message) Shortcut method to
JGraphpadDialogs.messageDialog(Component,String,int) that
display a dialog of type
JOptionPane.INFORMATION_MESSAGE . | public int | intDialog(String title, int initialValue, boolean allowNegative, boolean allowZero) Shortcut method to
JGraphpadDialogs.valueDialog(String,String) that returns the
user input as an int.
Parameters: title - The title of the dialog to be displayed. Parameters: initialValue - The initial value to be displayed. Parameters: allowNegative - Specifies whether negative values are allowed as input. Parameters: allowZero - Specifies whether zero is a valid input. | public void | messageDialog(Component component, String message, int type) Displays a message dialog using
JOptionPane.showMessageDialog(java.awt.Componentjava.lang.Objectjava.lang.Stringint) 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. | public String | valueDialog(String title) Shortcut method to
JGraphpadDialogs.valueDialog(String,String) with an empty
initial value.
Parameters: title - The title of the dialog to be displayed. | public String | valueDialog(String title, String initialValue) Displays a value dialog using
JOptionPane.showInputDialog(java.awt.Componentjava.lang.Object) .
Parameters: title - The title of the dialog to be displayed. Parameters: initialValue - The intitial value to be displayed. |
fontDialog | protected static FontDialog fontDialog(Code) | | Shared simple font dialog.
|
saveEditorChooseropenEditorChoosersaveImageChooseropenImageChooser | protected JFileChooser saveEditorChooseropenEditorChoosersaveImageChooseropenImageChooser(Code) | | Holds the various file choosers to preserve their states between uses.
|
JGraphpadDialogs | protected JGraphpadDialogs()(Code) | | Singleton constructor.
|
confirmDialog | public boolean confirmDialog(Component component, String message, boolean yesNo, boolean cancel) throws CancelException(Code) | | Displays a confirmation dialog using
JOptionPane.showConfirmDialog(java.awt.Componentjava.lang.Objectjava.lang.Stringint) and
JGraphpad.APPTITLE for the title.
Parameters: component - The parent component for the dialog to be displayed. Parameters: message - The message to be confirmed. Parameters: yesNo - Whether to display yes/no or ok/cancel options. Parameters: cancel - Whether to display a cancel option for yes/no dialogs. Returns true if the message is confirmed. throws: CancelException - If the user clicks cancel. |
doubleDialog | public double doubleDialog(String title, double initialValue, boolean allowNegative, boolean allowZero)(Code) | | Shortcut method to
JGraphpadDialogs.valueDialog(String,String) that returns the
user input as a double.
Parameters: title - The title of the dialog to be displayed. Parameters: initialValue - The initial value to be displayed. Returns the user input as a double. throws: IllegalArgumentException - If a value <= 0 is entered. throws: CancelException - if the user clicks cancel |
editorFileDialog | public String editorFileDialog(Component component, String title, String filename, boolean open, File directory)(Code) | | Displays a
JFileChooser using
JGraphpadDialogs.showFileChooser(Component,JFileChooser,boolean) . This
implementation adds two file filters to the chooser, one for .xml files
and the other for .xml.gz files.
Parameters: component - The parent component for the dialog to be displayed. Parameters: title - The title of the dialog to be displayed. Parameters: open - Whether to display an open or save dialog. Parameters: directory - The default directory to use for the dialog. Returns the selected filename. |
fileDialog | public String fileDialog(Component component, String title, boolean open, String extension, String desc, File directory)(Code) | | Displays a
JFileChooser using
JGraphpadDialogs.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.
Parameters: component - The parent component for the dialog to be displayed. Parameters: title - The title of the dialog to be displayed. Parameters: open - Whether to display an open or save dialog. Parameters: extension - The extension to be used for filtering files. Parameters: desc - The description of the file format. Parameters: directory - The default directory to use for the dialog. Returns the selected filename. |
floatDialog | public float floatDialog(String title, float initialValue, boolean allowNegative, boolean allowZero)(Code) | | Shortcut method to
JGraphpadDialogs.valueDialog(String,String) that returns the
user input as a float.
Parameters: title - The title of the dialog to be displayed. Parameters: initialValue - The initial value to be displayed. Parameters: allowNegative - Specifies whether negative values are allowed as input. Parameters: allowZero - Specifies whether zero is a valid input. Returns the user input as a double. throws: IllegalArgumentException - If a value <= 0 is entered. throws: CancelException - if the user clicks cancel |
fontDialog | public Font fontDialog(Component component, String title)(Code) | | Displays a simple font dialog using
FontDialog .
Parameters: component - The parent component for the dialog to be displayed. Parameters: title - The title of the dialog to be displayed. Returns the selected font. |
imageFileDialog | public String imageFileDialog(Component component, String title, boolean open, File directory)(Code) | | Displays a
JFileChooser using
JGraphpadDialogs.showFileChooser(Component,JFileChooser,boolean) . This
implementation adds two file filters to the chooser, one for .jpg files
and the other for .png files.
Parameters: component - The parent component for the dialog to be displayed. Parameters: title - The title of the dialog to be displayed. Parameters: open - Whether to display an open or save dialog. Parameters: directory - The default directory to use for the dialog. Returns the selected filename. |
intDialog | public int intDialog(String title, int initialValue, boolean allowNegative, boolean allowZero)(Code) | | Shortcut method to
JGraphpadDialogs.valueDialog(String,String) that returns the
user input as an int.
Parameters: title - The title of the dialog to be displayed. Parameters: initialValue - The initial value to be displayed. Parameters: allowNegative - Specifies whether negative values are allowed as input. Parameters: allowZero - Specifies whether zero is a valid input. Returns the user input as an int. throws: IllegalArgumentException - If a value <= 0 is entered. throws: CancelException - if the user clicks cancel |
showFileChooser | protected String showFileChooser(Component component, JFileChooser chooser, boolean open)(Code) | | 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. This
implementation displays a confirmation dialog if a file will be
overwritten and returns null if the user chooses not to overwrite it.
Parameters: component - The parent component for the dialog to be displayed. Parameters: chooser - The dialog to be displayed. Whether to display an open or savedialog. Parameters: open - Whether to display an open or save dialog. Returns the selected filename. |
|
|