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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drawing a cube and moving it

Status
Not open for further replies.

yelimeli

Programmer
Jun 6, 2000
10
US
Hey

I'm trying to write a code that draws a cube and then when i click a button nmaed left the cube should move left and when i click a button named right it should move right. I have used drawline and drawsquare to draw cube and then to move i can use repaint() method to modify the x & y points but there are so many points, can anybody please give me any idea

Thanks
Srinivas
 
Dear Srinivas,

Draw the cube into a memory Image object then each time it moves you paint a rectangle in the background color over the old location then paint the image in the new location.


Good luck
-pete
 
Another idea is to draw the cube on a Panel (or a JLabel, or something else) and then just move the Panel with

panel.setLocation(...);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top