|
|||||||||
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.Dialog | +--javax.swing.JDialog | +--BreezySwing.GBDialog
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.
Inner classes inherited from class javax.swing.JDialog |
javax.swing.JDialog.AccessibleJDialog |
Inner classes inherited from class java.awt.Dialog |
java.awt.Dialog.AccessibleAWTDialog |
Inner classes inherited from class java.awt.Window |
java.awt.Window.AccessibleAWTWindow |
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.JDialog |
accessibleContext, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
GBDialog(javax.swing.JFrame theMainFrm)
Creates a GBDialog whose parent is the application mainFrame. |
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. |
java.lang.String |
getDlgCloseIndicator()
Returns the current dialog close indicator. |
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 |
setDlgCloseIndicator(java.lang.String str)
Allows the client to reset the dialog close indicator, which by default is "Cancel". |
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. |
void |
setSize(int width,
int height)
|
Methods inherited from class javax.swing.JDialog |
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setLocationRelativeTo, setRootPane, setRootPaneCheckingEnabled, update |
Methods inherited from class java.awt.Dialog |
addNotify, dispose, getTitle, hide, isModal, isResizable, setModal, setResizable, setTitle, show |
Methods inherited from class java.awt.Window |
addWindowListener, applyResourceBundle, applyResourceBundle, finalize, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isShowing, pack, postEvent, processEvent, removeWindowListener, setCursor, toBack, toFront |
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, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, 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, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, 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, setVisible, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public GBDialog(javax.swing.JFrame theMainFrm)
Method Detail |
public void setDlgCloseIndicator(java.lang.String str)
public java.lang.String getDlgCloseIndicator()
public void setSize(int width, int height)
setSize
in class java.awt.Component
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 |