java graphic problem
From: peterx (aaabbse_at_yahoo.se)
Date: 11/27/04
- Next message: Andrew Thompson: "Re: java graphic problem"
- Previous message: Andrew Thompson: "Re: showOpenDialog Question"
- Next in thread: Andrew Thompson: "Re: java graphic problem"
- Reply: Andrew Thompson: "Re: java graphic problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 27 Nov 2004 09:58:05 -0500
Hi!
I try to draw a car.The car is build of two rectangles (car and cars
roof)By help of this program my car must move (to right direction).My
program is not working because when the both rectangles move in the same
time.First moves the Car rectangle and then moves the roof rectangle.
Both rectangles do not move in the same time.How can I solve this
problem.
--------------------------------
[code]
public void paint(Graphics g)
{
for(int i=1; i<=1000; i++)
{
// Car
g.setColor(Color.red);
g.drawRect(45+i, 243, 20, 13);
g.fillRect(45+i, 243, 20, 13);
Input.delay(150);
g.setColor(Color.black);
g.clearRect(45+i, 243, 20, 14);
g.fillRect (45+i, 243, 20, 14);
//Cars roof
g.setColor(Color.red);
g.drawRect(49+i, 235, 10, 15);
g.fillRect(49+i, 235, 10, 15);
Input.delay(150);
g.setColor(Color.black);
g.clearRect(49+i, 235, 10, 16);
g.fillRect (49+i, 235, 10, 16);
}
}
[/code]
- Next message: Andrew Thompson: "Re: java graphic problem"
- Previous message: Andrew Thompson: "Re: showOpenDialog Question"
- Next in thread: Andrew Thompson: "Re: java graphic problem"
- Reply: Andrew Thompson: "Re: java graphic problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|