Swing timers basic functionallity
I'm new at java graphic design, and I would like you, if possible, to help me with an easy example to help me to get to understand the basic functionallity of JFrames, Timers, SwingControllers, and all this stuff. How would you implement the following case:

We have a JFrame with a JPanel inside.
When the execution starts, the JPanel is white, but we want it to change it's colour every two seconds:

public class MiJFrame extends javax.swing.JFrame {

    public MiJFrame() {
        initComponents();
    }


    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new MiJFrame().setVisible(true);
                jPanel1.setBackground(Color.yellow);
                jPanel1.setBackground(Color.RED);
            }
        });
    }

    // Variables declaration - do not modify
    private static javax.swing.JPanel jPanel1;
    // End of variables declaration
}
At first, I used the sleep method of a thread object between the setBackgroud() methods but it doesn't work, as it only shows the last change.How would you use here a Timer object?

Thank you very much for your help!
Swing timers basic functionallity
===

I'm new at java graphic design, and I would like you, if possible, to help me with an easy example to help me to get to understand the basic functionallity of JFrames, Timers, SwingControllers, and all this stuff. How would you implement the following case:

We have a JFrame with a JPanel inside.
When the execution starts, the JPanel is white, but we want it to change it's colour every two seconds:

public class MiJFrame extends javax.swing.JFrame {

    public MiJFrame() {
        initComponents();
    }


    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new MiJFrame().setVisible(true);
                jPanel1.setBackground(Color.yellow);
                jPanel1.setBackground(Color.RED);
            }
        });
    }

    // Variables declaration - do not modify
    private static javax.swing.JPanel jPanel1;
    // End of variables declaration
}
At first, I used the sleep method of a thread object between the setBackgroud() methods but it doesn't work, as it only shows the last change.How would you use here a Timer object?

Thank you very much for your help!