Disable Border Of JScrollPane In Java
Posted by admin on
October 2, 2009
I thought disabling the borders of a Java Swing container would work by setting the method setBorder() to null. It does not. I happened to experience this problem after adding a JTable onto it. The only way to do this would be to create a Border object using the BorderFactory class and supplying values of zero in the createEmptyBorder() method. Check the code below.
Border border = BorderFactory.createEmptyBorder(0, 0, 0, 0); jScrollPane2.setBorder(border);
That should do it. Now your JScrollPane (or any other Swing container) will not show any more borders.







