import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import javax.swing.*;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Erde extends Actor
{   
    private String datumString;
    private boolean autostart;

    public Erde()
    {
        datumString = new SimpleDateFormat("dd.MM.yyyy").format(new Date());
        autostart = true;
    }
    
    public void act() 
    {
        if (Greenfoot.mouseClicked(this))
        {
            datumString = JOptionPane.showInputDialog("Bitte geben Sie das Datum ein tt.mm.jjjj");
            ((Weltall)getWorld()).mondphaseErmitteln(datumString);
        }
        
        if (autostart == true)
        {
            ((Weltall)getWorld()).mondphaseErmitteln(datumString);
            autostart = false;
        }
    }    
}
