Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class Main {
    public static void main(String... args) {
        JFrame f = new JFrame();
        JButton button;

        JPanel p = new JPanel();
        button = new JButton("Button");
        p.setLayout(null);
        button.setBounds(40, 100, 100, 60);
        p.add(button);

        f.add(p);
        // setLayout(null);
        f.setDefaultCloseOperation(3);
        f.setSize(400, 400);
        f.setVisible(true);
    }
}