public class DialogBuilder extends Object implements IDialogBuilder
| Modifier and Type | Class and Description |
|---|---|
class |
DialogBuilder.DialogPart
Represents a dialog part.
|
CUSTOM_DIALOG, ERROR_MESSAGE, INFORMATION_MESSAGE, OK_DIALOG, PLAIN_MESSAGE, QUESTION_MESSAGE, WARNING_MESSAGE, YES_CANCEL_DIALOG| Constructor and Description |
|---|
DialogBuilder() |
DialogBuilder(String title)
Constructor.
|
DialogBuilder(String title,
short dialogType,
int messageType)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
DialogBuilder.DialogPart |
addHorizontalDialogPart()
Add a dialog part where the components are layout horizontally.
|
DialogBuilder.DialogPart |
addHorizontalDialogPart(JComponent... content)
Add a dialog part where the components are layout horizontally.
|
DialogBuilder.DialogPart |
addHorizontalDialogPart(String id)
Add a dialog part where the components are layout horizontally.
|
DialogBuilder.DialogPart |
addHorizontalDialogPart(String title,
JComponent... content)
Add a dialog part where the components are layout horizontally.
|
DialogBuilder.DialogPart |
addHorizontalDialogPart(String id,
String title,
JComponent... content)
Add a dialog part where the components are layout horizontally.
|
DialogBuilder.DialogPart |
addVerticalDialogPart()
Add a dialog part where the components are layout vertically.
|
DialogBuilder.DialogPart |
addVerticalDialogPart(JComponent... content)
Add a dialog part where the components are layout vertically.
|
DialogBuilder.DialogPart |
addVerticalDialogPart(String id)
Add a dialog part where the components are layout vertically.
|
DialogBuilder.DialogPart |
addVerticalDialogPart(String title,
JComponent... content)
Add a dialog part where the components are layout vertically.
|
DialogBuilder.DialogPart |
addVerticalDialogPart(String id,
String title,
JComponent... content)
Add a dialog part where the components are layout vertically.
|
JPanel |
createApplyPanel()
Creates the Apply panel, in the
IDialogBuilder.CUSTOM_DIALOG type. |
JDialogBuilderDialog |
createDialog(Component parent)
Show a dialog with the default dialog opening type.
|
JPanel |
createDialogContent()
Create the dialog main panel or component.
|
JDialogBuilderDialog |
createMessageDialog(Component parent,
String title,
int messageType,
boolean isModal,
boolean isResizable,
String... messages)
Show a message dialog, with an OK button.
|
String |
getCancelLabel()
Return the label for the "Cancel" button, in a
IDialogBuilder.YES_CANCEL_DIALOG. |
String |
getDialogTitle()
Return the dialog title.
|
short |
getDialogType()
Return the dialog type.
|
int |
getHorizontalMenusSeparation()
Return the horizontal menus separation.
|
Insets |
getInsets()
Return the insets of each component in the resulting dialog.
|
JMenuBar |
getJMenuBar()
Return the dialog menu bar.
|
JToolBar |
getJToolBar()
Return the dialog toolbar.
|
int |
getMessageType()
Return the message type, specifyng the type of icon which will be presented in the dialog.
|
Dimension |
getSize()
Return the dimension of the dialog.
|
int |
getVerticalMenusSeparation()
Return the vertical menus separation.
|
String |
getYesLabel()
Return the label for the "Yes" button, in a
IDialogBuilder.YES_CANCEL_DIALOG, or the "OK" button in the IDialogBuilder.OK_DIALOG. |
boolean |
isModal()
Return true if the dialog window is modal.
|
boolean |
isResizable()
Return true if the dialog window is resizable.
|
void |
setApplyPanel(JPanel applyPanel)
Set the Apply panel
|
void |
setCancelLabel(String label)
Set the label for the "Cancel" button, used in a
IDialogBuilder.YES_CANCEL_DIALOG. |
void |
setDialogTitle(String title)
Set the dialog title.
|
void |
setDialogType(short dialogType)
Set the dialog type.
|
void |
setHorizontalMenusSeparation(int horizontalSeparation)
Set the horizontal menus separation.
|
void |
setInsets(Insets insets)
Set the insets of each component in the resulting dialog.
|
void |
setInsets(int insets)
Set the insets of each component in the resulting dialog.
|
void |
setJMenuBar(JMenuBar menubar)
Set the dialog menu bar.
|
void |
setJToolBar(JToolBar toolbar)
Set the dialog toolbar.
|
void |
setMessageType(int messageType)
Set the message type.
|
void |
setModal(boolean isModal)
Set if the dialog window is modal.
|
void |
setResizable(boolean isResizable)
Set if the dialog window is resizable.
|
void |
setSize(Dimension size)
Set the dimension of the dialog.
|
void |
setVerticalMenusSeparation(int verticalSeparation)
Set the vertical menus separation.
|
void |
setYesLabel(String label)
Set the label for the "Yes" button, used in a
IDialogBuilder.YES_CANCEL_DIALOG, or the "OK" button in the IDialogBuilder.OK_DIALOG. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetContentBorderpublic DialogBuilder()
public DialogBuilder(String title)
title - the titlepublic DialogBuilder(String title, short dialogType, int messageType)
title - the titledialogType - the dialog typemessageType - the message typepublic void setInsets(int insets)
insets - the insetspublic void setInsets(Insets insets)
insets - the insetspublic Insets getInsets()
public JDialogBuilderDialog createDialog(Component parent)
parent - the component parentJFileChooser.APPROVE_OPTION, or JFileChooser.CANCEL_OPTIONpublic JDialogBuilderDialog createMessageDialog(Component parent, String title, int messageType, boolean isModal, boolean isResizable, String... messages)
parent - the component parenttitle - the dialog titlemessageType - the message typeisModal - true if the dialog is modalisResizable - true if the dialog is resizablemessages - the list of messages, which will be shown in a vertical gridJFileChooser.APPROVE_OPTIONpublic void setHorizontalMenusSeparation(int horizontalSeparation)
horizontalSeparation - the horizontal menus separationpublic int getHorizontalMenusSeparation()
public void setVerticalMenusSeparation(int verticalSeparation)
verticalSeparation - the vertical menus separationpublic int getVerticalMenusSeparation()
public JPanel createDialogContent()
createDialogContent in interface IDialogBuilderpublic void setModal(boolean isModal)
isModal - true if the dialog window is modalpublic boolean isModal()
isModal in interface IDialogBuilderpublic void setResizable(boolean isResizable)
isResizable - true if the dialog window is resizablepublic boolean isResizable()
isResizable in interface IDialogBuilderpublic void setSize(Dimension size)
size - the dimension of the dialogpublic Dimension getSize()
getSize in interface IDialogBuilderpublic void setDialogType(short dialogType)
IDialogBuilder.OK_DIALOG for an OK DialogIDialogBuilder.YES_CANCEL_DIALOG for an Yes / Cancel DialogIDialogBuilder.CUSTOM_DIALOG for a custom DialogdialogType - the dialog typepublic short getDialogType()
IDialogBuilder.OK_DIALOG by default.getDialogType in interface IDialogBuilderpublic void setMessageType(int messageType)
IDialogBuilder.PLAIN_MESSAGE for a default dialog without any iconIDialogBuilder.ERROR_MESSAGE for a dialog with an error iconIDialogBuilder.INFORMATION_MESSAGE for a dialog with an information iconIDialogBuilder.QUESTION_MESSAGE for a dialog with a question iconmessageType - the message typepublic int getMessageType()
IDialogBuilder.PLAIN_MESSAGE by default,
which means that there will be no icon.getMessageType in interface IDialogBuilderpublic void setDialogTitle(String title)
title - the dialog titlepublic String getDialogTitle()
getDialogTitle in interface IDialogBuilderpublic void setYesLabel(String label)
IDialogBuilder.YES_CANCEL_DIALOG, or the "OK" button in the IDialogBuilder.OK_DIALOG.label - the labelpublic String getYesLabel()
IDialogBuilder.YES_CANCEL_DIALOG, or the "OK" button in the IDialogBuilder.OK_DIALOG.
Return "Yes" by default, for a IDialogBuilder.YES_CANCEL_DIALOG or "OK", for a IDialogBuilder.OK_DIALOG.getYesLabel in interface IDialogBuilderpublic void setCancelLabel(String label)
IDialogBuilder.YES_CANCEL_DIALOG.label - the labelpublic String getCancelLabel()
IDialogBuilder.YES_CANCEL_DIALOG.
Return "Cancel" by default, for a IDialogBuilder.OK_DIALOG.getCancelLabel in interface IDialogBuilderpublic void setJMenuBar(JMenuBar menubar)
menubar - the menu barpublic JMenuBar getJMenuBar()
getJMenuBar in interface IDialogBuilderpublic void setJToolBar(JToolBar toolbar)
toolbar - the toolbarpublic JToolBar getJToolBar()
getJToolBar in interface IDialogBuilderpublic void setApplyPanel(JPanel applyPanel)
applyPanel - the panelpublic JPanel createApplyPanel()
IDialogBuilder.CUSTOM_DIALOG type. By dfualt retuens an empty panel.createApplyPanel in interface IDialogBuilderpublic DialogBuilder.DialogPart addHorizontalDialogPart(String title, JComponent... content)
content - the dialog part contenttitle - the dialog part titlepublic DialogBuilder.DialogPart addHorizontalDialogPart(String id, String title, JComponent... content)
id - the dialog part idcontent - the dialog part contenttitle - the dialog part titlepublic DialogBuilder.DialogPart addVerticalDialogPart(String title, JComponent... content)
content - the dialog part contenttitle - the dialog part titlepublic DialogBuilder.DialogPart addVerticalDialogPart(String id, String title, JComponent... content)
id - the dialog part id (can be null)content - the dialog part contenttitle - the dialog part title (can be null)public DialogBuilder.DialogPart addVerticalDialogPart(JComponent... content)
content - the dialog part content componentspublic DialogBuilder.DialogPart addHorizontalDialogPart(JComponent... content)
content - the dialog part contentpublic DialogBuilder.DialogPart addVerticalDialogPart()
public DialogBuilder.DialogPart addVerticalDialogPart(String id)
id - the dialog part idpublic DialogBuilder.DialogPart addHorizontalDialogPart()
public DialogBuilder.DialogPart addHorizontalDialogPart(String id)
id - the id of the dialog part