package com.java.myapp;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.SpringLayout;
import javax.swing.JButton;
public class MyForm extends JFrame {
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
MyForm frame = new MyForm();
frame.setVisible(true);
}
});
}
/**
* Create the frame.
*/
public MyForm() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 458, 287);
setTitle("ThaiCreate.Com GUI Tutorial");
SpringLayout springLayout = new SpringLayout();
getContentPane().setLayout(springLayout);
JButton btn1 = new JButton("Button 1");
springLayout.putConstraint(SpringLayout.NORTH, btn1, 53, SpringLayout.NORTH, getContentPane());
springLayout.putConstraint(SpringLayout.WEST, btn1, 41, SpringLayout.WEST, getContentPane());
getContentPane().add(btn1);
JButton btn2 = new JButton("Button 2");
springLayout.putConstraint(SpringLayout.NORTH, btn2, 57, SpringLayout.SOUTH, btn1);
springLayout.putConstraint(SpringLayout.EAST, btn2, 0, SpringLayout.EAST, btn1);
getContentPane().add(btn2);
JButton btn3 = new JButton("Button 3");
springLayout.putConstraint(SpringLayout.NORTH, btn3, 82, SpringLayout.NORTH, getContentPane());
springLayout.putConstraint(SpringLayout.WEST, btn3, 132, SpringLayout.WEST, getContentPane());
getContentPane().add(btn3);
JButton btn4 = new JButton("Button 4");
springLayout.putConstraint(SpringLayout.SOUTH, btn4, -77, SpringLayout.SOUTH, getContentPane());
springLayout.putConstraint(SpringLayout.EAST, btn4, -94, SpringLayout.EAST, getContentPane());
getContentPane().add(btn4);
JButton btn5 = new JButton("Button 5");
springLayout.putConstraint(SpringLayout.NORTH, btn5, 0, SpringLayout.NORTH, btn1);
springLayout.putConstraint(SpringLayout.EAST, btn5, 0, SpringLayout.EAST, btn4);
getContentPane().add(btn5);
}
}