how to show JOptionPane on the top of all windows

前端 未结 6 1021
予麋鹿
予麋鹿 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:39

    public static void showNotExist(JPanel panel, String action) {
        JOptionPane.showMessageDialog(rootPane, new JLabel(action.concat(" doesn't exist."), 2));
    }
    

    Try giving the rootpane as the 1st value in the showMessageDialog section

提交回复
热议问题