Przewijany JPanel
Jak przewijać JPanel? Zaimplementowałem przewijalny interfejs jeszcze podczas dodawania go do panelu zawierającego
tabbedPane.add("Editor", new JScrollPane(storeyEditor = new MNScrollablePanel()));
nic nie działa
Kod:
public class MNScrollablePanel extends JPanel implements Scrollable {
public Dimension getPreferredScrollableViewportSize() {
return getPreferredSize();
}
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
return 10;
}
public boolean getScrollableTracksViewportHeight() {
return false;
}
public boolean getScrollableTracksViewportWidth() {
return false;
}
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
return 10;
}
}