java - Updating jLabel based on jSpinner -


right have jframe spinner has numbers. storing value of spinner this

    int value = (integer) jspinner1.getvalue(); 

and outputting jlabel this

    jlabel5.settext("counter = " + value ); 

i wondering if there way update jlabel every time number changed on spinner?

add changelistener , set label there.

jlabel l = ...; jspinner spinner = ...; spinner.addchangelistener(new changelistener() {   public void statechanged(changeevent e) {     l.settext("counter = " + spinner.getvalue());   } } 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -