java programming window code example

Example: java making a screen

import java.awt.*;
import javax.swing.*;

public class Screen{
    
    private GraphicsDevice graphicsDevice;
    
    public static void main(String[] args){
        
        Screen screen = new Screen();
    }
    public Screen(){
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        JFrame jFrame = new JFrame();
        
        MakeDefaultScreen(jFrame,screenSize);
        
        System.out.println("Program Started");
    }
    public void MakeDefaultScreen (JFrame jFrame,Dimension screenSize){
        jFrame.setSize(screenSize.width,screenSize.height);
        jFrame.setVisible(true);
        jFrame.setResizable(true);
    }
}

Tags:

Java Example