APLIKASI KONVERSI MATA UANG (NETBEANS)

Aplikasi Konversi Mata Uang menggunakan Java Netbeans 

 ⇉Deskripsi
Pengertian konversi mata uang adalah suatu perubahan yang terjadi pada nilai tukar mata uang suatu negara terhadap mata uang negara lainnya. Setiap mata uang memiliki nilai tukar yang berbeda-beda dan akan terus berubah. Terinspirasi dari hal tersebut, saya mencoba membuat program yang dapat mengkonversi beberapa mata uang, seperti mata uang rupiah ke dolar, MYR, dan SGD. Jadi ketika masing-masing nilai mata uang berubah, program yang Saya buat tidak mengikuti update perubahan tersebut. Untuk lebih jelasnya, berikut ini cara membuat program konversi mata uang menggunakan Java NetBeans: 

⇉ Komponen, Variabel, dan Rumus Formula

1. Rupiah
2. Dollar 
3. MYR
4. SGD

↠Hasil Run (Output)

Berikut adalah gambar screen shot Hasil Run (Output).




Source Code

Berikut adalah sourch code Program aplikasi Konversi Mata Uang yang saya buat.

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author bagus
 */
public class KOVERSI_MATA_UANG_DESAIN extends javax.swing.JFrame {

/**
* Creates new form KOVERSI_MATA_UANG_DESAIN
*/
public KOVERSI_MATA_UANG_DESAIN() {
initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed"desc="Generated Code">
private void initComponents() {

        jCheckBox1 = new javax.swing.JCheckBox();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
Usd = new javax.swing.JTextField();
Sgd = new javax.swing.JTextField();
Myr = new javax.swing.JTextField();
        Rupiah = new javax.swing.JTextField();
        KONVERSI = new javax.swing.JButton();
        CLEAR = new javax.swing.JButton();

jCheckBox1.setText("jCheckBox1");

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setFont(new java.awt.Font("Sitka Subheading", 3, 24)); // NOI18N
jLabel1.setForeground(new java.awt.Color(0, 153, 255));
jLabel1.setText("KONVERSI MATA UANG");

jLabel2.setForeground(new java.awt.Color(0, 153, 204));
jLabel2.setText("Rupiah");

jLabel3.setForeground(new java.awt.Color(0, 153, 204));
jLabel3.setText("DolllarAmerika");

jLabel4.setForeground(new java.awt.Color(0, 153, 204));
jLabel4.setText("MYR Malaysia");

jLabel5.setForeground(new java.awt.Color(0, 153, 204));
jLabel5.setText("SGD Malaysia");

Usd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEventevt) {
UsdActionPerformed(evt);
            }
        });

Sgd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEventevt) {
SgdActionPerformed(evt);
            }
        });

Myr.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEventevt) {
MyrActionPerformed(evt);
            }
        });

Rupiah.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEventevt) {
RupiahActionPerformed(evt);
            }
        });

KONVERSI.setForeground(new java.awt.Color(0, 153, 255));
KONVERSI.setText("KONVERSI");
KONVERSI.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEventevt) {
KONVERSIActionPerformed(evt);
            }
        });

CLEAR.setForeground(new java.awt.Color(0, 153, 204));
CLEAR.setText("CLEAR");
CLEAR.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEventevt) {
CLEARActionPerformed(evt);
            }
        });

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel1)
                .addGap(47, 47, 47))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(61, 61, 61)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(KONVERSI)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(CLEAR, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(37, 37, 37)
                                .addComponent(Myr))))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(Sgd, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel2))
                        .addGap(32, 32, 32)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(Rupiah, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(Usd, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addGap(58, 58, 58))
        );
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(31, 31, 31)
                .addComponent(jLabel1)
                .addGap(32, 32, 32)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(Rupiah, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(KONVERSI)
                    .addComponent(CLEAR))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(Usd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(43, 43, 43)
                                .addComponent(jLabel4))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(40, 40, 40)
                                .addComponent(Myr, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(Sgd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5))))
                .addGap(66, 66, 66))
        );

pack();
    }// </editor-fold>

private void KONVERSIActionPerformed(java.awt.event.ActionEventevt) {                                        
        // TODO add your handling code here:
float RUPIAH=Integer.parseInt(Rupiah.getText());
Usd.setText(""+RUPIAH*0.000096);
Myr.setText(""+RUPIAH*0.00094);
Sgd.setText(""+RUPIAH*0.000096);
    }                                       

private void RupiahActionPerformed(java.awt.event.ActionEventevt) {                                      
        // TODO add your handling code here:
    }                                     

private void MyrActionPerformed(java.awt.event.ActionEventevt) {                                    
        // TODO add your handling code here:
    }                                  

private void SgdActionPerformed(java.awt.event.ActionEventevt) {                                   
        // TODO add your handling code here:
    }                                  

private void UsdActionPerformed(java.awt.event.ActionEventevt) {                                   
        // TODO add your handling code here:
    }                                  

private void CLEARActionPerformed(java.awt.event.ActionEventevt) {                                     
        // TODO add your handling code here:
Usd.setText("");
Myr.setText("");
Sgd.setText("");
    }                                    

    /**
     * @paramargs the command line arguments
     */
public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed"desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
                }
            }
        } catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(KOVERSI_MATA_UANG_DESAIN.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(KOVERSI_MATA_UANG_DESAIN.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(KOVERSI_MATA_UANG_DESAIN.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(KOVERSI_MATA_UANG_DESAIN.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new KOVERSI_MATA_UANG_DESAIN().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                    
privatejavax.swing.JButton CLEAR;
privatejavax.swing.JButton KONVERSI;
privatejavax.swing.JTextFieldMyr;
privatejavax.swing.JTextField Rupiah;
privatejavax.swing.JTextFieldSgd;
privatejavax.swing.JTextFieldUsd;
privatejavax.swing.JCheckBox jCheckBox1;
privatejavax.swing.JLabel jLabel1;
privatejavax.swing.JLabel jLabel2;
privatejavax.swing.JLabel jLabel3;
privatejavax.swing.JLabel jLabel4;
privatejavax.swing.JLabel jLabel5;
    // End of variables declaration                  
}


Penjelasan :

1. Isi nominal  di kolom mata uang Rupiah.
2. Klik button Konversi. 
3. Maka Hasil akan keluar di setiap kolom Mata uang asing


Sekian Dan Terima Kasih.

Comments

Popular posts from this blog

KONVERSI NILAI MATA UANG MENGGUNAKAN JAVA NETBEANS