-
Bug
-
Resolution: Fixed
-
P4
-
7
-
b13
-
generic
-
generic
The issue came up in Sun's developer forum:
http://forums.sun.com/thread.jspa?threadID=5420234&tstart=0
below is a runnable example
To reproduce
- click into the list
- press page-down to verify scrolling by keyboard
- move the mousewheel: nothing happens - expected behaviour: scroll
the reason this happens is that the mouseWheelListener in BasicScrollPaneUI simply backs out if there is no scrollbar. Should take over instead, just as the scroll actions do always.
import javax.swing.*;
public class ScrollPaneActions extends JFrame {
public static void main(String[] args) {
ScrollPaneActions test = new ScrollPaneActions();
try {
test.interactiveScrollable();
} catch (Exception e) {
e.printStackTrace();
}
test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
test.pack();
test.setVisible(true);
}
public void interactiveScrollable() {
JList list = new JList(createListModel());
// disable list bindings
list.getInputMap().getParent().clear();
JScrollPane scrollPane = new JScrollPane(list);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
add(scrollPane);
}
private static ListModel createListModel() {
DefaultListModel model = new DefaultListModel();
for (int i = 0; i < 100; i++) {
model.addElement("element " + i);
}
return model;
}
}
http://forums.sun.com/thread.jspa?threadID=5420234&tstart=0
below is a runnable example
To reproduce
- click into the list
- press page-down to verify scrolling by keyboard
- move the mousewheel: nothing happens - expected behaviour: scroll
the reason this happens is that the mouseWheelListener in BasicScrollPaneUI simply backs out if there is no scrollbar. Should take over instead, just as the scroll actions do always.
import javax.swing.*;
public class ScrollPaneActions extends JFrame {
public static void main(String[] args) {
ScrollPaneActions test = new ScrollPaneActions();
try {
test.interactiveScrollable();
} catch (Exception e) {
e.printStackTrace();
}
test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
test.pack();
test.setVisible(true);
}
public void interactiveScrollable() {
JList list = new JList(createListModel());
// disable list bindings
list.getInputMap().getParent().clear();
JScrollPane scrollPane = new JScrollPane(list);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
add(scrollPane);
}
private static ListModel createListModel() {
DefaultListModel model = new DefaultListModel();
for (int i = 0; i < 100; i++) {
model.addElement("element " + i);
}
return model;
}
}