Search:

Type: Posts; User: Norm

Search: Search took 0.10 seconds.

  1. Replies
    21
    Views
    2,486

    Re: Help with KeyListener and graphics

    I think there are several math problems.
  2. Replies
    21
    Views
    2,486

    Re: Help with KeyListener and graphics

    I don't see ANY debugging printlns in your code. You need to add some to show what is happening.
    Add them at all the places decisions are made and values are changed that effect the problem you are...
  3. Replies
    21
    Views
    2,486

    Re: Help with KeyListener and graphics

    You need to do some debugging to see what the code is doing. Add some printlns to show the execution flow and the values of variables as they change.
  4. Replies
    21
    Views
    2,486

    Re: Help with KeyListener and graphics

    Where? I don't see where it is called from anywhere except the paint method.
  5. Replies
    21
    Views
    2,486

    Re: Help with KeyListener and graphics

    Several problems I see:
    Passing a graphics with a setter method vs only to the draw methods.
    Starting a new thread every time paint is called.

    The paint method should be short and simple:

    ...
  6. Replies
    21
    Views
    2,486

    Re: Help with KeyListener and graphics

    You still have some code in the paint() method that should be in the constructor. adding key listeners.
    The Graphics object should be passed to the drawing methods directly, not via a setter.
    ...
  7. Replies
    21
    Views
    2,486

    Re: Help with KeyListener and graphics

    One comment so far, you should pass the Graphics object that the paint method receives to the drawing method each time the paint method is called. Don't save an old version and reuse it.
    Don't...
  8. Replies
    21
    Views
    2,486

    Re: Help with KeyListener and graphics

    Please post your code here in the thread. Be sure to wrap it in code tags. See: BB Code List - Java Programming Forums or press Go Advanced and use the # icon
Results 1 to 8 of 8