Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Java and my moving star

  1. Jun 17, 2004 #1


    User Avatar

    In my JFrame, I already draw a 2d star, i would like to make it move around in my frame, but i don't know how to erase the old star when it appears in a new position, can anyone here help me with this ?
  2. jcsd
  3. Jun 17, 2004 #2


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Although I haven't done much Java programming recently, I think one of the following suggestions could be used.

    1. Before updating the position of the star, you could first paint it the background color.

    2. Alternatively, you could implement "double buffering".
  4. Jun 17, 2004 #3


    User Avatar

    Ah.., I see it now, thanks for your suggestions ..lol..
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook