Simply Adding 200 buttons to a jframe fails.
Hi every one..
the aim of this code is simply to open a new frame and add 200 buttons to a scrollable pane in it.. it has no compile error. But sometimes the frame appears blank. Does swing not able to add 200 buttons? (some time 2000 buttons etc. may be needed in a frame)
or there is a methodic error..Thanx !!
JFrame fr=new JFrame("new window");
fr.setSize(1024,738);
fr.setLocation(0,0);
fr.setLayout(null);
fr.setVisible(true);
Container f_con= fr.getContentPane();
f_con.setLayout(null);
JPanel list =new JPanel();//> 200 buttons will be in this panel
list.setLayout(null);
list.setSize(1015,650);
for(int i=0;i<200;i++){//> buttons attached to the list Panel
JButton newbut=new JButton("butyon>"+i);
newbut.setSize(99,29);
newbut.setLocation(1,i*50);
list.add(newbut);
list.setPreferredSize(new java.awt.Dimension(997,i*50));
}
JScrollPane mainpanel=new JScrollPane(list);//>scrollable panel that //contains list panel..
mainpanel.setSize(1015,650);
mainpanel.setLocation(5,50);
f_con.add(mainpanel);//add the main panel to the frame container pane

