i am not able to set the dynamically created JPanel size by using setPreferredSize function. Is there any other method ?
main_panel.removeAll();
main_panel.revalidate();
main_panel.repaint();
panel = new JPanel[100];
Login.session = Login.sessionfactory.openSession();
Login.session.beginTransaction();
String select_n_p_4 = "select a.triage_id from PC_TRIAGE_MASTER_POJO a";
org.hibernate.Query query1 = Login.session.createQuery(select_n_p_4);
List l3 = query1.list();
Iterator it3 = l3.iterator();
while (it3.hasNext()) {
Object a4 = (Object) it3.next();
int f = (int) a4;
main_panel.setLayout(new GridLayout(0, 1, 1, 10));
panel[ind] = new JPanel();
panel[ind].setPreferredSize(new Dimension(10, 10));
panel[ind].setBorder(triage_boder);
count++;
main_panel.add(panel[ind]);
main_panel.revalidate();
main_panel.repaint();
ind++;
}