Search in sources :

Example 31 with JViewport

use of javax.swing.JViewport in project jgnash by ccavanaugh.

the class JideScrollPane method setViewport.

@Override
public void setViewport(JViewport viewport) {
    JViewport old = getViewport();
    super.setViewport(viewport);
    if (old != null) {
        if (rowHeader != null) {
            JideSwingUtilities.unsynchronizeView(rowHeader, old);
        }
        if (_rowFooter != null) {
            JideSwingUtilities.unsynchronizeView(_rowFooter, old);
            JideSwingUtilities.unsynchronizeView(old, _rowFooter);
        }
        if (_columnFooter != null) {
            JideSwingUtilities.unsynchronizeView(_columnFooter, old);
            JideSwingUtilities.unsynchronizeView(old, _columnFooter);
        }
        if (columnHeader != null) {
            JideSwingUtilities.unsynchronizeView(columnHeader, old);
        }
    }
    if (viewport != null) {
        if (rowHeader != null) {
            JideSwingUtilities.synchronizeView(rowHeader, getViewport(), SwingConstants.VERTICAL);
        }
        if (_rowFooter != null) {
            JideSwingUtilities.synchronizeView(_rowFooter, getViewport(), SwingConstants.VERTICAL);
            JideSwingUtilities.synchronizeView(getViewport(), _rowFooter, SwingConstants.VERTICAL);
        }
        if (_columnFooter != null) {
            JideSwingUtilities.synchronizeView(_columnFooter, getViewport(), SwingConstants.HORIZONTAL);
            JideSwingUtilities.synchronizeView(getViewport(), _columnFooter, SwingConstants.HORIZONTAL);
        }
        if (columnHeader != null) {
            JideSwingUtilities.synchronizeView(columnHeader, getViewport(), SwingConstants.HORIZONTAL);
        }
    }
}
Also used : JViewport(javax.swing.JViewport)

Example 32 with JViewport

use of javax.swing.JViewport in project jgnash by ccavanaugh.

the class JideScrollPane method setRowHeader.

/**
     * Override setRowHeader method in JScrollPane and synchronize the view with the main viewport. Swing tried to
     * implement this feature but it will break if the view position changes starts from rowHeader.
     *
     * @param rowHeader the new row header
     */
@Override
public void setRowHeader(JViewport rowHeader) {
    JViewport old = getRowHeader();
    super.setRowHeader(rowHeader);
    if (old != null) {
        JideSwingUtilities.unsynchronizeView(old, getViewport());
        JideSwingUtilities.unsynchronizeView(getViewport(), old);
    }
    if (getRowHeader() != null) {
        JideSwingUtilities.synchronizeView(getRowHeader(), getViewport(), SwingConstants.VERTICAL);
        JideSwingUtilities.synchronizeView(getViewport(), getRowHeader(), SwingConstants.VERTICAL);
    }
}
Also used : JViewport(javax.swing.JViewport)

Example 33 with JViewport

use of javax.swing.JViewport in project jgnash by ccavanaugh.

the class JideScrollPane method setColumnFooter.

/**
     * Removes the old columnFooter, if it exists.  If the new columnFooter isn't {@code null}, sync the x
     * coordinate of the its viewPosition with the viewport (if there is one) and then add it to the scrollpane.
     *
     * @param columnFooter the new column footer to be used; if {@code null} the old column footer is still removed
     *                     and the new columnFooter is set to {@code null}
     * @see #getColumnFooter
     * @see #setColumnFooterView(java.awt.Component)
     */
private void setColumnFooter(final JViewport columnFooter) {
    JViewport old = getColumnFooter();
    _columnFooter = columnFooter;
    if (null != columnFooter) {
        add(columnFooter, COLUMN_FOOTER);
    } else if (null != old) {
        remove(old);
    }
    firePropertyChange("columnFooter", old, columnFooter);
    revalidate();
    repaint();
    if (old != null) {
        JideSwingUtilities.unsynchronizeView(old, getViewport());
        JideSwingUtilities.unsynchronizeView(getViewport(), old);
    }
    if (_columnFooter != null) {
        JideSwingUtilities.synchronizeView(_columnFooter, getViewport(), SwingConstants.HORIZONTAL);
        JideSwingUtilities.synchronizeView(getViewport(), _columnFooter, SwingConstants.HORIZONTAL);
    }
}
Also used : JViewport(javax.swing.JViewport)

Aggregations

JViewport (javax.swing.JViewport)33 JScrollPane (javax.swing.JScrollPane)12 Component (java.awt.Component)9 Container (java.awt.Container)8 Dimension (java.awt.Dimension)7 Point (java.awt.Point)5 Rectangle (java.awt.Rectangle)5 RTextScrollPane (org.fife.ui.rtextarea.RTextScrollPane)3 Graphics (java.awt.Graphics)2 BufferedImage (java.awt.image.BufferedImage)2 JButton (javax.swing.JButton)2 JCheckBox (javax.swing.JCheckBox)2 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)2 JColorChooser (javax.swing.JColorChooser)2 JComponent (javax.swing.JComponent)2 JDesktopPane (javax.swing.JDesktopPane)2 JScrollBar (javax.swing.JScrollBar)2 JTabbedPane (javax.swing.JTabbedPane)2 JTable (javax.swing.JTable)2 ChangeListener (javax.swing.event.ChangeListener)2