开发者

How do I create a "jumping" circle in Java GUI? [closed]

开发者 https://www.devze.com 2022-12-23 21:21 出处:网络
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this
Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 3 years ago.

Improve this question

I would like to have a red filled circle at some place in my window. After the click on the circle, the circle should jump from the original place to a new one (disappear from the old place and appear on the new one). What would be the best way to do it?

I also would like to know how to draw a filled circle in Java. Are there any simple tools to do it? Or may be the easiest way is to use an image created by some other software?

ADDED:

For the beginning I would like to have just a redraw (a circle disappear and at "the same moment" it appears on the new position). I think it will be simple that some visual effects and I would like to start from the simples possible ch开发者_JAVA技巧oice.


This can be done using Swing, Graphics2D and a custom JPanel. The tutorial contains a similar example:

http://java.sun.com/docs/books/tutorial/uiswing/painting/step3.html

0

精彩评论

暂无评论...
验证码 换一张
取 消