Java How can I make a 2D star move in my JFrame using Java?

  • Thread starter Thread starter Nec
  • Start date Start date
  • Tags Tags
    Java Star
AI Thread Summary
To move a 2D star in a JFrame while properly erasing its previous position, two main techniques are suggested. First, before updating the star's position, repaint the area with the background color to effectively erase the old star. Second, implementing "double buffering" can help manage the rendering process, reducing flicker and improving the visual quality of the animation. These methods will ensure smooth movement of the star within the frame.
Nec
Messages
50
Reaction score
0
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 ?
Thanks
 
Technology news on Phys.org
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".
 
Ah.., I see it now, thanks for your suggestions ..lol..
(!ThumbsUp!)
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top