Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.Timer;

public class Main extends JFrame {
    private JFrame frame = new JFrame();

    public Main() {
        frame.setSize(600, 600);
        frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
        frame.setVisible(true);
        frame.setExtendedState(JFrame.ICONIFIED);
        Timer t = new Timer(3000, new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
                java.awt.EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        frame.setExtendedState(JFrame.NORMAL);
                    }
                });
            }
        });
        t.setRepeats(false);
        t.start();
    }

    public static void main(String[] args) {
        new Main();
    }
}