|
Oct 01
|
The JViewport of the JScrollPane provides a method to return the location of top left point showing in the scroll pane.
JViewport viewport = myScrollPane.getViewport(); Point scrolledTo = viewport.getViewPosition();
|
|
The JViewport of the JScrollPane provides a method to return the location of top left point showing in the scroll pane. JViewport viewport = myScrollPane.getViewport(); Point scrolledTo = viewport.getViewPosition();
You can achieve this by setting the scroll bar policy on both the verical and horizontal scroll bars. ScrollPane scrollPane = new JScrollPane(panel); // Force the scrollbars to always be displayed scrollPane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
|
Recent Comments