Quick Reference for BreezySwing

To use this quick reference, select a class from the following list.  After browsing the information for that class, you can return to this point to make further selections.

Note that the parent class of each BreezySwing class follows the keyword extends.  For complete documentation on the javax.swing classes, consult Oracle's Java Documentation Site.

 

BreezySwing Class

Purpose

DoubleField extends JTextField

Data entry field for floating-point numbers.

GBApplet extends JApplet Represents an applet.

GBDialog extends JDialog

Represents a popup dialog.

GBFrame extends JFrame

Represents an application window.

GBPanel extends JPanel

Represents a rectangular region within a window, dialog, or applet.

IntegerField extends JTextField

Data entry field for integers.

 

 

DoubleField

This class represents a data field for input and output of floating-point numbers.  It includes all of the methods and attributes of its parent class, javax.swing.JTextField, as well as methods related to the I/O of numbers.

DoubleField Method

What it does

double getNumber()

Returns the number currently in the field.  If the field does not contain an integer or floating-point number, resets its contents to 0.0 and returns 0.0.

boolean isValidNumber()

Returns true if the field contains an integer or floating-point number, or false otherwise.

void setNumber(number)

Sets the contents of the field to number.

void setPrecision(precision)

Sets the precision used to display the number to precision.

 

Return to top

IntegerField

This class represents a data field for input and output of integers.  It includes all of the methods and attributes of its parent class, tkinter.Entry, as well as methods related to the I/O of numbers.

IntegerField Method

What it does

int getNumber()

Returns the number currently in the field.  If the field does not contain an integer, resets its contents to 0 and returns 0.

boolean isValidNumber()

Returns true if the field contains an integer, or false otherwise.

void setNumber(number)

Sets the contents of the field to number.

  Return to top

 

GBApplet

This class represents an applet.  It includes all of the methods and attributes of its parent class, javax.swing.JApplet, as well as methods for adding widgets to the dialog’s window and for responding to various events. Any widget can be added except for menu items. 

GBApplet Method

What it does

JButton addButton(text, row, column,

     width,

     height)

         

Creates a button with the given attributes, adds it to the window, and returns the button.

JCheckBox addCheckBox(

     text, row,

     column,

     width,

     height )

Creates a check box with the given attributes, adds it to the window, and returns the check box.

DoubleField addDoubleField(

     value, row,

     column,

     width,

     height)

Creates a data entry field with the given attributes, adds it to the window, and returns the field. Used for the I/O of floating-point numbers.

IntegerField addIntegerField(

     value, row,

     column,

     width,

     height )

Creates a data entry field with the given attributes, adds it to the window, and returns the field. Used for the I/O of integers.

JLabel addLabel(

     text, row, column,

     width,

     height )

Creates a label with the given attributes, adds it to the window, and returns the label.

JList addList(

     row, column,  

     width,

     height)

Creates a list box with the given attributes, adds it to the window, and returns the list box.

GBPanel addPanel(row, column,

     width,

     height)

Creates a panel, adds it to the window, and returns the panel. This panel is an instance of GBPanel and can be used either for drawing graphics or for organizing other widgets.

GBPanel addPanel(aPanel, row, column,

     width,

     height)

Adds aPanel to the window and returns the panel. aPanel should be an instance of of GBPanel or a subclass and should be used only for drawing graphics.

JRadioButton addRadioButton(row, column,

     width,

     height)

Creates a radio button with the given attributes, adds it to the window, and returns the radio button.

JTextArea addTextArea(

     text, row,

     column,

     width,

     height)

Creates a text area with the given attributes, adds it to the window, and returns the text area. Used for the I/O of multiple lines of text.

JTextField addTextField(

     text, row,

     column,

     width,

     height )

Creates data entry field with the given attributes, adds it to the window, and returns the text field. Used for the I/O of single lines of text.

void buttonClicked(buttonObj) Is triggered when a button is clicked.  This method can be overridden to respond to button click events. buttonObj is the instance of JButton where the click occurred.
void listItemSelected(listObj) Is triggered when a list box item is selected or double-clicked.  This method can be overridden to respond to list selection events. listObj is the instance of JList where the selection or double-click occurred.
void listDoubleClicked(listObj, aString) Is triggered when a list box item is double-clicked.  This method can be overridden to respond to double-click events. listObj is the instance of JList where the double-click occurred, and aString is the selected item.

void messageBox(anObject)

Pops up a message box that displays the string representation of anObject and waits for the user to close it.

void messageBox(anObject, width, height)

Pops up a message box with the given width and height that displays the string representation of anObject and waits for the user to close it.

void messageBox(aString)

Pops up a message box that displays aString and waits for the user to close it.

void messageBox(aString, width, height)

