BreezyGUI
Class GBDialog

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Dialog
                          |
                          +--BreezyGUI.GBDialog

public class GBDialog
extends java.awt.Dialog

The class GBDialog (short for Grid Bag Dialog) provides a high-level dialog window. The window comes with a built in GridBagLayout. A GBDialog is modal. Its parent should be an application (an instance of GBFrame), or an anonymous Frame when used with GBApplet or another GBDialog. Components are added to the window by specifying their row position, column position, width (in columns), and height (in rows)in the grid. The window has a default size of (300, 300), which the client can override with setSize. A GBDialog is displayed by using the method show() rather than setVisible(true).

Events of different types, such as button clicks and list item selections, are handled by implementing the appropriate GBDialog methods in the application. GBDialog supports the same functionality as GBFrame, with the exception that pulldown menus are not supported, and with the addition of a dialog close indicator. This attribute, which has the value "Cancel" by default, can be used to determine how the user quit the dialog.

See Also:
Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
GBDialog(java.awt.Frame mainFrame)
          Creates a GBDialog whose parent is the application mainFrame.
 
Method Summary
 java.awt.Button addButton(java.lang.String text, int row, int col, int width, int height)
          Adds a Button with the specified name to the specified position, with the specified width and height.
 java.awt.Checkbox addCheckbox(java.lang.String text, int row, int col, int width, int height)
          Adds a CheckBox to the specified position, with the specified width and height.
 java.awt.Choice addChoice(int row, int col, int width, int height)
          Adds a Choice (pull down list) to the specified position, with the specified width and height.
 DoubleField addDoubleField(double num, int row, int col, int width, int height)
          Adds a DoubleField containing the specified number to the specified position, with the specified width and height.
 IntegerField addIntegerField(int num, int row, int col, int width, int height)
          Adds an IntegerField containing the specified integer to the specified position, with the specified width and height.
 java.awt.Label addLabel(java.lang.String text, int row, int col, int width, int height)
          Adds a label with the specified name to the specified position, with the specified width and height.
 java.awt.List addList(int row, int col, int width, int height)
          Adds a List (a scrolling list) to the specified position, with the specified width and height.
 java.awt.TextArea addTextArea(java.lang.String text, int row, int col, int width, int height)
          Adds a TextArea containing the specified string to the specified position, with the specified width and height.
 java.awt.TextField addTextField(java.lang.String text, int row, int col, int width, int height)
          Adds a TextField containing the specified string to the specified position, with the specified width and height.
 void buttonClicked(java.awt.Button buttonObj)
          The application must implement this method in order to handle button clicks.
 java.lang.String getDlgCloseIndicator()
          Returns the current dialog close indicator.
 void listDoubleClicked(java.awt.List listObj, java.lang.String itemClicked)
          The application must implement this method in order to handle a double click on an item in a scrolling list.
 void listItemSelected(java.awt.List listObj)
          The application must implement this method in order to handle a selection (single click) on an item in a scrolling list.
 void messageBox(double num)
          Pops up a message box containing the number and an OK button.
 void messageBox(java.lang.Object obj)
          Pops up a message box containing the string representation of the object and an OK button.
 void messageBox(java.lang.String msg)
          Pops up a message box containing the string and an OK button.
 void mouseClicked(int x, int y)
          The application must implement this method in order to handle mouse clicks in the window.
 void mouseDragged(int x, int y)
          The application must implement this method in order to handle mouse dragged events in the window.
 void mouseMoved(int x, int y)
          The application must implement this method in order to handle mouse moved events in the window.
 void mousePressed(int x, int y)
          The application must implement this method in order to handle mouse pressed events in the window.
 void mouseReleased(int x, int y)
          The application must implement this method in order to handle mouse released events in the window.
 void setDlgCloseIndicator(java.lang.String str)
          Allows the client to reset the dialog close indicator, which by default is "Cancel".
 
Methods inherited from class java.awt.Dialog
addNotify, dispose, getTitle, hide, isModal, isResizable, paramString, setModal, setResizable, setTitle, show
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, finalize, getFocusOwner, getInputContext, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isShowing, pack, postEvent, processEvent, processWindowEvent, removeWindowListener, setCursor, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GBDialog

