/** 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); }
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(); } } }; }
/** Initialize full support for horizontal scrolling. */ private void initializeTreeScrollSupport() { scrollPane = new JScrollPane() { public void setBorder(Border b) { super.setBorder(null); } }; scrollPane.getViewport().setBackground(UIManager.getColor("Table.background")); // NOI18N hScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); hScrollBar.putClientProperty(MetalScrollBarUI.FREE_STANDING_PROP, Boolean.FALSE); listener = new ScrollListener(); treeTable.addPropertyChangeListener(listener); scrollPane.getViewport().addComponentListener(listener); tree.addPropertyChangeListener(listener); hScrollBar.getModel().addChangeListener(listener); }
/** * 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); }
/** * Configures the JScrollPane created by #createScroller(). */ @Override protected void configureScroller() { super.configureScroller(); scroller.getVerticalScrollBar().putClientProperty( MetalScrollBarUI.FREE_STANDING_PROP, Boolean.FALSE); }