gui
Class TitledGridBagPanel

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 gui.TitledGridBagPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public final class TitledGridBagPanel
extends javax.swing.JPanel

This is a JPanel that uses a GridBaglayout to show vertical lists of two components.

Author:
Rolf Wendolsky
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
private  java.awt.GridBagConstraints m_constraints
           
private  java.util.Vector m_rows
           
 
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
TitledGridBagPanel()
           
TitledGridBagPanel(java.lang.String a_strTitle)
           
TitledGridBagPanel(java.lang.String a_strTitle, java.awt.Insets a_insets)
           
 
Method Summary
 int addDummyRow()
          This method is useful if you plan to use your own GridBagLayout for one ore more rows.
 void addDummyRows(int a_rows)
          This method is useful if you plan to use your own GridBagLayout for one ore more rows.
 int addRow(java.awt.Component a_component)
          Add a row with one component.
 int addRow(java.awt.Component[] a_components, int[] a_gridwidths)
          This method adds several components.
 int addRow(java.awt.Component a_component, java.awt.Component a_otherComponent)
          Add a row with two components.
 int addRow(java.awt.Component a_component, java.awt.Component a_otherComponent, java.awt.Component a_thirdComponent)
          Add a row with two components.
 int addRow(java.awt.Component a_component, java.awt.Component a_otherComponent, java.awt.Component a_thirdComponent, java.awt.Component a_fourthComponent)
          Add a row with two components.
 int addRow(java.awt.Component a_component, java.awt.Component a_otherComponent, java.awt.Component a_thirdComponent, java.awt.Component a_fourthComponent, int a_fill)
           
 int addRow(java.awt.Component a_component, java.awt.Component a_otherComponent, int a_fill)
           
 java.awt.Insets getDefaultInsets()
          The default insets that are used if no other insets are given.
 int getNextRow()
          Returns the position of the next row to add.
 void removeInsets()
          It is not possible to define concrete insets because of a consistant layout.
 int replaceRow(java.awt.Component[] a_components, int[] a_gridwidths, int a_rowNumber)
          Replaces a row at the given row number.
 int replaceRow(java.awt.Component[] a_components, int[] a_gridwidths, int a_rowNumber, int a_fill)
           
 int replaceRow(java.awt.Component a_component, java.awt.Component a_otherComponent, java.awt.Component a_thirdComponent, java.awt.Component a_fourthComponent, int a_rowNumber)
          Replaces a row at the given row number.
 int replaceRow(java.awt.Component a_component, java.awt.Component a_otherComponent, java.awt.Component a_thirdComponent, java.awt.Component a_fourthComponent, int a_rowNumber, int a_fill)
          Replaces a row at the given row number.
 int replaceRow(java.awt.Component a_component, java.awt.Component a_otherComponent, java.awt.Component a_thirdComponent, int a_rowNumber)
          Replaces a row at the given row number.
 int replaceRow(java.awt.Component a_component, java.awt.Component a_otherComponent, int a_rowNumber)
          Replaces a row at the given row number.
 int replaceRow(java.awt.Component a_component, java.awt.Component a_otherComponent, int a_rowNumber, int a_fill)
           
 void setEnabled(boolean a_bEnabled)
           
 void setInsets(java.awt.Insets a_insets)
          Sets new insets for this panel.
 void setLayout(java.awt.LayoutManager a_layoutManager)
          Throws an IllegalStateException as the LayoutManager is fixed to java.awt.GridBagLayout.
 
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, 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, 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
 

Field Detail

m_constraints

private java.awt.GridBagConstraints m_constraints

m_rows

private java.util.Vector m_rows
Constructor Detail

TitledGridBagPanel

public TitledGridBagPanel()

TitledGridBagPanel

public TitledGridBagPanel(java.lang.String a_strTitle)

TitledGridBagPanel

public TitledGridBagPanel(java.lang.String a_strTitle,
                          java.awt.Insets a_insets)
Method Detail

setInsets

public void setInsets(java.awt.Insets a_insets)
Sets new insets for this panel. All following rows will get the new insets.

Parameters:
a_insets - new Insets; if null, the panel will use the default insets

getDefaultInsets

public java.awt.Insets getDefaultInsets()
The default insets that are used if no other insets are given.

Returns:
the default Insets

removeInsets

public void removeInsets()
It is not possible to define concrete insets because of a consistant layout. But by method the insets may be removed completely.


setEnabled

public void setEnabled(boolean a_bEnabled)
Overrides:
setEnabled in class javax.swing.JComponent

setLayout

public void setLayout(java.awt.LayoutManager a_layoutManager)
Throws an IllegalStateException as the LayoutManager is fixed to java.awt.GridBagLayout.

