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

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -