GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes Change jLabel properties in loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Change jLabel properties in loop" Watch "Change jLabel properties in loop" New topic
Author

Change jLabel properties in loop

Thomas Feld
Greenhorn

Joined: Sep 08, 2009
Posts: 3
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

Joined: Oct 13, 2005
Posts: 39044
    
  23
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

Joined: Jul 26, 2007
Posts: 10425
    
    8

Thomas,
We have a forum dedicated for Swing. I will move this thread there for you.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Thomas Feld
Greenhorn

Joined: Sep 08, 2009
Posts: 3
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

Joined: Oct 27, 2005
Posts: 19697
    
  20

Then change the array type:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Thomas Feld
Greenhorn

Joined: Sep 08, 2009
Posts: 3
Thanks a lot!
Thats axactly what I needed
 
GeeCON Prague 2014
 
subject: Change jLabel properties in loop