public GBDialog(java.awt.Frame mainFrame)
Creates a GBDialog whose parent is the application mainFrame.
Method Detail

setDlgCloseIndicator

public void setDlgCloseIndicator(java.lang.String str)
Allows the client to reset the dialog close indicator, which by default is "Cancel".

getDlgCloseIndicator

public java.lang.String getDlgCloseIndicator()
Returns the current dialog close indicator.

messageBox

public void messageBox(double num)
Pops up a message box containing the number and an OK button.

messageBox

public void messageBox(java.lang.String msg)
Pops up a message box containing the string and an OK button.

messageBox

public void messageBox(java.lang.Object obj)
Pops up a message box containing the string representation of the object and an OK button.

listItemSelected

public void listItemSelected(java.awt.List listObj)
The application must implement this method in order to handle a selection (single click) on an item in a scrolling list. If no event handling is desired, this method need not be implemented.
Parameters:
listObj - The List in which the selection occurred.

buttonClicked

public void buttonClicked(java.awt.Button buttonObj)
The application must implement this method in order to handle button clicks. If no buttons are added to the window, this method need not be implemented.
Parameters:
buttonObj - The Button in which the click occurred. Example:
    // Add the buttons to the window.
    Button okButton = addButton("OK", 1, 1, 1, 1);
    Button cancelButton = addButton("Cancel", 1, 2, 1, 1);
    // Handle the button selection.
    public void buttonClicked(Button buttonObj){
       if (buttonObj == okButton)
          messageBox("OK selected");
       else
          messageBox("Cancel selected");
    }
 

listDoubleClicked

public void listDoubleClicked(java.awt.List listObj,
                              java.lang.String itemClicked)
The application must implement this method in order to handle a double click on an item in a scrolling list. If no double click is anticipated, this method need not be implemented.
Parameters:
listObj - The List in which the double click occurred.
itemClicked - The string selected by the double click.

mouseClicked

public void mouseClicked(int x,
                         int y)
The application must implement this method in order to handle mouse clicks in the window. If no event handling is desired, this method need no be implemented.
Parameters:
x - The x coordinate of the mouse in the window.
y - The y coordinate of the mouse in the window.

mousePressed

public void mousePressed(int x,
                         int y)
The application must implement this method in order to handle mouse pressed events in the window. If no event handling is desired, this method need no be implemented.
Parameters:
x - The x coordinate of the mouse in the window.
y - The y coordinate of the mouse in the window.

mouseReleased

public void mouseReleased(int x,
                          int y)
The application must implement this method in order to handle mouse released events in the window. If no event handling is desired, this method need no be implemented.
Parameters:
x - The x coordinate of the mouse in the window.
y - The y coordinate of the mouse in the window.

mouseMoved

public void mouseMoved(int x,
                       int y)
The application must implement this method in order to handle mouse moved events in the window. If no event handling is desired, this method need no be implemented.
Parameters:
x - The x coordinate of the mouse in the window.
y - The y coordinate of the mouse in the window.

mouseDragged

public void mouseDragged(int x,
                         int y)
The application must implement this method in order to handle mouse dragged events in the window. If no event handling is desired, this method need no be implemented.
Parameters:
x - The x coordinate of the mouse in the window.
y - The y coordinate of the mouse in the window.

addLabel

public java.awt.Label addLabel(java.lang.String text,
                               int row,
                               int col,
                               int width,
                               int height)
Adds a label with the specified name to the specified position, with the specified width and height.
Parameters:
text - The name of the label.
row - The beginning row (starting from 1) of the window's grid in which the label is displayed.
col - The beginning column (starting from 1) of the window's grid in which the label is displayed.
width - The number of columns of the window's grid occuppied by the label.
height - The number of rows of the window's grid occuppied by the label.
Returns:
the Label

addButton

public java.awt.Button addButton(java.lang.String text,
                                 int row,
                                 int col,
                                 int width,
                                 int height)
