The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.



Posted by Zach Keatts on November 07, 2001 at 11:07 AM

> I wouldn't use a layout for this kind of stuff, since you >won't be able to overlap cards and cool stuff like that
>(imagine a card game in a GridLayout (or worse) -- that would >sure look cheesy).

That was my original approach, but I confused myself into thinking a layout manager was necessary in order to work within the frame (silly silly silly silly!)

> Instead, I would draw all the (visible) cards on the same >JFrame. That way they can be moved around, angled, >overlapped, graphically shuffled (am I getting carried away?)

carried away? Hey that's a great idea thanks!

>and all that good stuff. Look at Graphics and Graphics2D.

> - mfg

> > I am trying to code a "card game" and I am having a difficult time figuring out how to 1. Load an image in the appropriate place in the window. 2. Once it is loaded how can I move it from it's initial position (say the user's "hand") to the final destination ("discard deck"). Would I use the swing layout manager to place the images first and then proceed from there? As for actually moving the images and getting them to another destination I am lost.


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us