Monday, July 16, 2012

July 16, 2012
package desktopapplication2.resources;

public class perhitungansederhana extends javax.swing.JFrame {
public perhitungansederhana() {
        initComponents();
    }

 private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
float a,b,c;


a=Float.parseFloat(jTextField1.getText());
b=Float.parseFloat(jTextField2.getText());
c=a+b;

jTextField3.setText(""+c);

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
float a,b,c;


a=Float.parseFloat(jTextField1.getText());
b=Float.parseFloat(jTextField2.getText());
c=a-b;

jTextField3.setText(""+c);

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
float a,b,c;


a=Float.parseFloat(jTextField1.getText());
b=Float.parseFloat(jTextField2.getText());
c=a*b;

jTextField3.setText(""+c);

 private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
float a,b,c;


a=Float.parseFloat(jTextField1.getText());
b=Float.parseFloat(jTextField2.getText());
c=a/b;

jTextField3.setText(""+c);

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
jTextField1.setText(null);
 jTextField2.setText(null);
 jTextField3.setText(null);

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);

public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new perhitungansederhana().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    // End of variables declaration

}



Tampilan:








0 comments: