How to disable main JFrame when open new JFrame

user236501 picture user236501 · Jun 12, 2010 · Viewed 62.9k times · Source

Example now I have a main frame contains jtable display all the customer information, and there was a create button to open up a new JFrame that allow user to create new customer. I don't want the user can open more than one create frame. Any swing component or API can do that? or how can disabled the main frame? Something like JDialog.

Answer

Hatem picture Hatem · Dec 6, 2011

I think you should use this code for the main jframe when you trying to open new one :

this.setEnabled(false);