Block entire swing ui except for one component - “dialog style”

前端 未结 4 1658
旧时难觅i
旧时难觅i 2021-01-23 20:19

[This question is in relation to this question]

Setting: I have this home-crafted \"editable label\" component which looks like a label, but when you cl

4条回答
  •  迷失自我
    2021-01-23 20:57

    You can extend a JDialog, then when you init it,

    this.setAlwaysOnTop(true);
    this.setModalityType(ModalityType.APPLICATION_MODAL);
    this.setVisible(false);
    this.setVisible(true);
    

    It will only allow the JDialog to be interacted with and block everything else in the application.

提交回复
热议问题