Search in sources :

Example 26 with JViewport

use of javax.swing.JViewport in project pcgen by PCGen.

the class JDynamicTable method configureEnclosingScrollPane.

@Override
protected void configureEnclosingScrollPane() {
    super.configureEnclosingScrollPane();
    Container p = getParent();
    if (p instanceof JViewport) {
        Container gp = p.getParent();
        if (gp instanceof JScrollPane) {
            JScrollPane scrollPane = (JScrollPane) gp;
            // Make certain we are the viewPort's view and not, for
            // example, the rowHeaderView of the scrollPane -
            // an implementor of fixed columns might do this.
            JViewport viewport = scrollPane.getViewport();
            if (viewport == null || viewport.getView() != this) {
                return;
            }
            scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            scrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, cornerButton);
        }
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) Container(java.awt.Container) JViewport(javax.swing.JViewport)

Example 27 with JViewport

use of javax.swing.JViewport in project adempiere by adempiere.

the class CTable method configureColumnControl.

/**
     * Configures the upper trailing corner of an enclosing 
     * <code>JScrollPane</code>.
     * 
     * Adds/removes the <code>ColumnControl</code> depending on the 
     * <code>columnControlVisible</code> property.<p>
     * 
     * @see #setColumnControlVisible(boolean)
     * @see #setColumnControl(JComponent)
     */
protected void configureColumnControl() {
    Container p = getParent();
    if (p instanceof JViewport) {
        Container gp = p.getParent();
        if (gp instanceof JScrollPane) {
            JScrollPane scrollPane = (JScrollPane) gp;
            // Make certain we are the viewPort's view and not, for
            // example, the rowHeaderView of the scrollPane -
            // an implementor of fixed columns might do this.
            JViewport viewport = scrollPane.getViewport();
            if (viewport == null || viewport.getView() != this) {
                return;
            }
            if (isColumnControlVisible()) {
                verticalScrollPolicy = scrollPane.getVerticalScrollBarPolicy();
                scrollPane.setCorner(JScrollPane.UPPER_TRAILING_CORNER, getColumnControl());
                scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            } else {
                if (verticalScrollPolicy != 0) {
                    // Fix #155-swingx: reset only if we had force always before
                    // PENDING: JW - doesn't cope with dynamically changing the policy
                    // shouldn't be much of a problem because doesn't happen too often?? 
                    scrollPane.setVerticalScrollBarPolicy(verticalScrollPolicy);
                }
                try {
                    scrollPane.setCorner(JScrollPane.UPPER_TRAILING_CORNER, null);
                } catch (Exception ex) {
                // Ignore spurious exception thrown by JScrollPane. This
                // is a Swing bug!
                }
            }
        }
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) Container(java.awt.Container) JViewport(javax.swing.JViewport)

Example 28 with JViewport

use of javax.swing.JViewport in project adempiere by adempiere.

the class VDeleteEntity method preInit.

/**
	 * 	Pre Init
	 */
private void preInit() {
    refreshButton = ConfirmPanel.createRefreshButton(false);
    refreshButton.addActionListener(this);
    //	
    dryRun = new CCheckBox(Msg.getMsg(Env.getCtx(), "DryRun"), true);
    clientLabel = new CLabel(Msg.getElement(Env.getCtx(), "AD_Client_ID"));
    clientPick = new CComboBox(getClients());
    clientPick.setSelectedItem(null);
    clientPick.setMandatory(true);
    clientPick.setBackground(false);
    tableLabel = new CLabel(Msg.getElement(Env.getCtx(), "AD_Table_ID"));
    tablePick = new CComboBox(getTables());
    tablePick.setSelectedItem(null);
    tablePick.setMandatory(true);
    tablePick.setBackground(false);
    rootNode = new DefaultMutableTreeNode(null);
    tree = new CheckboxTree(rootNode);
    treePane = new JScrollPane(tree);
    JViewport viewPort = treePane.getViewport();
    viewPort.add(tree);
}
Also used : CLabel(org.compiere.swing.CLabel) JScrollPane(javax.swing.JScrollPane) CComboBox(org.compiere.swing.CComboBox) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CheckboxTree(it.cnr.imaa.essi.lablib.gui.checkboxtree.CheckboxTree) JViewport(javax.swing.JViewport) CCheckBox(org.compiere.swing.CCheckBox)

Example 29 with JViewport

use of javax.swing.JViewport in project beast-mcmc by beast-dev.

the class RowNumberTable method addNotify.

@Override
public void addNotify() {
    super.addNotify();
    Component c = getParent();
    if (c instanceof JViewport) {
        JViewport viewport = (JViewport) c;
        viewport.addChangeListener(this);
    }
}
Also used : JViewport(javax.swing.JViewport) Component(java.awt.Component)

Example 30 with JViewport

use of javax.swing.JViewport in project beast-mcmc by beast-dev.

the class RowNumberTable method stateChanged.

//
// Implement the ChangeListener
//
public void stateChanged(ChangeEvent e) {
    // Keep the scrolling of the row table in sync with main table
    JViewport viewport = (JViewport) e.getSource();
    JScrollPane scrollPane = (JScrollPane) viewport.getParent();
    scrollPane.getVerticalScrollBar().setValue(viewport.getViewPosition().y);
}
Also used : JScrollPane(javax.swing.JScrollPane) 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