Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

novaworx.gui
Class TablePanel  view TablePanel download TablePanel.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bynovaworx.gui.TablePanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.Scrollable, java.io.Serializable
Direct Known Subclasses:
InformationPage

public class TablePanel
extends javax.swing.JPanel
implements javax.swing.Scrollable

The TablePanel container that will layout components in a rectangular grid similar to HTML tables.

For example, the following is an panel that lays out six buttons:

import java.awt.*;

public class ButtonGrid extends TablePanel {
        public TablePanel() {
                add( new Button("1") );
                add( new Button("2") );
                row();
                colspan( 2 );
                add( new Button("3") );
                row();
                rowspan( 2 );
                add( new Button("4") );
                add( new Button("5") );
                row();
                add( new Button("6") );
                done();
        }
}

Version:
1.0

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  int miColCount
           
private  int miColspan
           
private  int miHeight
           
private  int miPadding
           
private  int miPreviousColspan
           
private  int miPreviousHeight
           
private  int miPreviousRowspan
           
private  int miPreviousWidth
           
private  int miRowHeight
           
private  int miRowspan
           
private  int miSpacing
           
private  int miTotalCols
           
private  int miTotalRows
           
private  int miWidth
           
private  java.awt.GridBagConstraints moConstraints
          The GridBagConstraints for this panel.
private  java.awt.GridBagLayout moGridBag
          The GridBag for this panel.
private  java.awt.Component moPreviousComponent
          The previous component that was added via the add() method.
 
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.Container
 
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
TablePanel()
          Construct a TableGridLayout.
 
Method Summary
 java.awt.Component add(java.awt.Component aoComponent)
          Override the add method in Container.
private  void addPrevious()
          Actually add the previous component.
 void colspan(int aiSpan)
          Set the column span for the next component added.
 void done()
          All the components are added.
 int getColumnCount()
          Get the number of columns in the table.
 java.awt.Dimension getPreferredScrollableViewportSize()
          Part of the Scrollable interface.
 int getRowCount()
          Get the number of rows in the table.
 int getScrollableBlockIncrement(java.awt.Rectangle aoArea, int aiOrientation, int aiDirection)
          Part of the Scrollable interface.
 boolean getScrollableTracksViewportHeight()
          Part of the Scrollable interface.
 boolean getScrollableTracksViewportWidth()
          Part of the Scrollable interface.
 int getScrollableUnitIncrement(java.awt.Rectangle aoArea, int aiOrientation, int aiDirection)
          Part of the Scrollable interface.
 void height(int aiHeight)
          Set the height for the next component to be added.
 void row()
          Finish a row in the grid and start a new one.
 void rowspan(int aiSpan)
          Set the row span for the next component added.
 void setBorderSize(int aiBorder)
          Set the border.
 void setBorderSize(int aiTop, int aiLeft, int aiBottom, int aiRight)
          Set the border.
 void setCellPadding(int aiPadding)
          Set the cell padding.
 void setCellSpacing(int aiSpacing)
          Set the cell spacing.
 void setLayout(java.awt.LayoutManager aoLayout)
          Can not change the layout of this component.
 void width(int aiWidth)
          Set the width for the next component to be added.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, 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, processMouseEvent, 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, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

moGridBag

private java.awt.GridBagLayout moGridBag
The GridBag for this panel.


moConstraints

private java.awt.GridBagConstraints moConstraints
The GridBagConstraints for this panel.


moPreviousComponent

private java.awt.Component moPreviousComponent
The previous component that was added via the add() method.


miSpacing

private int miSpacing

miPadding

private int miPadding

miColspan

private int miColspan

miRowspan

private int miRowspan

miPreviousColspan

private int miPreviousColspan

miPreviousRowspan

private int miPreviousRowspan

miWidth

private int miWidth

miHeight

private int miHeight

miPreviousWidth

private int miPreviousWidth

miPreviousHeight

private int miPreviousHeight

miColCount

private int miColCount

miRowHeight

private int miRowHeight

miTotalCols

private int miTotalCols

miTotalRows

private int miTotalRows
Constructor Detail

TablePanel

public TablePanel()
Construct a TableGridLayout.

Method Detail

setBorderSize

public void setBorderSize(int aiBorder)
Set the border.


setBorderSize

public void setBorderSize(int aiTop,
                          int aiLeft,
                          int aiBottom,
                          int aiRight)
Set the border.


setCellPadding

public void setCellPadding(int aiPadding)
Set the cell padding.


setCellSpacing

public void setCellSpacing(int aiSpacing)
Set the cell spacing.


width

public void width(int aiWidth)
Set the width for the next component to be added.


height

public void height(int aiHeight)
Set the height for the next component to be added.


colspan

public void colspan(int aiSpan)
Set the column span for the next component added.


rowspan

public void rowspan(int aiSpan)
Set the row span for the next component added.


row

public void row()
Finish a row in the grid and start a new one.


done

public void done()
All the components are added.


add

public java.awt.Component add(java.awt.Component aoComponent)
Override the add method in Container. The component will not actually be added until the next component is added or the row() or done() method is called. This allows the table to be laid out correctly.


addPrevious

private void addPrevious()
Actually add the previous component.


setLayout

public void setLayout(java.awt.LayoutManager aoLayout)
Can not change the layout of this component.


getRowCount

public int getRowCount()
Get the number of rows in the table.


getColumnCount

public int getColumnCount()
Get the number of columns in the table.


getPreferredScrollableViewportSize

public java.awt.Dimension getPreferredScrollableViewportSize()
Part of the Scrollable interface.

Specified by:
getPreferredScrollableViewportSize in interface javax.swing.Scrollable

getScrollableUnitIncrement

public int getScrollableUnitIncrement(java.awt.Rectangle aoArea,
                                      int aiOrientation,
                                      int aiDirection)
Part of the Scrollable interface.

Specified by:
getScrollableUnitIncrement in interface javax.swing.Scrollable

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Part of the Scrollable interface.

Specified by:
getScrollableTracksViewportWidth in interface javax.swing.Scrollable

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Part of the Scrollable interface.

Specified by:
getScrollableTracksViewportHeight in interface javax.swing.Scrollable

getScrollableBlockIncrement

public int getScrollableBlockIncrement(java.awt.Rectangle aoArea,
                                       int aiOrientation,
                                       int aiDirection)
Part of the Scrollable interface.

Specified by:
getScrollableBlockIncrement in interface javax.swing.Scrollable