This site requires JavaScript, please enable it in your browser!
Greenfoot back
dr_rabbit
dr_rabbit wrote ...

2014/12/7

<indentifier> expected

dr_rabbit dr_rabbit

2014/12/7

#
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);
    }
}
dr_rabbit dr_rabbit

2014/12/7

#
in "public Window{ " is this error
davmac davmac

2014/12/7

#
What is 'public Window {' supposed to be declaring (i.e. why do you have it there)?
danpost danpost

2014/12/7

#
Line 8 should be:
public Window() {
with the round brackets after the class name.
You need to login to post a reply.