|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Panel | +--java.applet.Applet | +--javax.swing.JApplet | +--BreezySwing.GBApplet
The class GBApplet (short for Grid Bag Applet) provides a high-level applet window.
The window comes with a built in GridBagLayout. Components are added
to the window by specifying their row position, column position, width (in columns),
and height (in rows)in the grid.
Events of different types, such as button clicks and list item selections,
are handled by implementing the appropriate GBApplet methods in the application.
Unlike GBFrame, GBApplet does not support pull down menus.
Example use of GBApplet:
// Hello world applet with BreezyGUI.
import java.awt.*; import BreezyGUI.*;
public class HelloWorld extends GBApplet{
// Add a labeled button to the window at row 1, column 1, width 1, height 1. Button clickMe = addButton("Click me", 1, 1, 1, 1);
// Implement the method to handle the button click. public void buttonClicked(Button buttonObj){ messageBox("Hello world!"); } }
Inner classes inherited from class javax.swing.JApplet |
javax.swing.JApplet.AccessibleJApplet |
Inner classes inherited from class java.applet.Applet |
java.applet.Applet.AccessibleApplet |
Inner classes inherited from class java.awt.Panel |
java.awt.Panel.AccessibleAWTPanel |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Fields inherited from class javax.swing.JApplet |
accessibleContext, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
GBApplet()
Creates a GBApplet. |
Method Summary | |
javax.swing.JButton |
addButton(java.lang.String text,
int row,
int col,
int width,
int height)
Adds a JButton with the specified name to the specified position, with the specified width and height. |
javax.swing.JCheckBox |
addCheckBox(java.lang.String text,
int row,
int col,
int width,
int height)
Adds a JCheckBox to the specified position, with the specified width and height. |
javax.swing.JComboBox |
addComboBox(int row,
int col,
int width,
int height)
Adds a JComboBox (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. |
javax.swing.JLabel |
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. |
javax.swing.JList |
addList(int row,
int col,
int width,
int height)
Adds a JList (a scrolling list) to the specified position, with the specified width and height. |
GBPanel |
addPanel(GBPanel panel,
int row,
int col,
int width,
int height)
Adds a GBPanel to the specified position, with the specified width and height. |
javax.swing.JRadioButton |
addRadioButton(java.lang.String text,
int row,
int col,
int width,
int height)
Adds a JRadioButton to the specified position, with the specified width and height. |
javax.swing.JTextArea |
addTextArea(java.lang.String text,
int row,
int col,
int width,
int height)
Adds a JTextArea containing the specified string to the specified position, with the specified width and height. |
javax.swing.JTextField |
addTextField(java.lang.String text,
int row,
int col,
int width,
int height)
Adds a JTextField containing the specified string to the specified position, with the specified width and height. |
void |
buttonClicked(javax.swing.JButton buttonObj)
The application must implement this method in order to handle button clicks. |
void |
listDoubleClicked(javax.swing.JList 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(javax.swing.JList 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(double num,
int width,
int height)
|
void |
messageBox(java.lang.Object msg)
Pops up a message box containing the string representation of the object and an OK button. |
void |
messageBox(java.lang.Object msg,
int width,
int height)
|
void |
messageBox(java.lang.String msg)
Pops up a message box containing the string and an OK button. |
void |
messageBox(java.lang.String msg,
int width,
int height)
|
void |
setLookAndFeel(java.lang.String type)
Allows the application to set the look and feel of the window and all its subcomponents to a platform-specific look and feel. |
Methods inherited from class javax.swing.JApplet |
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
Methods inherited from class java.applet.Applet |
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, init, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop |
Methods inherited from class java.awt.Panel |
addNotify |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setFont, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, 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, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public GBApplet()
Method Detail |
public void messageBox(double num)
public void messageBox(java.lang.String msg)
public void messageBox(java.lang.Object msg)
public void messageBox(double num, int width, int height)
public void messageBox(java.lang.String msg, int width, int height)
public void messageBox(java.lang.Object msg, int width, int height)
public void setLookAndFeel(java.lang.String type)
type
- A String, either "METAL", "MOTIF", or "OTHER"public void listItemSelected(javax.swing.JList listObj)
listObj
- The JList in which the selection occurred.public void buttonClicked(javax.swing.JButton buttonObj)
buttonObj
- The JButton in which the click occurred.
Example:
// Add the buttons to the window. JButton okButton = addButton("OK", 1, 1, 1, 1); JButton cancelButton = addButton("Cancel", 1, 2, 1, 1); // Handle the button selection. public void buttonClicked(JButton buttonObj){ if (buttonObj == okButton) messageBox("OK selected"); else messageBox("Cancel selected"); }
public void listDoubleClicked(javax.swing.JList listObj, java.lang.String itemClicked)
listObj
- The JList in which the double click occurred.itemClicked
- The string selected by the double click.public javax.swing.JLabel addLabel(java.lang.String text, int row, int col, int width, int height)
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.public javax.swing.JButton addButton(java.lang.String text, int row, int col, int width, int height)
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.JButton 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.
public javax.swing.JTextField addTextField(java.lang.String text, int row, int col, int width, int height)
text
- The string to be displayed initially.row
- The beginning row (starting from 1) of the window's grid in which the JTextField is displayed.col
- The beginning column (starting from 1) of the window's grid in which the JTextField is displayed.width
- The number of columns of the window's grid occuppied by the JTextField.height
- The number of rows of the window's grid occuppied by the JTextField.public javax.swing.JTextArea addTextArea(java.lang.String text, int row, int col, int width, int height)
text
- The string to be displayed initially.row
- The beginning row (starting from 1) of the window's grid in which the JTextArea is displayed.col
- The beginning column (starting from 1) of the window's grid in which the JTextArea is displayed.width
- The number of columns of the window's grid occuppied by the JTextArea.height
- The number of rows of the window's grid occuppied by the JTextArea.public javax.swing.JList addList(int row, int col, int width, int height)
row
- The beginning row (starting from 1) of the window's grid in which the JList is displayed.col
- The beginning column (starting from 1) of the window's grid in which the JList is displayed.width
- The number of columns of the window's grid occuppied by the JList.height
- The number of rows of the window's grid occuppied by the JList.public javax.swing.JComboBox addComboBox(int row, int col, int width, int height)
row
- The beginning row (starting from 1) of the window's grid in which the JComboBox is displayed.col
- The beginning column (starting from 1) of the window's grid in which the JComboBox is displayed.width
- The number of columns of the window's grid occuppied by the JComboBox.height
- The number of rows of the window's grid occuppied by the JComboBox.public IntegerField addIntegerField(int num, int row, int col, int width, int height)
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.public DoubleField addDoubleField(double num, int row, int col, int width, int height)
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.public javax.swing.JCheckBox addCheckBox(java.lang.String text, int row, int col, int width, int height)
row
- The beginning row (starting from 1) of the window's grid in which the JCheckBox is displayed.col
- The beginning column (starting from 1) of the window's grid in which the JCheckBox is displayed.width
- The number of columns of the window's grid occuppied by the JCheckBox.height
- The number of rows of the window's grid occuppied by the JCheckBox.public javax.swing.JRadioButton addRadioButton(java.lang.String text, int row, int col, int width, int height)
row
- The beginning row (starting from 1) of the window's grid in which the JRadioButton is displayed.col
- The beginning column (starting from 1) of the window's grid in which the JRadioButton is displayed.width
- The number of columns of the window's grid occuppied by the JRadioButton.height
- The number of rows of the window's grid occuppied by the JRadioButton.public GBPanel addPanel(GBPanel panel, int row, int col, int width, int height)
row
- The beginning row (starting from 1) of the window's grid in which the GBPanel is displayed.col
- The beginning column (starting from 1) of the window's grid in which the GBPanel is displayed.width
- The number of columns of the window's grid occuppied by the GBPanel.height
- The number of rows of the window's grid occuppied by the GBPanel.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |