The Answer
The Answer

Reputation: 279

Thread out of the EDT

Hi i'd like to do a task out of the EDT :

new Thread(new Runnable(){

                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    fBPC.repaint();
                    System.out.println("toto");
                    if (SwingUtilities.isEventDispatchThread()){
                        System.out.println("titi");
                    }
                }
            }).run();

It display that:

toto

titi

Am i not supposed to get only : "toto" because i created a new Thread ?

If not please explain me how to make things in a thread ou of the EDT.

Thank you for helping.

Upvotes: 3

Views: 98

Answers (1)

Jens Piegsa
Jens Piegsa

Reputation: 7495

Use Thread.start() instead of Thread.run().

Upvotes: 3

Related Questions