Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;

public class Main {
    public static void main(String args[]) {
        JFrame frame = new JFrame();

        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

        int width = (int) screenSize.getWidth();
        int height = (int) screenSize.getHeight();
        Dimension newDim = new Dimension(width, height - 40);

        frame.setSize(newDim);

        frame.setVisible(true); // FIRST visible = true
        frame.setResizable(false); // THEN resizable = false
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}