ccl.swing
Class CCLTable

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JScrollPane
                          |
                          +--ccl.swing.TableScrollPane
                                |
                                +--ccl.swing.CCLTable
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.ScrollPaneConstants, java.io.Serializable

public class CCLTable
extends ccl.swing.TableScrollPane

A nicer looking swing table. It uses vertical grid lines, but unlike the default swing table implementation, rows which are still empty, get their grid line painted just the same. Additionally, a nicer border is applied and the table headers have a slightly thicker border as well.

See Also:
Serialized Form

Field Summary
static int AUTO_RESIZE_ALL_COLUMNS
           
static int AUTO_RESIZE_LAST_COLUMN
           
static int AUTO_RESIZE_NEXT_COLUMN
           
static int AUTO_RESIZE_OFF
           
static int AUTO_RESIZE_SUBSEQUENT_COLUMNS
           
static int AUTO_SIZE_LAST_COLUMN_TO_FIT
           
 
Fields inherited from class javax.swing.JScrollPane
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
 
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 javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CCLTable(javax.swing.table.TableModel aModel, java.awt.Font font)
          Create a ScrollableJtable based on the model.
 
Method Summary
 void addMouseListener(java.awt.event.MouseListener listener)
          Gets forwarded to contained table.
 java.awt.Rectangle getCellRect(int row, int column, boolean includeSpacing)
           
protected  int getResizeMode()
          Returns resize mode used for this table.
 javax.swing.ListSelectionModel getSelectionModel()
          Gets forwarded to contained table.
 javax.swing.JTable getTable()
          Return the JTable component that is behind this ScrollableJTable.
 void paintComponent(java.awt.Graphics g)
          This overrides the component's paint method.
static void paintComponent(java.awt.Graphics g, javax.swing.JTable table, javax.swing.JScrollPane scrollpane)
          This overrides the component's paint method.
 void scrollRectToVisible(java.awt.Rectangle rectangle)
          Gets forwarded to contained table.
 void setAutoResizeMode(int aResizeMode)
          Set the resizemode.
 void setSelectionMode(int selectionMode)
          Gets forwarded to contained table.
 void setViewportView(java.awt.Component view)
           
 
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setWheelScrollingEnabled, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, getPropertyChangeListeners, getPropertyChangeListeners, 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, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, 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, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, 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, 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, repaint, repaint, repaint, resize, resize, setBounds, setBounds, 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

AUTO_SIZE_LAST_COLUMN_TO_FIT

public static final int AUTO_SIZE_LAST_COLUMN_TO_FIT
See Also:
Constant Field Values

AUTO_RESIZE_ALL_COLUMNS

public static final int AUTO_RESIZE_ALL_COLUMNS
See Also:
Constant Field Values

AUTO_RESIZE_LAST_COLUMN

public static final int AUTO_RESIZE_LAST_COLUMN
See Also:
Constant Field Values

AUTO_RESIZE_NEXT_COLUMN

public static final int AUTO_RESIZE_NEXT_COLUMN
See Also:
Constant Field Values

AUTO_RESIZE_OFF

public static final int AUTO_RESIZE_OFF
See Also:
Constant Field Values

AUTO_RESIZE_SUBSEQUENT_COLUMNS

public static final int AUTO_RESIZE_SUBSEQUENT_COLUMNS
See Also:
Constant Field Values
Constructor Detail

CCLTable

public CCLTable(javax.swing.table.TableModel aModel,
                java.awt.Font font)
Create a ScrollableJtable based on the model.

Parameters:
font - the font used for the table header.
Method Detail

getTable

public javax.swing.JTable getTable()
Return the JTable component that is behind this ScrollableJTable.

Returns:
the table

setAutoResizeMode

public void setAutoResizeMode(int aResizeMode)
Set the resizemode. Comparable with the modes provided with JTable.

Parameters:
aResizeMode - the resize mode

getCellRect

public java.awt.Rectangle getCellRect(int row,
                                      int column,
                                      boolean includeSpacing)
See Also:
JTable.getCellRect(int, int, boolean)

addMouseListener

public void addMouseListener(java.awt.event.MouseListener listener)
Gets forwarded to contained table.

Overrides:
addMouseListener in class java.awt.Component

getSelectionModel

public javax.swing.ListSelectionModel getSelectionModel()
Gets forwarded to contained table.


setSelectionMode

public void setSelectionMode(int selectionMode)
Gets forwarded to contained table.


scrollRectToVisible

public void scrollRectToVisible(java.awt.Rectangle rectangle)
Gets forwarded to contained table.

Overrides:
scrollRectToVisible in class javax.swing.JComponent

getResizeMode

protected int getResizeMode()
Returns resize mode used for this table.


paintComponent

public void paintComponent(java.awt.Graphics g)
This overrides the component's paint method. It draws vertical lines to seperate the table's columns.

Overrides:
paintComponent in class javax.swing.JComponent
See Also:
JComponent.paintComponent(java.awt.Graphics)

paintComponent

public static void paintComponent(java.awt.Graphics g,
                                  javax.swing.JTable table,
                                  javax.swing.JScrollPane scrollpane)
This overrides the component's paint method. It draws vertical lines to seperate the table's columns.


setViewportView

public void setViewportView(java.awt.Component view)
Overrides:
setViewportView in class javax.swing.JScrollPane
See Also:
JScrollPane.setViewportView(java.awt.Component)