Search:

Type: Posts; User: Norm

Search: Search took 0.12 seconds.

  1. Replies
    19
    Views
    5,114

    Re: How to animate a circle changing color

    You shouldn't call repaint() from inside the painting method.

    Applets are web based.

    An inner class is useful for listeners.
  2. Replies
    19
    Views
    5,114

    Re: How to animate a circle changing color

    Moving the code to another method and calling that method from the paintComponent() method changes NOTHING. The code is still WRONG.

    The code in a method can set the value of a variable to tell...
  3. Replies
    19
    Views
    5,114

    Re: How to animate a circle changing color

    The posted code does not compile without errors. Please fix the errors and repost.

    Moving the code to another method and calling that method from the paintComponent() method changes NOTHING. The...
  4. Replies
    19
    Views
    5,114

    Re: How to animate a circle changing color

    No it doesn't. The code in a method can set the value of a variable to tell the paintComponent() method what to do.
    When paintComponent() method executes, it can look at the variable's values to...
  5. Replies
    19
    Views
    5,114

    Re: How to animate a circle changing color

    Another problem I see i that the paintComponent() method ALWAYS sets the color to yellow.
    The call to setColor() should either be conditional: first yellow then toggle between the other two colors...
  6. Replies
    19
    Views
    5,114

    Re: How to animate a circle changing color

    Can you post a small, complete program that compiles, executes and shows the problem. All these pieces of code are confusing.


    The Timer should not be created and started from inside the...
  7. Replies
    19
    Views
    5,114

    Re: How to animate a circle changing color

    Yes, much better. An array of colors and modulus to pick one.
  8. Replies
    19
    Views
    5,114

    Re: How to animate a circle changing color

    Use a couple of binary variables: firstTime and doGreen and some if statements to catch the firstTime for the yellow and then toggle the doGreen to control green and blue.
Results 1 to 8 of 8