JScrollPane and JPanel
Posted on 2004-09-14
I got this problem...I try to put some small JPanel into a bigger JPanel, and put the bigger one into a JScrollPane in case if the bigger one cannot show all components inside...but now I cannot see all the components which are inside of the bigger JPanel...and no scroll bar displayed...Please help me to exam my codes...
JPanel basicPanel = new JPanel();
JPanel comPanel = new JPanel;
JScrollPane scPanel = new JScrollPane(basicPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
for (int i = 0; i < 6; i++)
JLabel tmpLabel = new JLabel("Panel " + String.valueOf(i));
comPanel[i] = new JPanel();
comPanel[i].setBounds(0, i*100, 300, 100);
so what should I do???