Adds a Button with the specified name to the specified position, with the specified width and height.
Parameters:
text - The name of the Button.
row - The beginning row (starting from 1) of the window's grid in which the Button is displayed.
col - The beginning column (starting from 1) of the window's grid in which the Button is displayed.
width - The number of columns of the window's grid occuppied by the Button.
height - The number of rows of the window's grid occuppied by the Button.
Returns:
the button. Example:
    Button okButton = addButton("OK", 1, 1, 1, 1);
    // Adds a button at position row 1, column 1,
    // with a width of 1 column and a height of one row.
 

addTextField

public java.awt.TextField addTextField(java.lang.String text,
                                       int row,
                                       int col,
                                       int width,
                                       int height)
Adds a TextField containing the specified string to the specified position, with the specified width and height.
Parameters:
text - The string to be displayed initially.
row - The beginning row (starting from 1) of the window's grid in which the TextField is displayed.
col - The beginning column (starting from 1) of the window's grid in which the TextField is displayed.
width - The number of columns of the window's grid occuppied by the TextField.
height - The number of rows of the window's grid occuppied by the TextField.
Returns:
the TextField.

addTextArea

public java.awt.TextArea addTextArea(java.lang.String text,
                                     int row,
                                     int col,
                                     int width,
                                     int height)
Adds a TextArea containing the specified string to the specified position, with the specified width and height.
Parameters:
text - The string to be displayed initially.
row - The beginning row (starting from 1) of the window's grid in which the TextArea is displayed.
col - The beginning column (starting from 1) of the window's grid in which the TextArea is displayed.
width - The number of columns of the window's grid occuppied by the TextArea.
height - The number of rows of the window's grid occuppied by the TextArea.
Returns:
the TextArea.

addList

public java.awt.List addList(int row,
                             int col,
                             int width,
                             int height)
Adds a List (a scrolling list) to the specified position, with the specified width and height.
Parameters:
row - The beginning row (starting from 1) of the window's grid in which the List is displayed.
col - The beginning column (starting from 1) of the window's grid in which the List is displayed.
width - The number of columns of the window's grid occuppied by the List.
height - The number of rows of the window's grid occuppied by the List.
Returns:
the List

addChoice

public java.awt.Choice addChoice(int row,
                                 int col,
                                 int width,
                                 int height)
Adds a Choice (pull down list) to the specified position, with the specified width and height.
Parameters:
row - The beginning row (starting from 1) of the window's grid in which the Choice is displayed.
col - The beginning column (starting from 1) of the window's grid in which the Choice is displayed.
width - The number of columns of the window's grid occuppied by the Choice.
height - The number of rows of the window's grid occuppied by the Choice.
Returns:
the Choice.

addIntegerField

public IntegerField addIntegerField(int num,
                                    int row,
                                    int col,
                                    int width,
                                    int height)
Adds an IntegerField containing the specified integer to the specified position, with the specified width and height.
Parameters:
num - The integer to be displayed initially.
row - The beginning row (starting from 1) of the window's grid in which the IntegerField is displayed.
col - The beginning column (starting from 1) of the window's grid in which the IntegerField is displayed.
width - The number of columns of the window's grid occuppied by the IntegerField.
height - The number of rows of the window's grid occuppied by the IntegerField.

addDoubleField

public DoubleField addDoubleField(double num,
                                  int row,
                                  int col,
                                  int width,
                                  int height)
Adds a DoubleField containing the specified number to the specified position, with the specified width and height.
Parameters:
num - The number to be displayed initially.
row - The beginning row (starting from 1) of the window's grid in which the DoubleField is displayed.
col - The beginning column (starting from 1) of the window's grid in which the DoubleField is displayed.
width - The number of columns of the window's grid occuppied by the DoubleField.
height - The number of rows of the window's grid occuppied by the DoubleField.

addCheckbox

public java.awt.Checkbox addCheckbox(java.lang.String text,
                                     int row,
                                     int col,
                                     int width,
                                     int height)
Adds a CheckBox to the specified position, with the specified width and height.
Parameters:
row - The beginning row (starting from 1) of the window's grid in which the CheckBox is displayed.
col - The beginning column (starting from 1) of the window's grid in which the CheckBox is displayed.
width - The number of columns of the window's grid occuppied by the CheckBox.
height - The number of rows of the window's grid occuppied by the CheckBox.
Returns:
the CheckBox.