Thursday, November 14, 2013

Java GUI Part 3 - Tampilan3

SamaLoaJava GUI Part 3 - Tampilan3


Tampilan3
Hasil Tampilan3 ketika dijalankan
Langsung aja codingnya :
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

class Tampilan3{
public Tampilan3(){
JFrame frame =  new JFrame();
final JTextField txtNim = new JTextField(30);
final JTextField txtNama = new JTextField(30);
JButton btnNim = new JButton("Nim");
JButton btnNama = new JButton("Nama");
JButton btnKosong = new JButton("Kosongkan");
btnNim.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
txtNim.setText("12.11.5980");
}
});
btnNama.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
txtNama.setText("M.Nur Fadillah");
}
});
btnKosong.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
txtNama.setText("");
txtNim.setText("");
}
});
Container contentPane = frame.getContentPane();
contentPane.setLayout(new FlowLayout());
contentPane.add(txtNim);
contentPane.add(btnNim);
contentPane.add(txtNama);
contentPane.add(btnNama);
contentPane.add(btnKosong);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args){
new Tampilan3();
}
}

Categories: , , ,

0 comments:

Post a Comment

http://www.resepkuekeringku.com/2014/11/resep-donat-empuk-ala-dunkin-donut.html http://www.resepkuekeringku.com/2015/03/resep-kue-cubit-coklat-enak-dan-sederhana.html http://www.resepkuekeringku.com/2014/10/resep-donat-kentang-empuk-lembut-dan-enak.html http://www.resepkuekeringku.com/2014/07/resep-es-krim-goreng-coklat-kriuk-mudah-dan-sederhana-dengan-saus-strawberry.html http://www.resepkuekeringku.com/2014/06/resep-kue-es-krim-goreng-enak-dan-mudah.html http://www.resepkuekeringku.com/2014/09/resep-bolu-karamel-panggang-sarang-semut-lembut.html

Copyright © SamaLoa | Powered by Blogger

Design by Anders Noren | Blogger Theme by NewBloggerThemes.com | BTheme.net      Up ↑