/** * Creates a sub-column-header viewport if necessary, sets its view, and then adds the sub-column-header viewport to * the scrollpane. * * @param view the component to display as the sub column header * @see #setSubColumnHeader(javax.swing.JViewport) * @see JViewport#setView(java.awt.Component) */ public void setSubColumnHeaderView(Component view) { if (null == getSubColumnHeader()) { setSubColumnHeader(createViewport()); } getSubColumnHeader().setView(view); }
@Override public void syncWithScrollPane(JScrollPane sp) { super.syncWithScrollPane(sp); if (sp instanceof JideScrollPane) { _rowFoot = ((JideScrollPane) sp).getRowFooter(); _colFoot = ((JideScrollPane) sp).getColumnFooter(); _subColHead = ((JideScrollPane) sp).getSubColumnHeader(); _hLeft = ((JideScrollPane) sp).getScrollBarCorner(HORIZONTAL_LEFT); _hRight = ((JideScrollPane) sp).getScrollBarCorner(HORIZONTAL_RIGHT); _vTop = ((JideScrollPane) sp).getScrollBarCorner(VERTICAL_TOP); _vBottom = ((JideScrollPane) sp).getScrollBarCorner(VERTICAL_BOTTOM); _subUpperLeft = sp.getCorner(SUB_UPPER_LEFT); _subUpperRight = sp.getCorner(SUB_UPPER_RIGHT); } }
/** * Removes the old sub column header, if it exists. If the new sub column header isn't <code>null</code>, sync the * x coordinate of the its viewPosition with the viewport (if there is one) and then add it to the scroll pane. * * @param subColumnHeader the new sub column header to be used; if <code>null</code> the old sub column header is * still removed and the new sub column header is set to <code>null</code> * @see #getSubColumnHeader() */ public void setSubColumnHeader(JViewport subColumnHeader) { JViewport old = getSubColumnHeader(); _subColumnHeader = subColumnHeader; if (null != subColumnHeader) { add(subColumnHeader, SUB_COLUMN_HEADER); } else if (null != old) { remove(old); } firePropertyChange("subColumnHeader", old, subColumnHeader); revalidate(); repaint(); if (old != null) { JideSwingUtilities.unsynchronizeView(old, getViewport()); JideSwingUtilities.unsynchronizeView(getViewport(), old); } if (_subColumnHeader != null) { JideSwingUtilities.synchronizeView(_subColumnHeader, getViewport(), SwingConstants.HORIZONTAL); JideSwingUtilities.synchronizeView(getViewport(), _subColumnHeader, SwingConstants.HORIZONTAL); } }