public void run() {
{
File f=new File("d:\\MusicFile.txt");
int counter=0;
LinkedList<musicdata> list=new LinkedList<musicdata>();
try
{
BufferedReader br=new BufferedReader(new FileReader(f));
String str=br.readLine();
while(str!=null)
{
String[] arr=str.split(",");
list.add(new musicdata(arr[0], arr[1], arr[2], arr[3]));
str=br.readLine();
}
Iterator<musicdata> itr=list.iterator();
while(itr.hasNext())
{
musicdata md=itr.next();
if(md.genre.equals("Pop"))
{
JFrame f1=new JFrame("My Frame");
JPanel frame=new JPanel();
f1.setVisible(false);
f1.add(frame);
JCheckBox chk=new JCheckBox(md.singername+" "+md.albumname+" "+md.genre+" "+md.price);
f1.setLayout(new FlowLayout());
f1.add(chk);
f1.setBounds(100,100,200,200);
f1.setVisible(true);
}
}
}catch(IOException ioe)
{
System.out.println("File Not Foound");
}
}
new HomeForm().setVisible(true);
}
ajdh,gadga,Pop,240
asdfj,gjhjh,Pop,320
vysy,ahn,Pop,410
this is the text file context i am reading. i need to create the check boxes for each of three items in panel "JPanel5" in my main jframe form. but as u can see it is opening 3 different frame containing 1 list item in each of it. i need all 3 list item as check boxes in my main form's JPanel5 panel box.