Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Main {
    public static void main(String[] argv) throws Exception {
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gs = ge.getDefaultScreenDevice();

        Button btn = new Button("OK");
        btn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                GraphicsDevice gs = ge.getDefaultScreenDevice();
                gs.setFullScreenWindow(null);
            }
        });
        Frame frame = new Frame(gs.getDefaultConfiguration());
        Window win = new Window(frame);
        win.add(btn, BorderLayout.CENTER);
        try {
            gs.setFullScreenWindow(win);
            win.validate();
        } finally {
            gs.setFullScreenWindow(null);
        }
    }
}