Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Jframes and quiz game  RSS feed

 
javedkhan khan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi
I want to create a quiz game where I have to ask questions and gives 4 options. The submit button to check the answer and Next button to move to next question and of course next frame.
My question is how should I design this game? Should I have one frame for each question and moves to other questions frames by frames? This seems very strange because if I have 100 questions then I will have 100 frames?
Please suggest some idea?
 
Campbell Ritchie
Marshal
Posts: 55722
163
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have arrived in the wrong location; this page is for discussing the website itself. I shall try moving you elsewhere.

What happen swhen you play the game from the command line? Don't even think of writing a GUI until you have it working without the GUI.
 
Paul Clapham
Sheriff
Posts: 22502
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As for design: no, you would just use a single JFrame containing suitable components to show your data, and change those components as needed.
 
Nigel Browne
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First I suggest you read the Swing or JavaFX tutorial. Next look up the LayoutManager interface and the CardLayout class in the java api.
 
Stephan van Hulst
Saloon Keeper
Posts: 7809
142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think the CardLayout is appropriate in this case. CardLayouts are for different layouts in the same component. This is the same layout, but different data.
 
Nigel Browne
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephan van Hulst wrote:I don't think the CardLayout is appropriate in this case. CardLayouts are for different layouts in the same component. This is the same layout, but different data.


That depends on the questions on the the cards. Some might be multiple choice with only one correct answer using radio buttons, others maybe multiple choice with more than one answer that is correct using check boxes.

Layout tutorial
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!