Pops up a message box with the given width and height that displays aString and waits for the user to close it.

 

Return to top

GBDialog

This class represents a popup dialog.  It includes all of the methods and attributes of its parent class, javax.swing.JDialog, as well as methods for adding widgets to the dialogÕs window and for responding to various events. Any widget can be added except for menu items.  A specialized dialog class is defined as a subclass of GBDialog.  This subclass should include a constructor with an argument for the parent window and a buttonClicked method.  The constructor must run super(parent) at startup. A dialog has a close indicator whose default value is "Cancel" but the constructor can override this value. The buttonClicked method can reset this value to indicate the reason for closing the dialog. When the dialog returns to the parent window, the parent can examine the reason for closing by called the getDlgCloseIndicator method. The dispose() method is called to close the dialog under program control. 

GBDialog Method

What it does

JButton addButton(text, row, column,

     width,

     height)

         

Creates a button with the given attributes, adds it to the window, and returns the button.

JCheckBox addCheckBox(

     text, row,

     column,

     width,

     height )

Creates a check box with the given attributes, adds it to the window, and returns the check box.

DoubleField addDoubleField(

     value, row,

     column,

     width,

     height)

Creates a data entry field with the given attributes, adds it to the window, and returns the field. Used for the I/O of floating-point numbers.

IntegerField addIntegerField(

     value, row,

     column,

     width,

     height )

Creates a data entry field with the given attributes, adds it to the window, and returns the field. Used for the I/O of integers.

JLabel addLabel(

     text, row, column,

     width,

     height )

Creates a label with the given attributes, adds it to the window, and returns the label.

JList addList(

     row, column,  

     width,

     height)

Creates a list box with the given attributes, adds it to the window, and returns the list box.

GBPanel addPanel(row, column,

     width,

     height)

Creates a panel, adds it to the window, and returns the panel. This panel is an instance of GBPanel and can be used either for drawing graphics or for organizing other widgets.

GBPanel addPanel(aPanel, row, column,

     width,

     height)

Adds aPanel to the window and returns the panel. aPanel should be an instance of of GBPanel or a subclass and should be used only for drawing graphics.

JRadioButton addRadioButton(row, column,

     width,

     height)

Creates a radio button with the given attributes, adds it to the window, and returns the radio button.

JTextArea addTextArea(

     text, row,

     column,

     width,

     height)

Creates a text area with the given attributes, adds it to the window, and returns the text area. Used for the I/O of multiple lines of text.

JTextField addTextField(

     text, row,

     column,

     width,

     height )

Creates a data entry field with the given attributes, adds it to the window, and returns the text field. Used for the I/O of single lines of text.

void buttonClicked(buttonObj) Is triggered when a button is clicked.  This method can be overridden to respond to button click events. buttonObj is the instance of JButton where the click occurred.
String getDlgCloseIndicator() Returns the dialog’s close indicator.  This method is typically called within the parent window of the dialog, after the dialog has returned, to determined why it closed.
void listItemSelected(listObj) Is triggered when a list box item is selected or double-clicked.  This method can be overridden to respond to list selection events. listObj is the instance of JList where the selection or double-click occurred.
void listDoubleClicked(listObj, aString) Is triggered when a list box item is double-clicked.  This method can be overridden to respond to double-click events. listObj is the instance of JList where the double-click occurred, and aString is the selected item.

void messageBox(anObject)

Pops up a message box that displays the string representation of anObject and waits for the user to close it.

void messageBox(anObject, width, height)

Pops up a message box with the given width and height that displays the string representation of anObject and waits for the user to close it.

void messageBox(aString)

Pops up a message box that displays aString and waits for the user to close it.

void messageBox(aString, width, height)

Pops up a message box with the given width and height that displays aString and waits for the user to close it.

void setDlgCloseIndicator(aString)

Resets the dialogÕs close indicator to aString.  This method is typically called within the dialogÕs constructor and buttonClicked method.

 

Return to top

GBFrame

This class represents a top-level application window.  It includes all of the methods and attributes of its parent class, javax.swing.JFrame, as well as methods for adding widgets to the frame’s window and for responding to various events. A specialized window class is defined as a subclass of GBFrame.   

GBFrame Method

What it does

JButton addButton(text, row, column,

     width,

     height)

         

Creates a button with the given attributes, adds it to the window, and returns the button.

JCheckBox addCheckBox(

     text, row,

     column,

     width,

     height )

Creates a check box with the given attributes, adds it to the window, and returns the check box.

DoubleField addDoubleField(

     value, row,

     column,

     width,

     height)

Creates a data entry field with the given attributes, adds it to the window, and returns the field. Used for the I/O of floating-point numbers.

