[ACCEPTED]-Make a Java JScrollpane only scroll vertically-jscrollpane
Accepted answer
Try this:
public class AddScrollBarToJFrame {
public static void main(String[] args) {
JPanel panel = new JPanel();
JScrollPane scrollBar = new JScrollPane(panel,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
JFrame frame = new JFrame("AddScrollBarToJFrame");
frame.add(scrollBar);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 400);
frame.setVisible(true);
}
}
Also, you can have a look at How to use a ScrollBar in both vertical and horizontal direction.
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.