borland Packages Class Hierarchy jbcl.control Package Index
java.lang.Object +----java.awt.Component +----java.awt.Container +----java.awt.Window +----java.awt.Dialog +----borland.jbcl.control.ButtonDialog +----borland.jbcl.control.ColorChooserDialog +----borland.jbcl.control.FontChooserDialog +----borland.jbcl.control.MessageDialog +----borland.jbcl.control.ExceptionDialog +----borland.jbcl.control.StringInputDialog +----borland.jbcl.control.UserNamePasswordDialog
Variables Constructors Properties Methods Event Listeners
Implements ActionListener, KeyListener, ImageObserver, MenuContainer, Serializable, EventListener
ButtonDialog creates a button dialog box that displays a set of buttons. It provides a way to embed predefined buttons and button sets in message boxes and dialog boxes. The JBCL dialog classes extend ButtonDialog. To use ButtonDialog, specify the buttons to add to the dialog box by setting the buttonSet property.
Pre-defined button sets
Name of button set | Buttons in the button set |
OK_CANCEL | OK, Cancel |
YES_NO | Yes, No |
YES_NO_CANCEL | Yes, No, Cancel |
OK_CANCEL_APPLY | OK, Cancel, Apply |
APPLY_DONE | Apply, Done |
ALL | OK, Yes, No, Cancel, Help, Apply, Done |
The following buttons close the dialog:
The result property determines what the result of clicking the specified button is. To disable a button, call the enableButton() button, passing it a boolean value of false. If the enterOK property value is true, pressing the Enter key sends an OK command to the dialog.
The show() method displays the dialog box. The value of the centered property determines whether the dialog box is centered on screen.
The ButtonDialog maintains an array of ButtonDescriptors that holds the information about the set of buttons in the dialog. You can access a descriptor for a specific button using either the buttonFromCommand() or buttonFromID() methods.
protected transient ActionMulticaster actionMulticaster
public static final int ALL = OK | YES | NO | CANCEL | DONE | HELP | APPLY | NEXT | PREVIOUS | DETAILS
public static final int APPLY = 0x040
public static final String APPLY_COMMAND = "apply"
public static final int APPLY_DONE = APPLY | DONE
protected int buttonAlignment
protected ButtonDescriptor[] buttonDescriptors
protected Panel buttonPanel
protected Panel buttonPanelHolder
protected int buttonSet
public static final int CANCEL = 0x008
public static final String CANCEL_COMMAND = "cancel"
protected boolean centered
protected Component centerPanel
public static final int DETAILS = 0x200
public static final String DETAILS_COMMAND = "details"
public static final int DONE = 0x010
public static final String DONE_COMMAND = "done"
protected boolean enterOK
protected boolean escapeCancelDetermines whether pressing the Escape key causes the ButtonDialog to cancel any changes and close. This variable's value is set using the escapeCancel property.
public static final int HELP = 0x020
public static final String HELP_COMMAND = "help"
protected String[] labels
public static final int NEXT = 0x080
public static final String NEXT_COMMAND = "next"
public static final int NO = 0x004
public static final String NO_COMMAND = "no"
public static final int NONE = 0x000
public static final String NONE_COMMAND = "none"
public static final int OK = 0x001
public static final int OK_CANCEL = OK | CANCEL
public static final int OK_CANCEL_APPLY = OK | CANCEL | APPLY
public static final String OK_COMMAND = "ok"
public static final int PREVIOUS = 0x100
public static final String PREVIOUS_COMMAND = "previous"
protected ButtonDescriptor result
public static final int YES = 0x002
public static final String YES_COMMAND = "yes"
public static final int YES_NO = YES | NO
public static final int YES_NO_CANCEL = YES | NO | CANCEL
protected ButtonDialog(java.awt.Frame frame)
Constructs a ButtonDialog.
Parameters:
protected ButtonDialog(java.awt.Frame frame, java.lang.String title)Constructs a ButtonDialog.
Parameters:
protected ButtonDialog(java.awt.Frame frame, java.lang.String title, boolean modal, java.awt.Component centerPanel, java.awt.Panel buttonPanel, borland.jbcl.control.ButtonDescriptor[] buttonDescriptors)Constructs a ButtonDialog.
Parameters:
public ButtonDialog(java.awt.Frame frame, java.lang.String title, java.awt.Component centerPanel)Constructs a ButtonDialog.
Parameters:
protected ButtonDialog(java.awt.Frame frame, java.lang.String title, java.awt.Component centerPanel, int buttonSet)Constructs a ButtonDialog.
Parameters:
public int getButtonAlignment() public void setButtonAlignment(int alignment)Determines the alignment of the buttons within the dialog box. Valid values for alignment are LEFT, CENTER, and RIGHT.
public int getButtonSet() public void setButtonSet(int bs)Defines the set of buttons to be displayed as a set of OR'ed button bits where bs is the set of button bits. For example,
setButtonSet(ButtonDialog.OK | ButtonDialog.CANCEL | ButtonDialog.HELP)
setButtonSet(ButtonDialog.OK_CANCEL)
public boolean isCentered() public void setCentered(boolean c)Determines whether the button dialog is centered on screen. If centered is true, the dialog is centered. The default value is true.
public Component getCenterPanel() public void setCenterPanel(java.awt.Component panel)The center panel used for the button dialog.
public boolean isEnterOK() public void setEnterOK(boolean e)Determines whether pressing the Enter key generates an OK command. If enterOK is true, an OK command is generated when the Enter key is pressed. The default value is true.
public boolean isEscapeCancel() public void setEscapeCancel(boolean c)Determines whether pressing the Escape key generates a Cancel command. If escapeCancel is true, a Cancel command is generated when the Escape key is pressed. The default value is true.
public String[] getLabels() public void setLabels(java.lang.String[] l)Specifies the labels for the set of buttons. If labels aren't provided, default labels are used. For example, the default label for the OK button is "OK".
You can specify labels for all buttons, or just for the visible buttons. The labels for the buttons are specified as an array of strings.
public Dimension getPreferredSize()Returns the preferred size of the dialog box. The preferred size will always be at least 300 pixels wide and 150 pixels high.
public int getResult() public void setResult(int id)Determines the button id value that is returned when the button is clicked. Valid constants for id are: NONE, OK, YES, NO, CANCEL, DONE, HELP, APPLY, NEXT, PREVIOUS, and DETAILS.
protected void assureOnScreen()Displays the dialog box on screen if it is not already there.
public ButtonDescriptor buttonFromCommand(java.lang.String actionCommand)Returns the ButtonDescriptor for the button identified by its command.
Parameters:
public ButtonDescriptor buttonFromID(int id)Returns the ButtonDescriptor for the button identified by the button ID.
Parameters:
protected static final ButtonDescriptor[] buttonSetToButtonDescriptors(int buttonSet)Creates a new array of ButtonDescriptor objects from the specified set of buttons.
Parameters:
protected void centerOnScreen()Centers the dialog box on screen.
protected void dropKeyListeners(java.awt.Component comp)
public void enableButton(java.lang.String actionCommand, boolean enableState)Enables and disables the specified button.
Parameters:
protected void listenForKeys(java.awt.Component comp)Adds the specified component as a listener for key events in every child component.
protected void processActionEvent(java.awt.event.ActionEvent e)Dispatches an action event to all listeners. Buttons that close the dialog can set the result to null to abort a button command.
Parameters:
protected void processWindowEvent(java.awt.event.WindowEvent e)Process window events that the ButtonDialog receives.
Overrides: java.awt.Window.processWindowEvent(WindowEvent)
protected void setupButtonLabels()Adds the labels specified with the labels property to the array of ButtonDescriptor objects. If the length of the labels array is the same as the length of the ButtonDescriptors array, the label strings are set for all the buttons; otherwise, they are set for just the visible buttons. setupButtonLabels() is called by setLabels().
public void show()Displays the dialog on screen.
Overrides: java.awt.Dialog.show()
public synchronized void addActionListener(java.awt.event.ActionListener l) public synchronized void removeActionListener(java.awt.event.ActionListener l)
public synchronized void addComponentListener(java.awt.event.ComponentListener ) public synchronized void removeComponentListener(java.awt.event.ComponentListener )
public synchronized void addContainerListener(java.awt.event.ContainerListener ) public void removeContainerListener(java.awt.event.ContainerListener )
public synchronized void addFocusListener(java.awt.event.FocusListener ) public synchronized void removeFocusListener(java.awt.event.FocusListener )
public synchronized void addKeyListener(java.awt.event.KeyListener ) public synchronized void removeKeyListener(java.awt.event.KeyListener )
public synchronized void addMouseListener(java.awt.event.MouseListener ) public synchronized void removeMouseListener(java.awt.event.MouseListener )
public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener ) public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener )
public synchronized void addWindowListener(java.awt.event.WindowListener ) public synchronized void removeWindowListener(java.awt.event.WindowListener )