Overrides:
setLayout in class java.awt.Container
Parameters:
a_layoutManager - LayoutManager

addRow

public int addRow(java.awt.Component a_component)
Add a row with one component.

Parameters:
a_component - a Component (may be null)

addRow

public int addRow(java.awt.Component a_component,
                  java.awt.Component a_otherComponent)
Add a row with two components.

Parameters:
a_component - a Component (may be null)
a_otherComponent - an other Component (may be null)

addRow

public int addRow(java.awt.Component a_component,
                  java.awt.Component a_otherComponent,
                  int a_fill)

addRow

public int addRow(java.awt.Component a_component,
                  java.awt.Component a_otherComponent,
                  java.awt.Component a_thirdComponent,
                  java.awt.Component a_fourthComponent)
Add a row with two components.

Parameters:
a_component - a Component (may be null)
a_otherComponent - an other Component (may be null)
a_thirdComponent - a third component (may be null)
a_fourthComponent - a fourth component (may be null)

addRow

public int addRow(java.awt.Component a_component,
                  java.awt.Component a_otherComponent,
                  java.awt.Component a_thirdComponent,
                  java.awt.Component a_fourthComponent,
                  int a_fill)

addRow

public int addRow(java.awt.Component a_component,
                  java.awt.Component a_otherComponent,
                  java.awt.Component a_thirdComponent)
Add a row with two components.

Parameters:
a_component - a Component (may be null)
a_otherComponent - an other Component (may be null)
a_thirdComponent - a third component (may be null)

addDummyRow

public int addDummyRow()
This method is useful if you plan to use your own GridBagLayout for one ore more rows. It instructs this panel to count a new row but not to fill it. Please set the x and y values correctly.


addDummyRows

public void addDummyRows(int a_rows)
This method is useful if you plan to use your own GridBagLayout for one ore more rows. It instructs this panel to count a new row but not to fill it. Please set the x and y values correctly.

Parameters:
a_rows - the number of rows you want to fill "manually"

addRow

public int addRow(java.awt.Component[] a_components,
                  int[] a_gridwidths)
This method adds several components. The gridwidth of each component must be given in a_gridwidths at the corresponding position. If a_gridwidths is NULL, every component gets assigned a gridwidth of 1 cell.

Parameters:
a_components - Component[]
a_gridwidths - int[]

replaceRow

public int replaceRow(java.awt.Component a_component,
                      java.awt.Component a_otherComponent,
                      int a_rowNumber)
Replaces a row at the given row number. If the row does not exist, it is added.

Parameters:
a_component - Component
a_otherComponent - Component
a_rowNumber - int

replaceRow

public int replaceRow(java.awt.Component a_component,
                      java.awt.Component a_otherComponent,
                      int a_rowNumber,
                      int a_fill)

replaceRow

public int replaceRow(java.awt.Component a_component,
                      java.awt.Component a_otherComponent,
                      java.awt.Component a_thirdComponent,
                      int a_rowNumber)
Replaces a row at the given row number. If the row does not exist, it is added.

Parameters:
a_component - Component
a_otherComponent - Component
a_thirdComponent - Component
a_rowNumber - int

replaceRow

public int replaceRow(java.awt.Component a_component,
                      java.awt.Component a_otherComponent,
                      java.awt.Component a_thirdComponent,
                      java.awt.Component a_fourthComponent,
                      int a_rowNumber,
                      int a_fill)
Replaces a row at the given row number. If the row does not exist, it is added.

Parameters:
a_component - Component
a_otherComponent - Component
a_thirdComponent - Component
a_fourthComponent - Component
a_rowNumber - int
a_fill - int

replaceRow

public int replaceRow(java.awt.Component a_component,
                      java.awt.Component a_otherComponent,
                      java.awt.Component a_thirdComponent,
                      java.awt.Component a_fourthComponent,
                      int a_rowNumber)
Replaces a row at the given row number. If the row does not exist, it is added.

Parameters:
a_component - Component
a_otherComponent - Component
a_thirdComponent - Component
a_fourthComponent - Component
a_rowNumber - int

getNextRow

public int getNextRow()
Returns the position of the next row to add.

Returns:
the position of the next row to add

replaceRow

public int replaceRow(java.awt.Component[] a_components,
                      int[] a_gridwidths,
                      int a_rowNumber)
Replaces a row at the given row number. If the row does not exist, it is added.

Parameters:
a_components - Component[]
a_gridwidths - int[]
a_rowNumber - int

replaceRow

public int replaceRow(java.awt.Component[] a_components,
                      int[] a_gridwidths,
                      int a_rowNumber,
                      int a_fill)