java - Make a bunch of JLabel 's' invisible -
i have 8 jlabels
want invisible . jlabels
start 25 , go 32. _(i.e jlabel25 ---> jlabel32)_
instead of making them invisible 1 one thinking of using loop make them invisible following these lines of code :
for( int = 25 ; <= 32 ; i++ ) { jlabel(i).setvisible(false); }
but obvious error says "cannot find symbol , method--> jlabel(int) "
what should avoid writing 8 statements asking make each label
invisible ?
put labels common collection, , iterate through that.
collection<jlabel> mylabels = new arraylist<jlabel>(); mylabels.add(jlabel25); // .. , on (jlabel label : mylabels) { label.setvisible(false); }
Comments
Post a Comment