I have a JScrollPane
which has a JList
inside;
instructionsScrollPane = new JScrollPane(instructionList);
The JScrollPane
is itself in a JPanel
using BorderLayout
;
panel.add(instructionsScrollPane, BorderLayout.WEST);
Now, I am trying to stop the list/scrollpane going below a a certain minimum size when the window is resized, except JScrollPane
can't have minimum size set, and the list is inside the JScrollPane
which can't have a layoutManager
. So I am unable to set the minimum size of the JList
without a layoutManager
...
Now, I think I could have the JScrollPane/JList centered using BorderLayout
inside another JPanel
(which I would then set a minimum size of) inside this the current panel
... but that seems messy. Does anyone know of a better way to size ScrollPanes?
I know there is probably a solution using a different layoutManager
, but I am already committed to using BorderLayout
at this point.
Now, I could have the JScrollPane centered using BorderLayout inside another JPanel (which I would set a minimum size of) inside this the current panel... but that seems messy. Does anyone know of a better way to size ScrollPanes?
for JList is very easy, simple to set initial coordinates, returns expected Dimension for LayoutManager, there are two methods implemented in API
and/or if really needed to restrict 2nd dimension