core16
core16

Reputation: 113

Fullscreen possibilities?

I am finding it hard to convert my JPanel into a lwjgl fullscreen display? is there another way or a guide on what you need to change:

This is what i am currently calling it with:

public void TowerDefence() {
    setLayout(new GridLayout(1, 1, 0, 0));

    Window window = new Window(this);
    add(window);

    setVisible(true);
}

And this is what is called to initialize the JPanel:

public Window(Frame frame) {
    frame.addMouseListener(new KeyHandler());
    frame.addMouseMotionListener(new KeyHandler());

    thread.start();
}

Do i need to change only inside this constructor? And what needs to be added in order for fullscreen to work?

Upvotes: 0

Views: 139

Answers (2)

Vova
Vova

Reputation: 160

Try this:

frame.setExtendedState(JFrame.MAXIMIZED_BOTH); 

Upvotes: 0

Andrew Thompson
Andrew Thompson

Reputation: 168825

See the lesson on the Full-Screen Exclusive Mode API in the tutorial.

Upvotes: 1

Related Questions