What is the difference between a JFrame and a JDialog?

前端 未结 4 569
深忆病人
深忆病人 2021-02-03 22:16

What is the difference between a JFrame and a JDialog?

Why can\'t we use setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE); for a JD

4条回答
  •  花落未央
    2021-02-03 22:26

    Why we can't use setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); for JDialog?

    Sure you can.

    Post your SSCCE that demonstrates the problem you are having when using this value.

    However you can't use EXIT_ON_CLOSE for a JDialog because that value is not supported which makes sense since a JDialog is a "child" or "helper" window for your application which is represented by a JFrame. Closing a dialog should not close the application.

提交回复
热议问题