My question is straight. I have made a simple app in neatbeans in which when I click a button the x coordinates of the text say a '@' keeps changing by 20. heres the code:-
int x;
private void wActionPerformed(java.awt.event.ActionEvent evt)
{
x=x+20;
q.setLocation(x, 0);
}
this code simply moves the jlabel ( q ) to the right by 20 coordinates each time i click the jbutton ( w ). now what i want is that when i click the button only ONCE then the position of the JLabel should keep increasing its x coordinate by 20 untill it has reached a specific x coordinate say 200. i tried using for loops :-
private void wActionPerformed(java.awt.event.ActionEvent evt)
{
for(x=0;x<201;x=x+20)
{
q.setlocation(x,0);
}
}
but with this when I click the button, the jlabel directly moves to 200 x coordinate without stopping after every 20 coordinates...please help.. Regards, Slinger