How to set JScrollPane Layout to be the same as JTable?
java, jscrollpane, jtable, swing
Solution
- `how i can make scrollpane layout the same of table??`
if your `JTable` contains only a few rows
table.setPreferredScrollableViewportSize(table.getPreferredSize());
- `Tabel1.setModel(new DefaultTableModel(x,y));`
use Java Naming Conventions correctly, then not `Tabel1` but `tabel1`
Problem
``` Tabel1.setModel(new DefaultTableModel(x,y)); JScrollPane pane = new JScrollPane(Tabel1); ``` When I run the program the scrollpane appears bigger than the table. How can I make the scrollpane layout the same as the table?