0

I'm making a question and answer game. The user must first pick a category in a JFrame then another Jframe would pop up with the question. What i want is to prevent the user from choosing another category without first answering the question.

MadProgrammer
  • 343,457
  • 22
  • 230
  • 366
Mike
  • 19
  • 3
  • `JDialog/JOptionPane` is the answer, here is one [related example](http://stackoverflow.com/a/19056433/1057230) – nIcE cOw Sep 28 '13 at 12:23

3 Answers3

1

Instead of using JFrame either use a JDialog or JOptionPane

See How to use dialogs for more details

MadProgrammer
  • 343,457
  • 22
  • 230
  • 366
0

You could make the second frame modal so that no category could be picked if the second frame is not closed first.

Maxime Vernier
  • 340
  • 1
  • 9
0

Disable the parent frame(Category) before showing the question frame

parentFrame.disable();
//Display yours Question Frame

Then you can add enable the category frame when user answers the question. use action Listeners for this. Also add a action lintener for close window button. In all these scenarios set visibility of your question frame to false and enable your categories frame.

parentFrame.enable();
Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289