I am trying to disable the "main" JFrame
when the new frame pops up. I want it so you can not click or drag anything on that frame. I tried making the new frame a JDialog
, but that did not disable the other frame. I also looked at the other post about this, which suggested to make it a JDialog
but it still does not work. I really need help doing this please. thanks. This is the codeIi am using to make the JDialog
, is their any problems with it?
editDialog=new JDialog(IntroScreen.frame);
IntroScreen.frame
represents the "main" frame.
setDefaultCloseOperation() method to change the default behavior option of JFrame responding to the window closing event. Select the EXIT_ON_CLOSE option will terminate the application immediately. Of course, when the application is terminated, all frames will be closed automatically.
DISPOSE_ON_CLOSE -- The frame will be closed and disposed but the application will not exit. JFrame. DO_NOTHING_ON_CLOSE -- The frame will be closed but not disposed and the application will not exit.
The setVisible(true) method makes the frame appear on the screen. If you forget to do this, the frame object will exist as an object in memory, but no picture will appear on the screen.
JFrame is a normal window with its normal buttons (optionally) and decorations. JDialog on the other side does not have a maximize and minimize buttons and usually are created with JOptionPane static methods, and are better fit to make them modal (they block other components until they are closed).
You have set for JDialog#setModal or JDialog#ModalityTypes, maybe with Dialog.ModalityType APPLICATION_MODAL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With