Java Code Examples for javax.swing.plaf.ScrollPaneUI

The following examples show how to use javax.swing.plaf.ScrollPaneUI. 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: DocumentViewOp.java    License: Apache License 2.0 5 votes vote down vote up
private void updateListeners() {
    ScrollPaneUI ui = scrollPane.getUI();
    if (ui != lastUI) {
        // Update "ui" property listener
        if (ui != null) {
            // Check mouse wheel listeners on scroll pane.
            // Pair first non-MWDelegator listener with 
            // Remove any other delegators than this one.
            MouseWheelListener[] mwls = scrollPane.getListeners(MouseWheelListener.class);
            if (LOG.isLoggable(Level.FINE)) {
                LOG.log(Level.FINE, "MouseWheelDelegator.updateListeners(): scrollPane change scrollPane={0}, MouseWheelListeners:{1}\n",
                        new Object[]{obj2String(scrollPane), Arrays.asList(mwls)});
            }
            delegateListener = null;
            for (MouseWheelListener listener : mwls) {
                if (listener instanceof MouseWheelDelegator) {
                    scrollPane.removeMouseWheelListener(listener);
                    if (delegateListener == null) {
                        delegateListener = ((MouseWheelDelegator) listener).delegateListener;
                        scrollPane.addMouseWheelListener(this);
                    }
                } else { // Regular listener 
                    // Current patch only assumes one MW listener attached by the UI impl.
                    if (delegateListener == null) {
                        delegateListener = listener;
                        scrollPane.removeMouseWheelListener(listener);
                        scrollPane.addMouseWheelListener(this);
                    }
                }
            }
        }
        lastUI = ui;
    }
}
 
Example 2
/**
 * Maps {@code JScrollPane.getUI()} through queue
 */
public ScrollPaneUI getUI() {
    return (runMapping(new MapAction<ScrollPaneUI>("getUI") {
        @Override
        public ScrollPaneUI map() {
            return ((JScrollPane) getSource()).getUI();
        }
    }));
}
 
Example 3
/**
 * Maps {@code JScrollPane.setUI(ScrollPaneUI)} through queue
 */
public void setUI(final ScrollPaneUI scrollPaneUI) {
    runMapping(new MapVoidAction("setUI") {
        @Override
        public void map() {
            ((JScrollPane) getSource()).setUI(scrollPaneUI);
        }
    });
}
 
Example 4
Source Project: consulo   Source File: JBScrollPane.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setUI(ScrollPaneUI ui) {
  super.setUI(ui);
  updateViewportBorder();
}
 
Example 5
Source Project: consulo   Source File: DesktopEditorImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setUI(ScrollPaneUI ui) {
  super.setUI(ui);
  // disable standard Swing keybindings
  setInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null);
}