How to prompt a confirmation dialog box in the middle of non event dispatching thread

后端 未结 6 454
滥情空心
滥情空心 2021-01-19 00:09

I have the following fun which will be executed by non event dispatching thread. In the middle of thread, I want a

  1. A confirmation box pop up. Thre
6条回答
  •  孤街浪徒
    2021-01-19 00:30

    May be I do not understand the question, but I do not get the answers either... if you want the calling thread to block on the call to fun(), why display the JOptionPane in a new (parallel) Thread? Shouldn't this be sufficient?

    public int fun() {
        return JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION);
    } 
    

    PS How do you define a non event dispatching thread?

提交回复
热议问题