All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class BreezyGUI.GBDialog

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

public class GBDialog
extends 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.


Constructor Index

 o GBDialog(Frame)
Creates a GBDialog whose parent is the application mainFrame.

Method Index

 o addButton(String, int, int, int, int)
Adds a Button with the specified name to the specified position, with the specified width and height.
 o addCheckbox(String, int, int, int, int)
Adds a CheckBox to the specified position, with the specified width and height.
 o addChoice(int, int, int, int)
Adds a Choice (pull down list) to the specified position, with the specified width and height.
 o addDoubleField(double, int, int, int, int)
Adds a DoubleField containing the specified number to the specified position, with the specified width and height.
 o addIntegerField(int, int, int, int, int)
Adds an IntegerField containing the specified integer to the specified position, with the specified width and height.
 o addLabel(String, int, int, int, int)
Adds a label with the specified name to the specified position, with the specified width and height.
 o addList(int, int, int, int)
Adds a List (a scrolling list) to the specified position, with the specified width and height.
 o addTextArea(String, int, int, int, int)
Adds a TextArea containing the specified string to the specified position, with the specified width and height.
 o addTextField(String, int, int, int, int)
Adds a TextField containing the specified string to the specified position, with the specified width and height.
 o buttonClicked(Button)
The application must implement this method in order to handle button clicks.
 o getDlgCloseIndicator()
Returns the current dialog close indicator.
 o listDoubleClicked(List, String)
The application must implement this method in order to handle a double click on an item in a scrolling list.
 o listItemSelected(List)
The application must implement this method in order to handle a selection (single click) on an item in a scrolling list.
 o messageBox(double)
Pops up a message box containing the number and an OK button.
 o messageBox(Object)
Pops up a message box containing the string representation of the object and an OK button.
 o messageBox(String)
Pops up a message box containing the string and an OK button.
 o mouseClicked(int, int)
The application must implement this method in order to handle mouse clicks in the window.
 o mouseDragged(int, int)
The application must implement this method in order to handle mouse dragged events in the window.
 o mouseMoved(int, int)
The application must implement this method in order to handle mouse moved events in the window.
 o mousePressed(int, int)
The application must implement this method in order to handle mouse pressed events in the window.
 o mouseReleased(int, int)
The application must implement this method in order to handle mouse released events in the window.
 o setDlgCloseIndicator(String)
Allows the client to reset the dialog close indicator, which by default is "Cancel".

Constructors

 o GBDialog
 public GBDialog(Frame mainFrame)
Creates a GBDialog whose parent is the application mainFrame.

Methods

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

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

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

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

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

 o listItemSelected
 public void listItemSelected(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.
 o buttonClicked
 public void buttonClicked(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");
    }
 
 o listDoubleClicked
 public void listDoubleClicked(List listObj,
                               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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o addLabel
 public Label addLabel(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
 o addButton
 public Button addButton(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.
 
 o addTextField
 public TextField addTextField(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.
 o addTextArea
 public TextArea addTextArea(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.
 o addList
 public 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
 o addChoice
 public 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.
 o 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.
Returns:
s the IntegerField.
 o 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.
Returns:
s the DoubleField.
 o addCheckbox
 public Checkbox addCheckbox(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.

All Packages  Class Hierarchy  This Package  Previous  Next  Index