Java Code Examples for javax.swing.plaf.metal.MetalScrollBarUI

The following examples show how to use javax.swing.plaf.metal.MetalScrollBarUI. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: netbeans   Source File: TreeTableView.java    License: Apache License 2.0 6 votes vote down vote up
/** Initialize full support for horizontal scrolling.
 */
private void initializeTreeScrollSupport() {
    scrollPane = new JScrollPane();
    scrollPane.setName("TreeTableView.scrollpane"); //NOI18N
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    scrollPane.setViewportBorder(BorderFactory.createEmptyBorder());

    if (UIManager.getColor("Table.background") != null) { // NOI18N
        scrollPane.getViewport().setBackground(UIManager.getColor("Table.background")); // NOI18N
    }

    hScrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
    hScrollBar.putClientProperty(MetalScrollBarUI.FREE_STANDING_PROP, Boolean.FALSE);
    hScrollBar.setVisible(false);

    listener = new ScrollListener();

    treeTable.addPropertyChangeListener(listener);
    scrollPane.getViewport().addComponentListener(listener);
    tree.addPropertyChangeListener(listener);
    hScrollBar.getModel().addChangeListener(listener);
}
 
Example 2
Source Project: consulo   Source File: BegScrollPaneUI.java    License: Apache License 2.0 6 votes vote down vote up
protected PropertyChangeListener createScrollBarSwapListener() {
  return new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent e) {
      String propertyName = e.getPropertyName();
      if (propertyName.equals(VERTICAL_SCROLL_BAR_PROPERTY) ||
          propertyName.equals(HORIZONTAL_SCROLL_BAR_PROPERTY)) {
        ((JScrollBar) e.getOldValue()).putClientProperty(MetalScrollBarUI.FREE_STANDING_PROP,
            null);
        ((JScrollBar) e.getNewValue()).putClientProperty(MetalScrollBarUI.FREE_STANDING_PROP,
            Boolean.FALSE);
      }
      else if (BORDER_PROPERTY.equals(propertyName)) {
        updateScrollbarsFreeStanding();
      }
    }
  };
}
 
Example 3
Source Project: consulo   Source File: BegScrollPaneUI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * If the border of the scrollpane is an instance of
 * <code>MetalBorders.ScrollPaneBorder</code>, the client property
 * <code>FREE_STANDING_PROP</code> of the scrollbars
 * is set to false, otherwise it is set to true.
 */
private void updateScrollbarsFreeStanding() {
  if (scrollpane == null) {
    return;
  }
  Object value = Boolean.FALSE;
  scrollpane.getHorizontalScrollBar().putClientProperty
      (MetalScrollBarUI.FREE_STANDING_PROP, value);
  scrollpane.getVerticalScrollBar().putClientProperty
      (MetalScrollBarUI.FREE_STANDING_PROP, value);
}