/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package terraario;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Piirtoalusta alusta = new Piirtoalusta();
        Terraario terraario = new Terraario(alusta);
        alusta.setTerraario(terraario);

        // luodaan uusi ikkuna
        JDialog ikkuna = new JDialog();
        ikkuna.setSize(640, 480); // asetetaan leveydeksi 640 pikseliä, korkeudeksi 480 pikseliä
        ikkuna.getContentPane().add(alusta);

        // suljetaan ohjelma kun ikkuna suljetaan
        ikkuna.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }

        });

        ikkuna.setVisible(true); // näytä ikkuna
        new Thread(terraario).start();
    }

}
