Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.BorderLayout;

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

public class Main {
    public static void main(String[] args) {
        JFrame frame = new JFrame("test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JPanel panel = new JPanel(new BorderLayout());
        JPanel panel2 = new JPanel(new BorderLayout());
        panel2.add(new JButton("NORTH"), BorderLayout.NORTH);
        panel2.add(new JButton("CENTER"));
        panel.add(panel2);
        panel.add(new JButton("SOUTH"), BorderLayout.SOUTH);
        panel.add(new JButton("EAST"), BorderLayout.EAST);
        frame.add(panel);
        frame.pack();
        frame.setVisible(true);
    }
}