BreezySwing
Class GBPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by BreezySwing.GBPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class GBPanel
extends javax.swing.JPanel

The class GBPanel (short for Grid Bag Panel) provides a high-level panel. All panels come with built-in mouse event handling for motion, clicks, presses, releases, and dragging. Some panels come with event handling for buttons and list boxes.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
GBPanel()
          Creates a panel without a "parent" frame, used just for graphics with no buttons or list boxes.
GBPanel(GBApplet applet)
          Creates a panel; receives "parent" applet as argument, for event handling with buttons and list boxes.
GBPanel(GBDialog dialog)
          Creates a panel; receives "parent" dialog as argument, for event handling with buttons and list boxes.
GBPanel(GBFrame frame)
          Creates a panel; receives "parent" frame as argument, for event handling with buttons and list boxes.
 
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, with no capability to handle button events or list box events.
 GBPanel addPanel(int row, int col, int width, int height)
          Creates a GBPanel and adds it to the specified position, with the specified width and height, and connects the panel to this panel's frame, dialog, or applet for event handling with buttons and list boxes.
 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 mouseClicked(int x, int y)
          The GBPanel subclass must implement this method in order to handle mouse clicks in the panel.
 void mouseDragged(int x, int y)
          The GBPanel subclass implement this method in order to handle mouse dragged events in the panel.
 void mouseEntered(int x, int y)
          The GBPanel subclass implement this method in order to handle mouse entered events in the panel.
 void mouseExited(int x, int y)
          The GBPanel subclass implement this method in order to handle mouse exited events in the panel.
 void mouseMoved(int x, int y)
          The GBPanel subclass implement this method in order to handle mouse moved events in the panel.
 void mousePressed(int x, int y)
          The GBPanel subclass must implement this method in order to handle mouse pressed events in the panel.
 void mouseReleased(int x, int y)
          The GBPanel subclass implement this method in order to handle mouse released events in the panel.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GBPanel

public GBPanel(GBFrame frame)
Creates a panel; receives "parent" frame as argument, for event handling with buttons and list boxes.


GBPanel

public GBPanel(GBDialog dialog)
Creates a panel; receives "parent" dialog as argument, for event handling with buttons and list boxes.


GBPanel

public GBPanel(GBApplet applet)
Creates a panel; receives "parent" applet as argument, for event handling with buttons and list boxes.


GBPanel

public GBPanel()
Creates a panel without a "parent" frame, used just for graphics with no buttons or list boxes.

Method Detail

mouseClicked

public void mouseClicked(int x,
                         int y)
The GBPanel subclass must implement this method in order to handle mouse clicks in the panel. If no event handling is desired, this method need no be implemented.

Parameters:
x - The x coordinate of the mouse in the panel.
y - The y coordinate of the mouse in the panel.

mousePressed

public void mousePressed(int x,
                         int y)
The GBPanel subclass must implement this method in order to handle mouse pressed events in the panel. If no event handling is desired, this method need no be implemented.

Parameters:
x - The x coordinate of the mouse in the panel.
y - The y coordinate of the mouse in the panel.

mouseReleased

public void mouseReleased(int x,
                          int y)
The GBPanel subclass implement this method in order to handle mouse released events in the panel. If no event handling is desired, this method need no be implemented.

Parameters:
x - The x coordinate of the mouse in the panel.
y - The y coordinate of the mouse in the panel.

mouseEntered

public void mouseEntered(int x,
                         int y)
The GBPanel subclass implement this method in order to handle mouse entered events in the panel. If no event handling is desired, this method need no be implemented.

Parameters:
x - The x coordinate of the mouse in the panel.
y - The y coordinate of the mouse in the panel.

mouseExited

public void mouseExited(int x,
                        int y)
The GBPanel subclass implement this method in order to handle mouse exited events in the panel. If no event handling is desired, this method need no be implemented.

Parameters:
x - The x coordinate of the mouse in the panel.
y - The y coordinate of the mouse in the panel.

mouseMoved

public void mouseMoved(int x,
                       int y)
The GBPanel subclass implement this method in order to handle mouse moved events in the panel. If no event handling is desired, this method need no be implemented.

Parameters:
x - The x coordinate of the mouse in the panel.
y - The y coordinate of the mouse in the panel.

mouseDragged

public void mouseDragged(int x,
                         int y)
The GBPanel subclass implement this method in order to handle mouse dragged events in the panel. If no event handling is desired, this method need no be implemented.

Parameters:
x - The x coordinate of the mouse in the panel.
y - The y coordinate of the mouse in the panel.

