Showing “JOptionPane.showMessageDialog” without stopping flow of execution

后端 未结 3 1727
说谎
说谎 2021-02-15 16:48

I\'m currently working on a project that\'s getting more complex than I thought it would be originally. What I\'m aiming to do right now is show a message dialog without halting

3条回答
  •  不思量自难忘°
    2021-02-15 17:26

    try this one:

      EventQueue.invokeLater(new Runnable(){
                            @Override
                            public void run() {
                         JOptionPane op = new JOptionPane("Hi..",JOptionPane.INFORMATION_MESSAGE);
                         JDialog dialog = op.createDialog("Break");
                         dialog.setAlwaysOnTop(true);
                         dialog.setModal(true);
                         dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);      
                         dialog.setVisible(true);
                            }
                        });
    

提交回复
热议问题