Reputation: 5623
I have JTable
in JScrollPane
.
JTable table = new JTable(data, columnNames);
JScrollPane scroll = new JScrollPane();
scroll.setViewportView(table);
everything is well, but If I need to be more space between Scrollpanel and table? how can I do that? for example: in HTML/CSS
if we use <div>
tag, we have "padding" method. I need something like that.
Upvotes: 3
Views: 1982
Reputation: 5623
another solution is
setBorder(BorderFactory.createCompoundBorder(new EmptyBorder(10, 10, 10, 10), new EtchedBorder()));
it does not deletes black lines around the component too, which is inside the ScrollPanel.
Upvotes: 4
Reputation: 159874
You could do
scroll.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
Upvotes: 5