How to Delay MessageDialogBox in Java?

前端 未结 2 1135
孤独总比滥情好
孤独总比滥情好 2021-01-20 11:47

So in this chunk of code:

//Actions performed when an event occurs.
    public void actionPerformed(ActionEvent event) 
    {
        String command = event.         


        
2条回答
  •  长发绾君心
    2021-01-20 12:11

    You can use the SwingWorker.

    Have a look here, java tutorial.

    SwingWorker worker = new SwingWorker() {
        @Override
        public Void doInBackground() {
            FileConverter fc = new FileConverter();
            return null;
        }
    
        @Override
        public void done() {
            JOptionPane.showMessageDialog(this, "Step 1 Complete!", "Validation", JOptionPane.INFORMATION_MESSAGE);
        }
    };
    

提交回复
热议问题