import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class Window extends World
{
public Window{
private Window()
{
// Sets the title for this frame.
this.setTitle("Shoot the duck");
// Sets size of the frame.
if(true) // Full screen mode
{
// Disables decorations for this frame.
this.setUndecorated(true);
// Puts the frame to full screen.
this.setExtendedState(this.MAXIMIZED_BOTH);
}
else // Window mode
{
// Size of the frame.
this.setSize(800, 600);
// Puts frame to center of the screen.
this.setLocationRelativeTo(null);
// So that frame cannot be resizable by the user.
this.setResizable(false);
}
// Exit the application when user close frame.
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setContentPane(new Framework());
this.setVisible(true);
}
public static void main(String[] args)
{
// Use the event dispatch thread to build the UI for thread-safety.
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new Window();
}
});
}
super(600, 400, 1);
}
}