IntegerField addIntegerField(

     value, row,

     column,

     width,

     height )

Creates a data entry field with the given attributes, adds it to the window, and returns the field. Used for the I/O of integers.

JLabel addLabel(

     text, row, column,

     width,

     height )

Creates a label with the given attributes, adds it to the window, and returns the label.

JList addList(

     row, column,  

     width,

     height)

Creates a list box with the given attributes, adds it to the window, and returns the list box.

JMenuItem addMenuItem(

     menuName,

     menuItemName)

Creates a menu item with the given item name, adds it to the menu with the given menu name, and returns the menu item. Menus and menu items are added in the order in which this method is called.

GBPanel addPanel(row, column,

     width,

     height)

Creates a panel, adds it to the window, and returns the panel. This panel is an instance of GBPanel and can be used either for drawing graphics or for organizing other widgets.

GBPanel addPanel(aPanel, row, column,

     width,

     height)

Adds aPanel to the window and returns the panel. aPanel should be an instance of of GBPanel or a subclass and should be used only for drawing graphics.

JRadioButton addRadioButton(row, column,

     width,

     height)

Creates a radio button with the given attributes, adds it to the window, and returns the radio button.

JTextArea addTextArea(

     text, row,

     column,

     width,

     height)

Creates a text area with the given attributes, adds it to the window, and returns the text area. Used for the I/O of multiple lines of text.

JTextField addTextField(

     text, row,

     column,

     width,

     height )

Creates a data entry field with the given attributes, adds it to the window, and returns the text field. Used for the I/O of single lines of text.

void buttonClicked(buttonObj) Is triggered when a button is clicked.  This method can be overridden to respond to button click events. buttonObj is the instance of JButton where the click occurred.
void listItemSelected(listObj) Is triggered when a list box item is selected or double-clicked.  This method can be overridden to respond to list selection events. listObj is the instance of JList where the selection or double-click occurred.
void listDoubleClicked(listObj, aString) Is triggered when a list box item is double-clicked.  This method can be overridden to respond to double-click events. listObj is the instance of JList where the double-click occurred, and aString is the selected item.

void messageBox(anObject)

Pops up a message box that displays the string representation of anObject and waits for the user to close it.

void messageBox(anObject, width, height)

Pops up a message box with the given width and height that displays the string representation of anObject and waits for the user to close it.

void messageBox(aString)

Pops up a message box that displays aString and waits for the user to close it.

void messageBox(aString, width, height)

Pops up a message box with the given width and height that displays aString and waits for the user to close it.

 

Return to top

 

GBPanel

This class represents a rectangular area that can contain widgets or serve as a drawing area for graphics.  A panel can be added to the top-level window or to another panel.  A panel includes all of the methods and attributes of its parent class, javax.swing.JPanel, as well as methods for adding widgets to it. When events occur in buttons or list boxes, the panel's parent window can handle them. 

GBPanel Method

What it does

JButton addButton(text, row, column,

     width,

     height)

         

Creates a button with the given attributes, adds it to the window, and returns the button.

JCheckBox addCheckBox(

     text, row,

     column,

     width,

     height )

Creates a check box with the given attributes, adds it to the window, and returns the check box.

DoubleField addDoubleField(

     value, row,

     column,

     width,

     height)

Creates a data entry field with the given attributes, adds it to the window, and returns the field. Used for the I/O of floating-point numbers.

IntegerField addIntegerField(

     value, row,

     column,

     width,

     height )

Creates a data entry field with the given attributes, adds it to the window, and returns the field. Used for the I/O of integers.

JLabel addLabel(

     text, row, column,

     width,

     height )

Creates a label with the given attributes, adds it to the window, and returns the label.

JList addList(

     row, column,  

     width,

     height)

Creates a list box with the given attributes, adds it to the window, and returns the list box.

GBPanel addPanel(row, column,

     width,

     height)

Creates a panel, adds it to the window, and returns the panel. This panel is an instance of GBPanel and can be used either for drawing graphics or for organizing other widgets.

GBPanel addPanel(aPanel, row, column,

     width,

     height)

Adds aPanel to the window and returns the panel. aPanel should be an instance of of GBPanel or a subclass and should be used only for drawing graphics.

JRadioButton addRadioButton(row, column,

     width,

     height)

Creates a radio button with the given attributes, adds it to the window, and returns the radio button.

JTextArea addTextArea(

     text, row,

     column,

     width,

     height)

Creates a text area with the given attributes, adds it to the window, and returns the text area. Used for the I/O of multiple lines of text.

JTextField addTextField(

     text, row,

     column,

     width,

     height )

Creates a data entry field with the given attributes, adds it to the window, and returns the text field. Used for the I/O of single lines of text.

 

Return to top