askIT

Java Swing Graphics Creating a window programmatically

document-save.png Download Java graphics_creating_a_window code

A window can be created in Java by using the JFrame class. A Jframe window looks like this:

java_jframe.png

This is the approach to create a JFrame window in Java:

package com.nettport.coffeecorner;

import javax.swing.*;

public class Main {

    public static void main(String[] args) {
        // 1. Create a Windows
        JFrame jframe = new JFrame();
        jframe.setSize(1024, 768);
        jframe.setTitle("Coffe Corner Register");
        jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jframe.setVisible(true);

    }
}

Add comment

avatar_blank_60.png

Comment:

Name:

Email:

Comments

No comments yet. You can be the first one to comment. Just write your comment in the form and click on the submit button.