Class DialogBox
- java.lang.Object
-
- com.inductiveautomation.snap.swing.DialogBox
-
public class DialogBox extends java.lang.Object
A class to run a dialog box.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DialogBox.MessageType
static class
DialogBox.Type
-
Field Summary
Fields Modifier and Type Field Description static int
CANCEL_OPTION
Return value from class method if NO is chosen.static int
NO_OPTION
Return value form class method if YES is chosen.static int
OK_OPTION
static java.lang.String[]
OPTIONS_OK
static java.lang.String[]
OPTIONS_OK_CANCEL
static java.lang.String[]
OPTIONS_YES_NO_CANCEL
static int
YES_OPTION
Return value form class method if OK is chosen.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
Closes the running dialog panel, with option to click the okay button.void
confirm()
Closes the running dialog panel, with option to click the okay button.javax.swing.JComponent
getContent()
Returns the content for dialog box.javax.swing.Icon
getIcon()
Returns the icon.java.lang.String
getMessage()
Returns the message to display.DialogBox.MessageType
getMessageType()
Returns the message type of the box.java.lang.String[]
getOptions()
Returns the options strings.java.lang.String
getTitle()
Returns the title of the dialog box.DialogBox.Type
getType()
Returns the type of the box.protected void
initDialogPanel()
Registers EnterAction for dialog.void
setContent(javax.swing.JComponent aComp)
Sets the content for dialog box.void
setErrorMessage(java.lang.String aMessage)
Sets the message to display.void
setIcon(javax.swing.Icon anIcon)
Sets the icon.void
setMessage(java.lang.String aMessage)
Sets the message to display.void
setMessageType(DialogBox.MessageType aMessageType)
Sets the message type of the box.void
setOptions(java.lang.String... theOptions)
Sets the option strings.void
setQuestionMessage(java.lang.String aMessage)
Sets the message to display.void
setTitle(java.lang.String aTitle)
Sets the title of the dialog box.void
setType(DialogBox.Type aType)
Sets the type of the box.void
setWarningMessage(java.lang.String aMessage)
Sets the message to display.boolean
showConfirmDialog(javax.swing.JComponent aComp)
Shows an option dialog.java.lang.String
showInputDialog(javax.swing.JComponent aComp, java.lang.String aDefault)
Shows an input panel.void
showMessageDialog(javax.swing.JComponent aComp)
Runs the panel.int
showOptionDialog(javax.swing.JComponent aComp, java.lang.String aDefault)
Shows an option panel.
-
-
-
Field Detail
-
OPTIONS_OK
public static final java.lang.String[] OPTIONS_OK
-
OPTIONS_OK_CANCEL
public static final java.lang.String[] OPTIONS_OK_CANCEL
-
OPTIONS_YES_NO_CANCEL
public static final java.lang.String[] OPTIONS_YES_NO_CANCEL
-
OK_OPTION
public static final int OK_OPTION
- See Also:
- Constant Field Values
-
YES_OPTION
public static final int YES_OPTION
Return value form class method if OK is chosen.- See Also:
- Constant Field Values
-
NO_OPTION
public static final int NO_OPTION
Return value form class method if YES is chosen.- See Also:
- Constant Field Values
-
CANCEL_OPTION
public static final int CANCEL_OPTION
Return value from class method if NO is chosen.- See Also:
- Constant Field Values
-
-
Method Detail
-
getMessage
public java.lang.String getMessage()
Returns the message to display.
-
setMessage
public void setMessage(java.lang.String aMessage)
Sets the message to display.
-
setErrorMessage
public void setErrorMessage(java.lang.String aMessage)
Sets the message to display.
-
setWarningMessage
public void setWarningMessage(java.lang.String aMessage)
Sets the message to display.
-
setQuestionMessage
public void setQuestionMessage(java.lang.String aMessage)
Sets the message to display.
-
getTitle
public java.lang.String getTitle()
Returns the title of the dialog box.
-
setTitle
public void setTitle(java.lang.String aTitle)
Sets the title of the dialog box.
-
getType
public DialogBox.Type getType()
Returns the type of the box.
-
setType
public void setType(DialogBox.Type aType)
Sets the type of the box.
-
getMessageType
public DialogBox.MessageType getMessageType()
Returns the message type of the box.
-
setMessageType
public void setMessageType(DialogBox.MessageType aMessageType)
Sets the message type of the box.
-
getOptions
public java.lang.String[] getOptions()
Returns the options strings.
-
setOptions
public void setOptions(java.lang.String... theOptions)
Sets the option strings.
-
getContent
public javax.swing.JComponent getContent()
Returns the content for dialog box.
-
setContent
public void setContent(javax.swing.JComponent aComp)
Sets the content for dialog box.
-
getIcon
public javax.swing.Icon getIcon()
Returns the icon.
-
setIcon
public void setIcon(javax.swing.Icon anIcon)
Sets the icon.
-
showMessageDialog
public void showMessageDialog(javax.swing.JComponent aComp)
Runs the panel.
-
showConfirmDialog
public boolean showConfirmDialog(javax.swing.JComponent aComp)
Shows an option dialog.
-
showOptionDialog
public int showOptionDialog(javax.swing.JComponent aComp, java.lang.String aDefault)
Shows an option panel.
-
showInputDialog
public java.lang.String showInputDialog(javax.swing.JComponent aComp, java.lang.String aDefault)
Shows an input panel.
-
confirm
public void confirm()
Closes the running dialog panel, with option to click the okay button.
-
cancel
public void cancel()
Closes the running dialog panel, with option to click the okay button.
-
initDialogPanel
protected void initDialogPanel()
Registers EnterAction for dialog.
-
-