Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JFrame;
import javax.swing.JTextField;

public class Main extends JFrame {

    public Main() {
        JTextField f = new JTextField(20);

        setLayout(new GridBagLayout());
        GridBagConstraints c = new GridBagConstraints();
        c.anchor = GridBagConstraints.SOUTHEAST;
        c.weighty = 1;
        add(f, c);
    }

    public static void main(String... strings) {
        Main e = new Main();
        e.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        e.pack();
        e.setLocationRelativeTo(null);
        e.setVisible(true);
    }

}