Swing JLabel dynamically change
1 posts in topic
Flat View  Flat View

Posted By:   Anonymous
Posted On:   Wednesday, October 3, 2001 09:50 AM

how can i change the JLabe Variable name dinamically?
ihave 3 Jlabel(jlabel1,Jlabel2,jlabel3)
within for loop i want's to get the variable name of that JLablel, so i can set the value in

Re: Swing JLabel dynamically change

Posted By:   Scott_Stanchfield  
Posted On:   Saturday, October 6, 2001 06:07 AM

Use an array of JLabels:

String[] labelText = {"First","Second","Third"};
JLabel[] labels = new JLabel[labelText.length];
for(int i=0; i labels[i] = new JLabel(labelText[i]);
About | Sitemap | Contact