Java Code Examples for javax.swing.JScrollPane#dispatchEvent()
The following examples show how to use
javax.swing.JScrollPane#dispatchEvent() .
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 File: GuiUtil.java From CQL with GNU Affero General Public License v3.0 | 6 votes |
public void mouseWheelMoved(MouseWheelEvent e) { JScrollPane parent = getParentScrollPane(); if (parent != null) { /* * Only dispatch if we have reached top/bottom on previous scroll */ if (e.getWheelRotation() < 0) { if (bar.getValue() == 0 && previousValue == 0) { parent.dispatchEvent(cloneEvent(e)); } } else { if (bar.getValue() == getMax() && previousValue == getMax()) { parent.dispatchEvent(cloneEvent(e)); } } previousValue = bar.getValue(); } /* * If parent scrollpane doesn't exist, remove this as a listener. We have to * defer this till now (vs doing it in constructor) because in the constructor * this item has no parent yet. */ else { PDControlScrollPane.this.removeMouseWheelListener(this); } }
Example 2
Source File: CustomScrollPane.java From PacketProxy with Apache License 2.0 | 6 votes |
public void mouseWheelMoved(MouseWheelEvent e) { JScrollPane parent = getParentScrollPane(); if (parent != null) { if (e.getWheelRotation() < 0) { if (bar.getValue() == 0 && previousValue == 0) { parent.dispatchEvent(cloneEvent(e)); } } else { if (bar.getValue() == getMax() && previousValue == getMax()) { parent.dispatchEvent(cloneEvent(e)); } } previousValue = bar.getValue(); } else { CustomScrollPane.this.removeMouseWheelListener(this); } }
Example 3
Source File: UIUtils.java From netbeans with Apache License 2.0 | 6 votes |
public static void issue163946Hack(final JScrollPane scrollPane) { MouseWheelListener listener = new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { if (scrollPane.getVerticalScrollBar().isShowing()) { if (e.getSource() != scrollPane) { e.setSource(scrollPane); scrollPane.dispatchEvent(e); } } else { scrollPane.getParent().dispatchEvent(e); } } }; scrollPane.addMouseWheelListener(listener); scrollPane.getViewport().getView().addMouseWheelListener(listener); }