Documentation of 'com.jstatcom.table.BorderTable' Java class
BorderTable
com.jstatcom.table

Class BorderTable

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.CellEditorListener, javax.swing.event.ListSelectionListener, javax.swing.event.RowSorterListener, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener, javax.swing.Scrollable
    Direct Known Subclasses:
    JSCAbstractDataTable


    public class BorderTable
    extends javax.swing.JTable
    A subclass of JTables that respects the border set. JTables do not respect borders at all.

    Beside respecting borders this table can also deal with dynamic column width, e.g. it is possible to configure a BorderTable object such that it automatically adjustes the column width when the data displayed changes. These adjustments can be limited to a minimum and maximum width.

    This table draws grid lines before the first row and the first column. For that it needs 1 pixel each direction.

    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JTable

        javax.swing.JTable.DropLocation, javax.swing.JTable.PrintMode
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.BaselineResizeBehavior
    • Field Summary

      • Fields inherited from class javax.swing.JTable

        AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS
      • Fields inherited from class javax.swing.JComponent

        TOOL_TIP_TEXT_KEY, 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

      Constructors 
      Constructor and Description
      BorderTable()
      Constructs an empty BorderTable.
      BorderTable(javax.swing.table.TableModel dm, javax.swing.table.TableColumnModel cm, javax.swing.ListSelectionModel sm)
      Constructs a BorderTable with some default settings and initializes the border.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int columnAtPoint(java.awt.Point point)
      Reimplements super method such that it considers the border now.
      void createDefaultColumnsFromModel()
      Reimplements super method.
      java.awt.Rectangle getCellRect(int row, int column, boolean includeSpacing)
      Reimplements super method such that it considers the border now.
      int getColumnWidth()
      Returns current column width.
      int getMaximumColumnWidth()
      Returns maximum column width property.
      java.awt.Dimension getMaximumSize()
      Returns the value of a getPreferredSize() method call.
      int getMinimumColumnWidth()
      Returns minimum column width property.
      java.awt.Dimension getMinimumSize()
      Returns the value of a getPreferredSize() method call.
      java.awt.Dimension getPreferredSize()
      Reimplements super method such that it considers the border now.
      boolean isDynamicColumnWidth()
      Return true if the BorderTable's column width (and the BorderTable's width) depends on the data displayed.
      int maxCellLength()
      Computes the maximum length of all cells.
      int rowAtPoint(java.awt.Point point)
      Reimplements super method such that it considers the border now.
      void setBorder(javax.swing.border.Border border)
      Reimplements super method such that the borderTableBorder is always set as the most inner border.
      void setColumnWidth(int newValue)
      This method sets the column width of the BorderTable to newValue.
      void setDynamicColumnWidth(boolean newDynamicColumnWidth)
      Set whether the BorderTable's column width adjust when the data displayed.
      void setIntercellSpacing(java.awt.Dimension newSpacing)
      Sets the width and height between cells to newSpacing and redisplays the receiver.
      void setMaximumColumnWidth(int newMaximumColumnWidth)
      Sets the BorderTable's maximum column width.
      void setMinimumColumnWidth(int newMinimumColumnWidth)
      Sets the BorderTable's minimum column width.
      void sizeColumnsToFit(int c)
      Empty method.
      void tableChanged(javax.swing.event.TableModelEvent e)
      Calls super method and determines and sets new maximum column width if isDynamicColumnWidth returns true.
      • Methods inherited from class javax.swing.JTable

        addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellEditor, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getUpdateSelectionOnSort, getValueAt, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, prepareEditor, prepareRenderer, print, print, print, print, print, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sorterChanged, updateUI, valueChanged
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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, 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

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BorderTable

        public BorderTable()
        Constructs an empty BorderTable.
      • BorderTable

        public BorderTable(javax.swing.table.TableModel dm,
                           javax.swing.table.TableColumnModel cm,
                           javax.swing.ListSelectionModel sm)
        Constructs a BorderTable with some default settings and initializes the border.
        Parameters:
        dm - the table model
        cm - the column model
        sm - the list selection model
    • Method Detail

      • columnAtPoint

        public int columnAtPoint(java.awt.Point point)
        Reimplements super method such that it considers the border now.
        Overrides:
        columnAtPoint in class javax.swing.JTable
        Parameters:
        point - the point to be checked for the underlying column
        Returns:
        index of the respective column
      • createDefaultColumnsFromModel

        public void createDefaultColumnsFromModel()
        Reimplements super method. It regards possible individual column width now.
        Overrides:
        createDefaultColumnsFromModel in class javax.swing.JTable
      • getCellRect

        public java.awt.Rectangle getCellRect(int row,
                                              int column,
                                              boolean includeSpacing)
        Reimplements super method such that it considers the border now.
        Overrides:
        getCellRect in class javax.swing.JTable
      • getColumnWidth

        public int getColumnWidth()
        Returns current column width. The width is not computed when calling this method.
        Returns:
        int Current column width.
      • getMaximumColumnWidth

        public int getMaximumColumnWidth()
        Returns maximum column width property.
        Returns:
        int maximum column width
      • getMaximumSize

        public java.awt.Dimension getMaximumSize()
        Returns the value of a getPreferredSize() method call.
        Overrides:
        getMaximumSize in class javax.swing.JComponent
      • getMinimumColumnWidth

        public int getMinimumColumnWidth()
        Returns minimum column width property.
        Returns:
        int minimum column width property
      • getMinimumSize

        public java.awt.Dimension getMinimumSize()
        Returns the value of a getPreferredSize() method call.
        Overrides:
        getMinimumSize in class javax.swing.JComponent
      • getPreferredSize

        public java.awt.Dimension getPreferredSize()
        Reimplements super method such that it considers the border now.
        Overrides:
        getPreferredSize in class javax.swing.JComponent
      • isDynamicColumnWidth

        public boolean isDynamicColumnWidth()
        Return true if the BorderTable's column width (and the BorderTable's width) depends on the data displayed.
        Returns:
        true if dynamic adjustment is on
      • maxCellLength

        public int maxCellLength()
        Computes the maximum length of all cells. This means that this method evaluates the whole data model. This can be time consuming.
      • rowAtPoint

        public int rowAtPoint(java.awt.Point point)
        Reimplements super method such that it considers the border now.
        Overrides:
        rowAtPoint in class javax.swing.JTable
        Parameters:
        point - the point to be checked for the underlying row
        Returns:
        index of the respective row
      • setBorder

        public void setBorder(javax.swing.border.Border border)
        Reimplements super method such that the borderTableBorder is always set as the most inner border.
        Overrides:
        setBorder in class javax.swing.JComponent
      • setColumnWidth

        public void setColumnWidth(int newValue)
        This method sets the column width of the BorderTable to newValue. If newValue exceeds the minimum or maximum width, it's adjusted to the appropriate limiting value. Posts a vetoable property change notification with the name "columnWidth".
        Parameters:
        newValue - the new column width
        Throws:
        java.lang.IllegalArgumentException - newValue < 0
      • setDynamicColumnWidth

        public void setDynamicColumnWidth(boolean newDynamicColumnWidth)
        Set whether the BorderTable's column width adjust when the data displayed. change. The adjustment takes place within the minimum and maximum width.
        Parameters:
        newDynamicColumnWidth - boolean
      • setIntercellSpacing

        public void setIntercellSpacing(java.awt.Dimension newSpacing)
        Sets the width and height between cells to newSpacing and redisplays the receiver. Posts a vetoable property change notification with the name "intercellSpacing".
        Overrides:
        setIntercellSpacing in class javax.swing.JTable
        Parameters:
        newSpacing - the new width and height intercellSpacing
        See Also:
        JTable.getIntercellSpacing()
      • setMaximumColumnWidth

        public void setMaximumColumnWidth(int newMaximumColumnWidth)
        Sets the BorderTable's maximum column width.
        Parameters:
        newMaximumColumnWidth - the new maximum width
      • setMinimumColumnWidth

        public void setMinimumColumnWidth(int newMinimumColumnWidth)
        Sets the BorderTable's minimum column width.
        Parameters:
        newMinimumColumnWidth - the new minimum width
      • sizeColumnsToFit

        public final void sizeColumnsToFit(int c)
        Empty method. Since sizing of BorderTables is determinied by the column width there is no need to fit the columns to set bounds.
        Overrides:
        sizeColumnsToFit in class javax.swing.JTable
      • tableChanged

        public void tableChanged(javax.swing.event.TableModelEvent e)
        Calls super method and determines and sets new maximum column width if isDynamicColumnWidth returns true.
        Specified by:
        tableChanged in interface javax.swing.event.TableModelListener
        Overrides:
        tableChanged in class javax.swing.JTable
        Parameters:
        e - the event

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.