addLabel

public 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.

Parameters:
text - The name of the label.
row - The beginning row (starting from 1) of the panel's grid in which the label is displayed.
col - The beginning column (starting from 1) of the panel's grid in which the label is displayed.
width - The number of columns of the panel's grid occuppied by the label.
height - The number of rows of the panel's grid occuppied by the label.
Returns:
the JLabel

addTextField

public 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.

Parameters:
text - The string to be displayed initially.
row - The beginning row (starting from 1) of the panel's grid in which the JTextField is displayed.
col - The beginning column (starting from 1) of the panel's grid in which the JTextField is displayed.
width - The number of columns of the panel's grid occuppied by the JTextField.
height - The number of rows of the panel's grid occuppied by the JTextField.
Returns:
the JTextField.

addTextArea

public 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.

Parameters:
text - The string to be displayed initially.
row - The beginning row (starting from 1) of the panel's grid in which the JTextArea is displayed.
col - The beginning column (starting from 1) of the panel's grid in which the JTextArea is displayed.
width - The number of columns of the panel's grid occuppied by the JTextArea.
height - The number of rows of the panel's grid occuppied by the JTextArea.
Returns:
the TextArea.

addList

public 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.

Parameters:
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.
Returns:
the JList

addComboBox

public 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.

Parameters:
row - The beginning row (starting from 1) of the panel's grid in which the JComboBox is displayed.
col - The beginning column (starting from 1) of the panel's grid in which the JComboBox is displayed.
width - The number of columns of the panel's grid occuppied by the JComboBox.
height - The number of rows of the panel's grid occuppied by the JComboBox.
Returns:
the JComboBox.

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 panel's grid in which the IntegerField is displayed.
col - The beginning column (starting from 1) of the panel's grid in which the IntegerField is displayed.
width - The number of columns of the panel's grid occuppied by the IntegerField.
height - The number of rows of the panel's grid occuppied by the IntegerField.
Returns:
the IntegerField.

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 panel's grid in which the DoubleField is displayed.
col - The beginning column (starting from 1) of the panel's grid in which the DoubleField is displayed.
width - The number of columns of the panel's grid occuppied by the DoubleField.
height - The number of rows of the panel's grid occuppied by the DoubleField.
Returns:
the DoubleField.

addCheckBox

public 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.

Parameters:
row - The beginning row (starting from 1) of the panel's grid in which the JCheckBox is displayed.
col - The beginning column (starting from 1) of the panel's grid in which the JCheckBox is displayed.
width - The number of columns of the panel's grid occuppied by the JCheckBox.
height - The number of rows of the panel's grid occuppied by the JCheckBox.
Returns:
the JCheckBox.

addRadioButton

public 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.

Parameters:
row - The beginning row (starting from 1) of the panel's grid in which the JRadioButton is displayed.
col - The beginning column (starting from 1) of the panel's grid in which the JRadioButton is displayed.
width - The number of columns of the panel's grid occuppied by the JRadioButton.
height - The number of rows of the panel's grid occuppied by the JRadioButton.
Returns:
the JRadioButton.

addButton

public 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.

Parameters:
text - The name of the Button.
row - The beginning row (starting from 1) of the panel's grid in which the Button is displayed.
col - The beginning column (starting from 1) of the panel's grid in which the Button is displayed.
width - The number of columns of the panel's grid occuppied by the Button.
height - The number of rows of the panel's grid occuppied by the Button.
Returns:
the button. Example:
    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.
 

addPanel

public 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, with no capability to handle button events or list box events.

Parameters:
row - The beginning row (starting from 1) of the panel's grid in which the GBPanel is displayed.
col - The beginning column (starting from 1) of the panel's grid in which the GBPanel is displayed.
width - The number of columns of the panel's grid occupied by the GBPanel.
height - The number of rows of the panels's grid occupied by the GBPanel.
Returns:
the GBPanel.

addPanel

public GBPanel addPanel(int row,
                        int col,
                        int width,
                        int height)
Creates a GBPanel and adds it to the specified position, with the specified width and height, and connects the panel to this panel's frame, dialog, or applet for event handling with buttons and list boxes.

Parameters:
row - The beginning row (starting from 1) of the panel's grid in which the GBPanel is displayed.
col - The beginning column (starting from 1) of the panel's grid in which the GBPanel is displayed.
width - The number of columns of the panel's grid occupied by the GBPanel.
height - The number of rows of the panel's grid occupied by the GBPanel.
Returns:
the GBPanel.