I have a JTabbedPane with a Border Layout.
Here's the code I'm using to add the components:
add(columnNames, BorderLayout.NORTH);
add(scroll, BorderLayout.CENTER);
add(useCtrl, BorderLayout.SOUTH);
setVisible(true);
Question: Notice the excess whitespace to the right inside the JScrollPane. I don't want that there. I would like for the JScrollPane not to change size at all when changing the size of the JFrame. I have tried setSize() and setPreferredSize(), but the size of the JScrollPane always changes. I've tried using GridLayout, but I get the same result.
Place the JScrollPane
in a JPanel
with another layout. (e.g. BoxLayout
or GridBagLayout
). And add the JPanel
to the center.