Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.Container;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class Main {

    public static void main(String[] args) {
        JFrame aWindow = new JFrame();
        aWindow.setBounds(200, 200, 200, 200);
        aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        Container content = aWindow.getContentPane();
        content.setLayout(new FlowLayout(FlowLayout.LEFT));
        content.add(new JButton("www.java2s.com"));
        content.add(new JLabel("www.java2s.com"));
        content.add(new JTextField("www.java2s.com"));
        aWindow.setVisible(true);
    }
}