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; } }
/** * Maps {@code JScrollPane.getUI()} through queue */ public ScrollPaneUI getUI() { return (runMapping(new MapAction<ScrollPaneUI>("getUI") { @Override public ScrollPaneUI map() { return ((JScrollPane) getSource()).getUI(); } })); }
/** * 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); } }); }
/** * Sets the UI. * * @param ui the scroll pane UI to associate with this PScollPane */ public void setUI(final ScrollPaneUI ui) { super.setUI(ui); if (!disableKeyActions) { installCustomKeyActions(); } else { disableKeyActions(); } }
public void testGetSetUpdateUI() throws Exception { assertNotNull(pane.getUI()); ScrollPaneUI ui = new BasicScrollPaneUI(); pane.setUI(ui); assertEquals(ui, pane.getUI()); pane.updateUI(); assertNotSame(ui, pane.getUI()); }
@Override public void setUI(ScrollPaneUI ui) { super.setUI(ui); updateViewportBorder(); if (ui instanceof BasicScrollPaneUI) { try { Field field = BasicScrollPaneUI.class.getDeclaredField("mouseScrollListener"); field.setAccessible(true); Object value = field.get(ui); if (value instanceof MouseWheelListener) { MouseWheelListener oldListener = (MouseWheelListener)value; MouseWheelListener newListener = event -> { if (isScrollEvent(event)) { Object source = event.getSource(); if (source instanceof JScrollPane) { JScrollPane pane = (JScrollPane)source; if (pane.isWheelScrollingEnabled()) { JScrollBar bar = event.isShiftDown() ? pane.getHorizontalScrollBar() : pane.getVerticalScrollBar(); if (bar != null && bar.isVisible()) oldListener.mouseWheelMoved(event); } } } }; field.set(ui, newListener); // replace listener if field updated successfully removeMouseWheelListener(oldListener); addMouseWheelListener(newListener); } } catch (Exception exception) { LOG.warn(exception); } } }
public ScrollPaneUI getUI() { AndroidClassUtil.callEmptyMethod(); return null; }
public void setUI(ScrollPaneUI ui) { AndroidClassUtil.callEmptyMethod(); super.setUI(ui); }
public void updateUI() { setUI((ScrollPaneUI) UIManager.getUI(this)); }
@Override public void setUI(ScrollPaneUI ui) { super.setUI(ui); updateViewportBorder(); }
public ScrollPaneUI getUI() { return (ScrollPaneUI)ui; }
public void setUI(final ScrollPaneUI ui) { super.setUI(ui); }
public void updateUI() { setUI((ScrollPaneUI)UIManager.getUI(this)); }
public void setUI(ScrollPaneUI ui) { super.setUI(ui); updateViewportBorder(); }
@Override public void setUI(ScrollPaneUI ui) { super.setUI(ui); // disable standard Swing keybindings setInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null); }
/** * This method returns the scrollpane's UI delegate. * * @return The scrollpane's UI delegate. */ public ScrollPaneUI getUI() { return (ScrollPaneUI) ui; }
/** * This method sets the scrollpane's UI delegate. * * @param ui The scrollpane's UI delegate. */ public void setUI(ScrollPaneUI ui) { super.setUI(ui); }