Hi i'm new to using jframes, and my teacher has asked us to create any sort of game with it. I've decided to create a trivia game, and i'm sure most of you have played a trivia game on the internet before, so maybe you can answer my question. You know when you click an answer, then hit the next button, a new window with a new question appears...is it possible to do such a thing with a jframe? I've set up my frame layout with the design tool by dragging radio buttons and label buttons to create the answers and the "next" & "previous" button, but i'm stuck as to what else I'm supposed to do. I've tried reading some jframe tutorials, but none seem to really answer my question or at least i'm just not getting it. Sorry for the essay, but I guess my real question is can i do such a thing with jframes, popping up new windows? this might be a really dumb question, but my teacher has not taught us anything about jframes and is using this as a "good experience" for us..:icon_rolleyes:

Recommended Answers

All 2 Replies

Use a JFrame only for the "main" dialog. Use a JDialog (or better yet a JOptionPane) for the "popups". Read the API docs for JDialog and JOptionPane (and JOptionPane and its "finished" methods are the way to go here).

Consider also that you don't really need to pop up separate windows for each question. You just need to change the text and the choices. You could easily do that within a single panel.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.