|
|||||||
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.Window | +--java.awt.Frame | +--BreezyGUI.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!"); } }
Fields inherited from class java.awt.Frame |
CROSSHAIR_CURSOR,
DEFAULT_CURSOR,
E_RESIZE_CURSOR,
HAND_CURSOR,
ICONIFIED,
MOVE_CURSOR,
N_RESIZE_CURSOR,
NE_RESIZE_CURSOR,
NORMAL,
NW_RESIZE_CURSOR,
S_RESIZE_CURSOR,
SE_RESIZE_CURSOR,
SW_RESIZE_CURSOR,
TEXT_CURSOR,
W_RESIZE_CURSOR,
WAIT_CURSOR |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
GBApplet()
Creates a GBApplet. |
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. |
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. |
Methods inherited from class java.awt.Frame |
addNotify,
finalize,
getCursorType,
getFrames,
getIconImage,
getMenuBar,
getState,
getTitle,
isResizable,
paramString,
remove,
removeNotify,
setCursor,
setIconImage,
setMenuBar,
setResizable,
setState,
setTitle |
Methods inherited from class java.awt.Window |
addWindowListener,
applyResourceBundle,
applyResourceBundle,
dispose,
getFocusOwner,
getInputContext,
getLocale,
getOwnedWindows,
getOwner,
getToolkit,
getWarningString,
hide,
isShowing,
pack,
postEvent,
processEvent,
processWindowEvent,
removeWindowListener,
setCursor,
show,
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,
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,
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 |
public GBApplet()
Method Detail |
public void messageBox(double num)
public void messageBox(java.lang.String msg)
public void messageBox(java.lang.Object obj)
public void listItemSelected(java.awt.List listObj)
listObj
- The List in which the selection occurred.public void buttonClicked(java.awt.Button buttonObj)
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"); }
public void listDoubleClicked(java.awt.List listObj, java.lang.String itemClicked)
listObj
- The List in which the double click occurred.itemClicked
- The string selected by the double click.public void mouseClicked(int x, int y)
x
- The x coordinate of the mouse in the window.y
- The y coordinate of the mouse in the window.public void mousePressed(int x, int y)
x
- The x coordinate of the mouse in the window.y
- The y coordinate of the mouse in the window.public void mouseReleased(int x, int y)
x
- The x coordinate of the mouse in the window.y
- The y coordinate of the mouse in the window.public void mouseMoved(int x, int y)
x
- The x coordinate of the mouse in the window.y
- The y coordinate of the mouse in the window.public void mouseDragged(int x, int y)
x
- The x coordinate of the mouse in the window.y
- The y coordinate of the mouse in the window.public java.awt.Label 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 java.awt.Button 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.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.
public java.awt.TextField 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 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.public java.awt.TextArea 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 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.public java.awt.List addList(int row, int col, int width, int height)
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.public java.awt.Choice addChoice(int row, int col, int width, int height)
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.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 java.awt.Checkbox 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 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.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |