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);
}
}
}
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!
}
}
}
}
}
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);
}
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);
}
}
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);
}
Aggregations