Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating animation using SWING?

Status
Not open for further replies.

Jroyal

Programmer
Oct 24, 2006
9
0
0
GB
Code:
      for (int x=0; x<2000; x++)
      {
    datafield1.setLocation(luckyjbox.getX()+x, luckyjbox.getY());
    datafield1.updateUI();
  
      }

I want it to animate, so that the jtextfield moves from one position to the next one pixel at a time.

why isnt it working?
 
Who knows ...

What's luckybox? What do you mean by "it's not working"?

Cheers,
Dian
 
jluckybox is just a ordenary Jtextfield.

datafield1 is a jtextfield,

datafield1.setLocation( param, param );

sets the location of the datafield1 to the specified X and Y cordinates.

now all i want to do is add one each time to say X and see the jtextfield move..
 
shouldn't you update the container instead of the jtextfield?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top