how to show JOptionPane on the top of all windows

前端 未结 6 979
予麋鹿
予麋鹿 2021-01-07 21:01

I have created a DialogUtil which shows numbers of JOptionPan in different situation. sometimes in my action class call to this method with null parameters as below.

6条回答
  •  说谎
    说谎 (楼主)
    2021-01-07 21:40

    You can set JOptionPane always on top by using this code:-

    JFrame jf=new JFrame();
    jf.setAlwaysOnTop(true);
    int response = JOptionPane.showConfirmDialog(jf,"Message", "Title", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
    

提交回复
热议问题