jump to navigation

Source Code Dasar Permulaan Belajar Java Programming December 22, 2011

Posted by kelompok24itbseamolecb5 in Pemrograman Java.
trackback

Create Tiitle :

public class Program1 extends javax.swing.JFrame {

public Program1() {

        super(“Perogram pertama  java”);

initComponents();

}

private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {             

if (jTF_nama.getText().isEmpty() || jTF_alamat.getText().isEmpty() || jTF_telp.getText().isEmpty()){

JOptionPane.showConfirmDialog(null, “Salah satu data tidak boleh kosong”);

}else{

jTF_namaout.setText(jTF_nama.getText());

jTF_alamatout.setText(jTF_alamat.getText());

jTF_telpout.setText(jTF_telp.getText());

jTF_nama.setText(null);

jTF_alamat.setText(null);

jTF_telp.setText(null);

}

}

private void jButtonClearActionPerformed(java.awt.event.ActionEvent evt) {                                        

jTF_nama.setText(null);

jTF_alamat.setText(null);

jTF_telp.setText(null);

}

public class Program2 extends javax.swing.JFrame {private ButtonGroup gabung;

public Program2() {

initComponents();

gabung = new ButtonGroup();

gabung.add(jRB_laki);

gabung.add(jRB_perempuan);

}

private void jB_simpanActionPerformed(java.awt.event.ActionEvent evt) {

String jk=””;

String agama=””;

if(jRB_laki.isSelected()){

jk=”Laki-Laki”;

}else if(jRB_perempuan.isSelected()){

jk=”Perempuan”;

}

agama=jComboBox1.getSelectedItem().toString();

jTextArea2.setText(jTF_nama.getText() + “\n” + jk + “\n” +

“\n” + agama + “\n” + jTF_hobi.getText() + “\n” +

jTF_telp.getText() + “\n” + jTF_email.getText()+ “\n” +jTA_alamat.getText());

}

private void jButtonExitActionPerformed(java.awt.event.ActionEvent evt)

{

int psn1=JOptionPane.showConfirmDialog(null, “Keluar Dari Aplikasi?”);

if(psn1==JOptionPane.OK_OPTION){

System.exit(1);

}else{

}

}

private void jBHitungLSegitigaActionPerformed(java.awt.event.ActionEvent evt) {

int alas = Integer.parseInt(jTFAlas.getText());

int tinggi = Integer.parseInt(jTFTinggi.getText());­­

int hasil = (alas*tinggi)/2;

jTFHasilLSegitiga.setText(String.valueOf(hasil));

}

private void jButtonloginActionPerformed(java.awt.event.ActionEvent evt) {

if (jTFusername.getText().equals(“admin”) && jPasswordField1.getText().equals(“maqi”)){

MenghitungNilaiMahasiswa n = new MenghitungNilaiMahasiswa();

n.show();

dispose();

}

}­­­

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: