java graphic problem

From: peterx (aaabbse_at_yahoo.se)
Date: 11/27/04


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]



Relevant Pages

  • Re: How to draw to the screen not the form?
    ... this on Vista with Aero enabled, dragging those rectangles around ... on XP (or Vista with the standard, ... draw my rectangles on the overlay. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Draw Rectangle directly to client (ie - without bitmap?)
    ... Perhaps you should draw your rectangles to an image in memory and then ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Unusable outer edge of Tkinter canvases?
    ... > When drawing rectangles in Tkinter canvases I've noticed the outer edges ... > don't always draw. ... inner border. ... to the widget (this fixes the coordinate system), ...
    (comp.lang.python)
  • Re: Test leaking to earth
    ... assistance to start the car. ... The AA man tested the battery and said it ... electronic components draw power all the time, ...
    (alt.autos.toyota)
  • Re: Weird problem - No amp output at higher volumes
    ... > draw is over what your car is providing to the amp, then it will cut, ... A fuse will only blow when the draw is ... then it's time for a new battery. ... believe he said the amp still stays on; ...
    (rec.audio.car)