Animated drag and drop in JTable [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 3 years ago.
Improve this question
Do you know some way to make drag and drop in table more user-friendly? For example: row stick to mouse on drag, and other rows swap places when dragging. Can you recommend me some library for this ?

I'd suggest you take a little time to have a read through The Rabbit Hole which has some excellent articles on the topic of drag'n'drop.
These are most of the articles of interest
Smooth JList Drop Target Animation
Smooth Tree Drop Animation
My Drag Image is Better than Yours
Dead Simple Drags
Fancy Drops
Drag Images for Everyone
Drop Target Navigation, or you drag your bags, let the doorman get the door
Swing Drag Images (Improved)

Well, Java libraries are usually not good really at the "animation" thing. There is a way to do this using the D and D libraries Java comes with but it would require swapping the values of the rows, rather than swapping the rows themselves.
Java is very limited at this kind of stuff. Either you hard code your own library, or use some other language that has libraries for tasks like these.

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.

How to add Interactive animations in jFrame? [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 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

Move image with mouse cursor in Java applet [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I've been trying to teach myself Java recently and as part of the process I'm working on a Calorie Calculator applet.
Just to make things more fun I was thinking to use the picture of a smartphone as the background image.
What I want to know is: say I also had a picture of a stylus pen; any way I could make that move with the mouse once I've clicked on it? Preferably this image would replace the mouse cursor (though not mandatory). It should stick to the mouse cursor until the applet is closed, regardless of any other events occurring (clicking other images, buttons, text areas etc.)
I appreciate your assistance!
..any way I could make that move with the mouse once I've clicked on it?
The main component needs a MouseListener. See How to Write a Mouse Listener for details.
Preferably this image would replace the mouse cursor (though not mandatory).
Look to the Cursor API for that.
This sounds like a classic XY problem.
What you might actually be looking for is Drag and Drop and Data Transfer.

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