# com.bea.ide.util.swing
DialogUtil Class

public class DialogUtil
extends `Object`

Hierarchy
  `Object`
  `DialogUtil`

## Field Summary

`public static final int` | `CANCEL` int
`public static final `Font`` | `CODE_FONT` The font to be used for code in dialogs.
`public static final int` | `NO` int
`public static final int` | `OK` int
`public static final `String`` | `TITLE` String
`public static final int` | `YES` int

## Constructor Summary

DialogUtil()

## Method Summary

`public static `JButton`` | `getCancelButton`() Get a button with the default CANCEL text
`public static `JDialog`` | `getDialog`(`JComponent` message) returns a new JDialog message is treated the same as JOptionPane treats its message parameter
`public static `JDialog`` | `getDialog`(`String` title, `JComponent` message) returns a new JDialog message is treated the same as JOptionPane treats its message parameter
`public static `JDialog`` | `getDialog`(`Component` parent, `String` title, `JComponent` message) returns a new JDialog message is treated the same as JOptionPane treats its message parameter maxCharactersPerLine will set the maximum characters per line, use 0 for default sizing messageType is defined by the constants in JOptionPane
`public static `JButton`` | `getHelpButton`() Get a button with the default HELP text
`public static `JDialog`` | `getJbMessageDialog`(`Component` parent, `String` title, `Object` message, `ImageIcon` icon, int maxCharsPerLine, int messageType) creates a JbDialog with an ok button that closes the dialog
`public static `JButton`` | `getOKButton`() Get a button with the default OK text
`public static `JTextArea`` | `getTextArea`(`String` text) Returns a text area to contain the given text.
`public static `JTextArea`` | `getTextArea`(`String` text, int cols) returns a text area with the given text, sized to the specified number of columns wide.
`public static `JTextArea`` | `getTextArea`(`String` text, int cols, int rows) returns a text area with the given text, sized to the specified number of columns wide and rows tall.
`public static `JTextField`` | `getTextField`(int cols) Returns a text field with enough space for the given number of columns in the code font.
`public static void` | `setCancelButton`(`JDialog` dialog, `JButton` cancelButton) Sets up the dialog so that pressing escape invokes the given button.
`public static void` | `setHelpButton`(`JButton` helpButton, `String` helpName) gets the help url from the resource svc using helpName and causes the button to display it in the browser when the button is pressed
`public static void` | `setOKButton`(`JDialog` dialog, `JButton` okButton) Sets up the dialog so that pressing enter invokes the given button.
`public static boolean` | `showConfirmDialog`(`Component` parent, `String` message) Shows an message in a dialog and returns whether the user clicked on 'ok' vs.
`public static void` | `showErrorDialog`(`String` message) Shows an error message in a dialog.
`public static void` | `showErrorDialog`(`Component` parent, `String` message) Shows an error message in a dialog.
`public static void` | `showInfoDialog`(`Component` parent, `String` title, `String` message) Like `showErrorDialog`, but shows an information message instead of an error message.
`public static void` | `showInfoDialog`(`Component` parent, `String` message) Like `showErrorDialog`, but shows an information message instead of an error message.
`public static void` | `showWarningDialog`(`Component` parent, `String` message) Like `showErrorDialog`, but shows a warning message instead of an error message.
`public static int` | `showYesNoCancelDialog`(`Component` parent, `String` message) Shows an yes no message in a dialog with a cancel option and returns whether the user clicked on 'yes', 'no' or 'cancel'.
`public static boolean` | `showYesNoDialog`(`Component` parent, `String` title, `String` message) Shows an yes no message in a dialog and returns whether the user clicked on 'yes'.
`public static boolean` | `showYesNoDialog`(`Component` parent, `String` message) Shows an yes no message in a dialog and returns whether the user clicked on 'yes'.

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Detail

### CANCEL

    public static final int CANCEL

### CODE_FONT

    public static final Font CODE_FONT

  The font to be used for code in dialogs.

### NO

    public static final int NO

### OK

    public static final int OK

### TITLE

    public static final String TITLE

### YES

    public static final int YES

## Constructor Detail

### DialogUtil

    public DialogUtil()

## Method Detail

### getCancelButton() Method

    public static JButton getCancelButton()

Get a button with the default CANCEL text

### getDialog(JComponent) Method

    public static JDialog getDialog(JComponent message)

returns a new JDialog message is treated the same as JOptionPane treats its message parameter

### getDialog(String, JComponent) Method

    public static JDialog getDialog(String title,
                                    JComponent message)

returns a new JDialog message is treated the same as JOptionPane treats its message parameter

### getDialog(Component, String, JComponent) Method

    public static JDialog getDialog(Component parent,
                                    String title,
                                    JComponent message)

