I have been searching around for an easy way to implement a JScrollPlane
. I am trying to add it to a JPanel
, and it will contain a dynamic number of JPanel
s (which will be filled with other stuff).
Here is my (failing miserably) attempt to make said JScrollPane
:
final JPanel info = new JPanel();
final JScrollPane infoS = new JScrollPane(info,ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
info.setLayout(new GridLayout(0,1));
info.setLocation(10,78);
info.setSize(420,490);
infoS.setPreferredSize(new Dimension(600, 600));
gui.add(infoS);