Selasa, 11 November 2014

Contoh form pada Netbeans



  •  Praktikum 1



private void tampilkanActionPerformed(java.awt.event.ActionEvent evt) {                                                  // TODO add your handling code here:
        JOptionPane.showMessageDialog (null, "Selamat Mencoba IDE Netbeans Ina Sukinah");
    }                                        


  • Praktikum 2 a



private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        Hnpm.setText(npm.getText());
        Hnama.setText(nama.getText());
        Halamat.setText(alamat.getText());
    }                                       

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                               // TODO add your handling code here:
        dispose();
    }                                       

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                               // TODO add your handling code here:
        Hnpm.setText("");
        Hnama.setText("");
        Halamat.setText("");
        npm.setText("");
        nama.setText("");
        alamat.setText("");
    }                      

  • Praktikum 2b


   private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        dispose();
}                                       

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        Hnpm.setText("");
        Hnama.setText("");
        Htelpon.setText("");
        Halamat.setText("");
        npm.setText("");
        nama.setText("");
        telpon.setText("");
}                                        


   private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        Hnpm.setText(npm.getText());
        Hnama.setText(nama.getText());
        Htelpon.setText(telpon.getText());
        Halamat.setText(telpon.getText());
} 

  • Praktikum 3
                 

 
                      


public class praktikum3 extends javax.swing.JFrame {
Integer a,b,c;
String hasil;

    /** Creates new form praktikum3 */


public praktikum3() {
       initComponents();
   }
   public void Pertambahan()
   {
       a = Integer.valueOf(nilai1.getText());
       b = Integer.valueOf(nilai2.getText());
       c = a+b;
               hasil = String.valueOf(c);
               nilai3.setText(hasil);
           }
        public void Pengurangan() {
       a = Integer.valueOf(nilai1.getText());
       b = Integer.valueOf(nilai2.getText());
       c = a - b;
       hasil = String.valueOf(c);
       nilai3.setText(hasil);
   }
    public void Perkalian() {
       a = Integer.valueOf(nilai1.getText());
       b = Integer.valueOf(nilai2.getText());
       c = a * b;
       hasil = String.valueOf(c);
                               nilai3.setText(hasil);
     }


public void Pembagian() {
      a = Integer.valueOf(nilai1.getText());
      b = Integer.valueOf(nilai2.getText());
      c = a / b;
      hasil = String.valueOf(c);
      nilai3.setText(hasil);
  }

  • Modul 4
 



private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                             // TODO add your handling code here:
        int a;
        String b;
        a=Integer.valueOf(nilai.getText());
        if (a>=60){
            ket.setText("LULUS");
        }else{


ket.setText("MENGULANG");
       }
   }                                       

   private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         // TODO add your handling code here:
       npm.setText("");
       nama.setText("");
       nilai.setText("");
       ket.setText("");
}    




private void ComboProsesActionPerformed(java.awt.event.ActionEvent evt) {                                     // TODO add your handling code here:
       int a;
       int b;
       int c;
       int d;
       int nilai;
       String Hasil;

       a=Integer.valueOf(absensi.getText());
       b=Integer.valueOf(tugas.getText());
       c=Integer.valueOf(uts.getText());
       d=Integer.valueOf(uas.getText());
       nilai=(a*10/100)+(b*20/100)+(c*30/100)+(d*40/100);
       Hasil=String.valueOf(nilai);
       angka.setText(Hasil);
       if (nilai>=80){
           huruf.setText("A");
           ket.setText("Sangat Memuaskan");
       }
       else if((nilai<79)&&(nilai>=70)){
       huruf.setText("B");
       ket.setText("Memuaskan");
   }
       else if((nilai<69)&&(nilai>=60)){
           huruf.setText("C");


                                                 ket.setText("Cukup");
       }else if ((nilai<59)&&(nilai>=50)){
           huruf.setText("D");
           ket.setText("Kurang");
       }else if ((nilai<49)&&(nilai>=00)){
           huruf.setText("E");
           ket.setText("Sangat Kurang");
       }
           }                                          

   private void ComboBatalActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
       npm.setText("");
       nama.setText("");
       absensi.setText("");
       tugas.setText("");
       uts.setText("");
       uas.setText("");
       angka.setText("");
       huruf.setText("");
       ket.setText("");
          }               

  • Modul 7 a

             

private void prosesActionPerformed(java.awt.event.ActionEvent evt) {                                      
       // TODO add your handling code here:
     int a,b;
       a = Integer.parseInt(text1.getText());
       for(b=10;b<=a;b+=10){
           hasil.append(b+".Kharisma"+"\n");
       }

  • Modul 7 b


private void prosesActionPerformed(java.awt.event.ActionEvent evt) {                                       
        // TODO add your handling code here:
        int a,b;
        a = Integer.parseInt(text1.getText());
        for(b=5;b>=a;b-=1){
            hasil.append(b+"\n");
        }
    }   

  • Modul 7 c                                  
 


private void prosesActionPerformed(java.awt.event.ActionEvent evt) {                                      
        // TODO add your handling code here:
        int a,b;
        a = Integer.parseInt(text1.getText());
        for(b=9;b<=a;b-=3){
            hasil.append(b+"\n");
        }

  • Modul 7 d 




private void prosesActionPerformed(java.awt.event.ActionEvent evt) {                                      
        // TODO add your handling code here:
        int a=1,b;
        int c=3;
        a = Integer.parseInt(text1.getText());
        for(b=1;b<=3;b++){
         for (b=3;b>=1;b--){
            hasil.append(b+"\n"+c);
        }

        }