I am trying to make a bunch of buttons go into a JScrollPane
. However the scroll pane won't seem to fit all of the buttons. The scroller only goes just a bit bigger than the screen. You can see in this image.
There should be lots more buttons but the scroll pane just doesn't contain them.
Also, the scroll pane seems to lag and causes the java program to use lots of memory. Why is that?
Here is my code.
for (int i = 0; i < lst_Buttons.size(); i++){
pnl_Main.add(lst_IssuesButtons.get(i));
}
...
JScrollPane jsp_Main = new JScrollPane(pnl_Main);
jsp_Main.setPreferredSize(new Dimension(frm_Main.getWidth(), frm_Main.getHeight()));
jsp_Main.setSize(frm_Main.getWidth(), frm_Main.getHeight());
frm_Main.add(jsp_Main);
pnl_Main.setSize(frm_Main.getSize());
pnl_Main.setPreferredSize(frm_Main.getSize());
frm_Main.setPreferredSize(new Dimension(400, 600));
frm_Main.pack();
Thank you so much ahead of time. If you need more information just comment me.