import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SimpleForm {
public static void main(String[] args){
JFrame myFrame = new JFrame("Form Sederhana");
FlowLayout layout = new FlowLayout(FlowLayout.LEFT);
layout.setVgap(10);
layout.setHgap(10);
JTextField txtPesan = new JTextField(20);
JButton cmdTampil = new JButton("Tampil");
JButton cmdClose = new JButton("Keluar");
cmdClose.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
System.out.println("Keluar");
System.exit(0);
}
});
myFrame.getContentPane().setLayout(layout);
myFrame.getContentPane().add(txtPesan);
myFrame.getContentPane().add(cmdOK);
myFrame.getContentPane().add(cmdClose);
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.pack();
myFrame.show();
}
}
Baca juga beberapa artikel terkait berikut ini :
0 komentar:
Posting Komentar