Reputation: 4485
I've tried adding a border to a JScrollPane using the setBorder()
method, but it didn't work. How can I add a border to a JScrollPane?
Upvotes: 0
Views: 987
Reputation: 113
According to the JScrollPane documentation, you can use setViewportBorder to add a border around the main viewport.
scrollpane.setViewportBorder(BorderFactory.createLineBorder(Color.black));
Or you could add a border around the whole scroll pane using setBorder as outlined in this Oracle tutorial:
pane.setBorder(BorderFactory.createLineBorder(Color.black));
Upvotes: 1