How to add Interactive animations in jFrame? [closed] - java

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 1 year ago.
Improve this question
I need to develop a Java programe using NetBeans. And In a JFrame I need to add a a image of planetary system and when the user sets a date and a time, Planets should rotate to their relevant positions. I don't have any idea about this yet. What is the possible way to do this? Please tell me soon

There are literally dozens of ways this might be achieved.
You could use:
Swing Timer
The Timing Framework
Trident
java-universal-tween-engine
The last three are animation engines. Personally, I use the Timing Framework, but that's more to do with what I'm familiar with and my needs at the time.
You'll probably need to do a lot of custom painting to get this to work, take a look at:
Custom Painting
2D Graphics
For more details

Related

How can I create a clickable grid in java? [closed]

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 6 years ago.
Improve this question
I'm creating Conway's game of life in java, and I want to make a clickable on screen grid to toggle the cells on/off before pressing start. What is the best way to do this? A grid of JButtons won't do it for me as it looks horrible (unless theres a way of changing how they look?)
any help is greatly appreciated - thanks!
I would use raw graphics 2D draw commands to manually draw rectangles in AWT for Conway's Game of Life. You can still listen to click events for the frame and then use the x and y coordinates to calculate the cell. It will be a lot faster than using UI components, as well.

Move images on JPanel in Java [closed]

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 7 years ago.
Improve this question
I'm trying to place some images on a JPanel and make them "relocatable" so I can click on one of the images and move to somewhere else on the JPanel while holding the button. It works fine with one image but I just can't come up with a solution for more images than one. I have checked many examples and tried many different ways. If you have any idea please share with me. Thanks!
It works fine with one image but I just can't come up with a solution for more images than one.
You can use the Component Mover. You register the component with the class and then you can move any component.
Or if you don't need the full features of the ComponentMover class you can just use the basic listener for dragging a component.

Better way to paint a JComponent in java swing [closed]

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 8 years ago.
Improve this question
We can paint the background of a Jcomponent in swing and can also place background image. I want to know which is the better way to minimize the memory usage? Can anyone help?
In case you are repainting the area again and again ,then its always better to only repaint the required portion instead of painting entire region.
Filthy Rich Clients by RomainGuy and Chet Hasse is an excellent learning source for swing painting techniques

Swing drag and drop [closed]

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 8 years ago.
Improve this question
I would like to implement a game board in swing (needs to be a table, though about either jtable or gridlayout etc ...) where I will be able to drag and drop a picture on to this game board and all the cells that the picture fell on will get a notification that they were chosen.
Can anyone help with that? how do I get a couple of cells in a table know that an object was dropped on them?
Have a look at this tutorial.
I think you have to spent some time with Google. I found the following with a little time with Google.
Introduction to DnD
How to drag and drop with Java 2, Part 1
How to drag and drop with Java 2, Part 2
Drag and Drop Effects
Hope this helps :)
Read this and if you have an more specific questions come back and ask them.

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

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 choice.
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

Categories