This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Choosing a layout manager for card simulation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Choosing a layout manager for card simulation" Watch "Choosing a layout manager for card simulation" New topic

Choosing a layout manager for card simulation

ric hill

Joined: May 10, 2005
Posts: 3
I want to create a program that will help me remember new vocabulary by showing a word in English and letting me guess the foriegn language equivalent.
At the moment I use paper cards for this. The English word is one one side of a card, the foreign word is on the other.

I have a WordCard object

String EnglishWord
String ForeignWord
Integer ID
Integer Array GuessHistory []

I imagine the WordsCardGUI will display as follows

JLabel = EnglishWord
JTextField = ForeignWord
JButton = "Try"
JButton = "ShowAnswer" this.reveal ()

MainInterface GUI
(not sure what this needs to do yet, any ideas would be great)

My question is.

Which display layout is best for this task?
I would like to be able to view up to 7 cards on screen at once.
I know there is a cardlayout manager but is this the best suited one to use? My intution tends towards each card in a seperate panel.
Joel McNary

Joined: Aug 20, 2001
Posts: 1824

From the sound of it, I think you want a Flow Layout containing 7 different JPanels, each of which has a Card layout. Each card layout contains 2 cards: The Foreign card and the English card. (Probably this is 7 instances of a specific class that extends JPanel, since all that's different is the data...)

Anyway, I think this is best suited to our Swing forum, so I'm moving it there.

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
ric hill

Joined: May 10, 2005
Posts: 3
this program will dislay two cards, I understand most of it apart from the line

Does the container pane begin exist only here? Shouldnt it be declared and initialised first?

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Choosing a layout manager for card simulation
It's not a secret anymore!