• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Change jLabel properties in loop

 
Thomas Feld
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm new here, so I'm not sure where to post this...

Basically I have a bunch of jlabels, who's properties I want to change in a loop.
Is there a simple way to iterate through the jlabels and set properties in the loop?
 
Campbell Ritchie
Sheriff
Posts: 48381
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would have to put them into an array or Collection to iterate them in a loop.

And welcome to JavaRanch
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thomas,
We have a forum dedicated for Swing. I will move this thread there for you.
 
Thomas Feld
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I know i have to put them in an array, though I'm not sure how to call them from there. What datatype would the array have to be?

I'm not sure that you could use a string:

I would like to do the following:
 
Rob Spoor
Sheriff
Pie
Posts: 20493
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then change the array type:
 
Thomas Feld
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot!
Thats axactly what I needed
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic