-1

I am somewhat new to coding and I need a little help. I am making a program where you start in the main menu. In the main menu there is an options button you can click on that will open a new jframe with the options. I was wondering if there was a way so that you would have to use the new JFrame before using the older (or main) one.

Kasarrah
  • 315
  • 2
  • 4
  • 14
  • 1
    Do you mean that the new frame should be [modal](http://en.wikipedia.org/wiki/Modal_window)? If so see http://stackoverflow.com/questions/1481405/how-to-make-a-jframe-modal-in-swing-java – vandale Jun 12 '14 at 04:05

1 Answers1

2

Take a look at How to Make Dialogs.

A modal dialog is one that must be dismissed (closed) before you can interact with program again (an example might be the open/save dialog of Word or your web browser)

But you should also have a read through The Use of Multiple JFrames: Good or Bad Practice? first...

Alternatively, you could use a CardLayout, which would allow you to switch between views from within the same window

You could also use a JTabbedPane which will allow you to have your views presented on the screen and accessible via a "tab", meaning the user can only interact with a single view, but they can navigate to a different view by clicking the tab they want.

Community
  • 1
  • 1
MadProgrammer
  • 343,457
  • 22
  • 230
  • 366