returns a new JDialog message is treated the same as JOptionPane treats its message parameter maxCharactersPerLine will set the maximum characters per line, use 0 for default sizing messageType is defined by the constants in JOptionPane

### getHelpButton() Method

    public static JButton getHelpButton()

Get a button with the default HELP text

### getJbMessageDialog(Component, String, Object, ImageIcon, int, int) Method

DEPRECATED as of 1/22/02 this method replaced by: JDialog getJbMessageDialog(Component parent, Objecet message, ImageIcon icon, int maxCharsPerLine, int messageType)

    public static JDialog getJbMessageDialog(Component parent,
                                             String title,
                                             Object message,
                                             ImageIcon icon,
                                             int maxCharsPerLine,
                                             int messageType)

creates a JbDialog with an ok button that closes the dialog

### getOKButton() Method

    public static JButton getOKButton()

Get a button with the default OK text

### getTextArea(String) Method

    public static JTextArea getTextArea(String text)

Returns a text area to contain the given text. The text area will have a transparent background and no border, it will not be editable, it will wrap lines at whitespace boundaries, and it not accept the focus.

### getTextArea(String, int) Method

    public static JTextArea getTextArea(String text,
                                        int cols)

returns a text area with the given text, sized to the specified number of columns wide. If the number of columns is < 0, then no column constraint is set.

### getTextArea(String, int, int) Method

    public static JTextArea getTextArea(String text,
                                        int cols,
                                        int rows)

returns a text area with the given text, sized to the specified number of columns wide and rows tall. If either the number of columns or rows is < 0, then that constraint is not set.

### getTextField(int) Method

    public static JTextField getTextField(int cols)

Returns a text field with enough space for the given number of columns in the code font.

### setCancelButton(JDialog, JButton) Method

    public static void setCancelButton(JDialog dialog,
                                       JButton cancelButton)

Sets up the dialog so that pressing escape invokes the given button.

### setHelpButton(JButton, String) Method

    public static void setHelpButton(JButton helpButton,
                                     String helpName)

gets the help url from the resource svc using helpName and causes the button to display it in the browser when the button is pressed

### setOKButton(JDialog, JButton) Method

    public static void setOKButton(JDialog dialog,
                                   JButton okButton)

Sets up the dialog so that pressing enter invokes the given button.

### showConfirmDialog(Component, String) Method

    public static boolean showConfirmDialog(Component parent,
                                            String message)

Shows an message in a dialog and returns whether the user clicked on 'ok' vs. 'cancel'.

#### Parameters

parent
  The parent frame for the dialog or null if none is applicable.

message
  The text to display in the title bar.

### showErrorDialog(String) Method

    public static void showErrorDialog(String message)

Shows an error message in a dialog.

#### Parameters

message
  The text of the error message.

### showErrorDialog(Component, String) Method

    public static void showErrorDialog(Component parent,
                                       String message)

Shows an error message in a dialog.

#### Parameters

parent
  The parent frame for the dialog or null if none is applicable.

message
  The text of the error message.

### showInfoDialog(Component, String, String) Method

DEPRECATED as of 1/22/02 this method replaced by: showInfoDialog(Component parent, String message)

    public static void showInfoDialog(Component parent,
                                      String title,
                                      String message)

Like `showErrorDialog`, but shows an information message instead of an error message.

### showInfoDialog(Component, String) Method

    public static void showInfoDialog(Component parent,
                                      String message)

Like `showErrorDialog`, but shows an information message instead of an error message.

### showWarningDialog(Component, String) Method

    public static void showWarningDialog(Component parent,
                                         String message)

Like `showErrorDialog`, but shows a warning message instead of an error message.

### showYesNoCancelDialog(Component, String) Method

    public static int showYesNoCancelDialog(Component parent,
                                            String message)

Shows an yes no message in a dialog with a cancel option and returns whether the user clicked on 'yes', 'no' or 'cancel'.

#### Parameters

parent
  The parent frame for the dialog or null if none is applicable.

message
  The text of the question.

#### Returns

int, either DialogUtil.YES, DialogUtil.NO, or DialogUtil.CANCEL

### showYesNoDialog(Component, String, String) Method

DEPRECATED as of 1/22/02 this method replaced by: showYesNoDialog(Component parent, String message)

    public static boolean showYesNoDialog(Component parent,
                                          String title,
                                          String message)

Shows an yes no message in a dialog and returns whether the user clicked on 'yes'.

#### Parameters

parent
  The parent frame for the dialog or null if none is applicable.

title
  The text to display in the title bar.

message
  The text of the question.

### showYesNoDialog(Component, String) Method

    public static boolean showYesNoDialog(Component parent,
                                          String message)

Shows an yes no message in a dialog and returns whether the user clicked on 'yes'.

#### Parameters

parent
  The parent frame for the dialog or null if none is applicable.

message
  The text to display in the title bar.