Membuat Form Operator - Neatbeans

 

1.       KASUS 2.1

Operasi Matematis

 

public class Bilangan extends javax.swing.JFrame {

    /** Creates new form Bilangan */

    public Bilangan() {

        initComponents();

        Jumlah.setText("");

        Kurang.setText("");

        Bagi.setText("");

        Kali.setText("");

        Pangkat.setText("");

    }

 



 

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

        // TODO add your handling code here:

        Jumlah.setText(Integer.toString(10+100));

        Kurang.setText(Integer.toString(100-45));

        Kali.setText(Integer.toString(20*30));

        Bagi.setText(Integer.toString(300/30));

        Pangkat.setText(Integer.toString((int)Math.pow(8,3)));

    }                                           

 

 



 

2.       KASUS 2.2

Struk Pembelian

 

public StrukPembelian() {

        initComponents();

        JumlahBelanja.setText("");

        HargaJeruk.setText("");

        TotalPerbelanjaan.setText("");

        Keterangan.setText("");

    }

 



 

Private void TombolTampilActionPerformed(java.awt.event.ActionEvent evt) {                                            

        // TODO add your handling code here:

        JumlahBelanja.setText("Jumlah Pembelian : "+Integer.toString(10)+ "Buah");

        HargaJeruk.setText("Harga Jeruk : Rp"+Integer.toString(10000)+ "/kg");

        TotalPerbelanjaan.setText("Total Pembayaran : Rp"+Integer.toString(10000*10));

        Keterangan.setText(" Keterangan : Jika sudah membeli maka tidak dapat dikembalikan lagi,"

    + "Terimakasih... Happy kiyowoo<3");

    }                

 

 



 

 

 

 

3.       KASUS 2.3

Membaca Teks

 

public MembacaTeks() {

        initComponents();

        Hasil.setText("");

    }

 



 

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

        // TODO add your handling code here:

        Hasil.setText(txtMasukkan.getText());

    } 

 



 

 

 

 

 

 

 

 

 

 

 

 

 

4.       KASUS 2.4

Form Kalkulator Sederhana

 

public FormKalkulator() {

        initComponents();

        Hasil.setText("");

    }

 



 

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

        // TODO add your handling code here:

        Hasil.setText(Integer.toString(Integer.parseInt(txtAngka1.getText())+Integer.parseInt(txtAngka2.getText())));

    }                                     

 

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

        // TODO add your handling code here:

        Hasil.setText(Double.toString(Math.pow(Double.parseDouble(txtAngka1.getText()),Double.parseDouble(txtAngka2.getText()))));

    }                                            

 

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

        // TODO add your handling code here:

        Hasil.setText(Integer.toString(Integer.parseInt(txtAngka1.getText())/Integer.parseInt(txtAngka2.getText())));

    }                                         

 

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

        // TODO add your handling code here:

        Hasil.setText(Integer.toString(Integer.parseInt(txtAngka1.getText())-Integer.parseInt(txtAngka2.getText())));

    }                                           

 

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

        // TODO add your handling code here:

        Hasil.setText(Integer.toString(Integer.parseInt(txtAngka1.getText())*Integer.parseInt(txtAngka2.getText())));

    }                                         

 



 

 

 

 

 

 

 

 

 

 

5.       KASUS 2.5

Form data mahasiswa

 

public FormMahasiswa() {

        initComponents();

        Nama.setText("");

        Nim.setText("");

        Jurusan.setText("");

        Alamat.setText("");

        Ipk.setText("");

       

    }

 

 



 

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

        // TODO add your handling code here:

        Nama.setText(txtNama.getText());

        Nim.setText(txtNim.getText());

        Jurusan.setText(txtJurusan.getText());

        Alamat.setText(txtAlamat.getText());

        Ipk.setText(txtIpk.getText());

    }                             

 

 



 

6.       Kasus 2.6

Form Rerata

 



 

 

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

        // TODO add your handling code here:

        txtHasil.setText(Double.toString(Double.parseDouble(txtAngka1.getText())+Double.parseDouble(txtAngka2.getText()+Double.parseDouble(txtAngka3.getText())+Double.parseDouble(txtAngka4.getText()))/4));

    } 

 

 



Komentar