using invokelater wit runnable method

200 Views Asked by At

Sorry if this question stupid but i am trying to learn java and do some tuts on Swing. On all the tuts it is demonstrated on how to use the EventQueue.invokelater Method and pass it a Runnable object and override the run Method of it.

Code of one example looks as follows:

   public static void main(String[] args) {
    Runnable test = new Runnable ();
    EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            Guitest ex = new Guitest();
            ex.setVisible(true);
        }
    });

While running the code n eclipse it always tells me:

The method invokeLater(Runnable) in the type EventQueue is not applicable 
    for the arguments (new Runnable(){})

Why doesnt it accept the method as argument? What am a missing? Thanks in advance.

0

There are 0 best solutions below