Disable JFrame when a new JFrame is opened

后端 未结 2 1026
感动是毒
感动是毒 2021-01-19 03:42

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 fra

相关标签:
2条回答
  • 2021-01-19 04:04

    You have set for JDialog#setModal or JDialog#ModalityTypes, maybe with Dialog.ModalityType APPLICATION_MODAL

    0 讨论(0)
  • 2021-01-19 04:04

    If you want to use multiple JFrames you could use the method setEnabled() when you open the other JFrame.

    frame.setEnabled(false);
    

    Otherwise you should go with JDialog and its method setModal().

    0 讨论(0)
提交回复
热议问题