scrollPane = new JScrollPane(table); panel1.add( scrollPane,BorderLayout.CENTER );
Is there a way I can make the scrollPane bigger (wider) ?
scrollPane = new JScrollPane(table); panel1.add( scrollPane,BorderLayout.CENTER );
Is there a way I can make the scrollPane bigger (wider) ?
JScrollPane scrollPane = new JScrollPane(table,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
JScrollBar bar = scrollPane.getVerticalScrollBar();
bar.setPreferredSize(new Dimension(40, 0));
This works. I figured it out.
When using Border Layout you don't control the size of the somponents in it Consider using GridBag Layout.
The JScrollPane
is as big as the element it holds. You should make those element(s) wider.
Also, there is the setSize()
-method. But you'll most likely want to use the setPreferredSize()
-method as mentioned by mre.