File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Game Development and the fly likes How to drag my last card images witch is draw on applet. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "How to drag my last card images witch is draw on applet. " Watch "How to drag my last card images witch is draw on applet. " New topic
Author

How to drag my last card images witch is draw on applet.

Ganesh Gothi
Greenhorn

Joined: Apr 29, 2012
Posts: 9
please help me , how can I drag my last card images witch is draw on applet.

I have draw 83 images one by one on applet , now I want to drag the only last images in the bunch of card, I am dragging all images one by one and drop it, but I want to only drag one card images witch is on top, please help me ASAP.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
you have 26 replies here, do you really want to repeat all that?

http://www.java-forums.org/java-applets/58956-how-drage-my-card-images-draw-applet.html

I haven't read through all of those, so this might be a repeat,
simplest way might be to load your images into JLabels, add
mouse and motion listeners to the labels, add the labels on
top of each other, then drag the top one.
Steve Stevenson
Greenhorn

Joined: Apr 12, 2012
Posts: 21
I am also working on a card-based app. Mine is for getting knowledgeable about Java.

One thing that I suggest is that you look into the JLayeredPane if you haven't already done so:
http://docs.oracle.com/javase/tutorial/uiswing/components/layeredpane.html

When I started my game I was unaware of this class, and when I discovered it it made things so much easier. It's an extremely powerful control with an API that is surprisingly intuitive.

I forget if the demo in that uses true drag and drop or handling mouse events for moving the little Duke guy around, but in mine I used the mouse listeners like Michael Dunn suggested. I also created a "Card" class that uses JLabel as its parent.

Ganesh Gothi
Greenhorn

Joined: Apr 29, 2012
Posts: 9
Hi Steve Stevenson,
Please show me demo in that uses true drag and drop or handling mouse events for moving the little Duke guy around, because I am working on drag and drop of images, I am making game like a rummy card game and using applet in my web application, so please give me the or show me the demo, those you saying in post.
Steve Stevenson
Greenhorn

Joined: Apr 12, 2012
Posts: 21
Ganesh Gothi wrote: Hi Steve Stevenson,
Please show me demo in that uses true drag and drop or handling mouse events for moving the little Duke guy around, because I am working on drag and drop of images, I am making game like a rummy card game and using applet in my web application, so please give me the or show me the demo, those you saying in post.


It's actually inside that link, but this direct link ought to open up the app so that you can see it in action:

http://docs.oracle.com/javase/tutorialJWS/uiswing/components/ex6/LayeredPaneDemo.jnlp


The article itself from my other post up above describes how it works.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to drag my last card images witch is draw on applet.
 
Similar Threads
how to Draw, mouse dragged points on JPane and Save it
how to undo the last action printed on an applet using undo button
To send an Applet??
how to undo the last action printed on an applet using undo button
To send an Applet