Menghitung Luas Persegi Panjang dengan Java Netbeans

Menghitung Luas Persegi Panjang :

Buat Form seperti di bawah ini, dengan menggunakan jFrame Form.

Source :

/*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

/*

* LuasPersegiPanjang.java

*

* Created on Dec 5, 2011, 2:34:08 PM

*/

/**

*

* @author ***

*/

public class LuasPersegiPanjang extends javax.swing.JFrame {

/** Creates new form LuasPersegiPanjang */

public LuasPersegiPanjang() {

initComponents();

}

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

// TODO add your handling code here:

int panjang = Integer.parseInt(jTF_panjangPP.getText());

int lebar = Integer.parseInt(jTF_lebarPP.getText());

int hasil = panjang*lebar;

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

}

public static void main(String args[]) {

public void run() {

new LuasPersegiPanjang().setVisible(true);

}

});

}

// Variables declaration – do not modify

private javax.swing.JButton jBHapusPP;

private javax.swing.JButton jB_hitungpersegipanjang;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JPanel jPanel1;

private javax.swing.JTextField jTF_hasilLuasPersegiPanjang;

private javax.swing.JTextField jTF_lebarPP;

private javax.swing.JTextField jTF_panjangPP;

// End of variables declaration

}

Selamat mencoba..

About these ads

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

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: