Sie sind auf Seite 1von 6

/*

* 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.
*/
package igo;

/**
*
* @author ridwan
*/
public class uts_12165821_adji_neintyo_eigo extends javax.swing.JFrame {

/**
* Creates new form lapang_futsal
*/
public uts_12165821_adji_neintyo_eigo() {
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() {

nopes = new javax.swing.JLabel();


har = new javax.swing.JLabel();
napes = new javax.swing.JLabel();
nolap = new javax.swing.JLabel();
nalap = new javax.swing.JLabel();
hr = new javax.swing.JTextField();
tobe = new javax.swing.JTextField();
nape = new javax.swing.JTextField();
nal = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
nope = new javax.swing.JTextField();
ls = new javax.swing.JTextField();
tot = new javax.swing.JTextField();
pot = new javax.swing.JTextField();
kel = new javax.swing.JButton();
cmb = new javax.swing.JComboBox<>();
jLabel5 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

nopes.setText("No. Pemesanan");
getContentPane().add(nopes, new
org.netbeans.lib.awtextra.AbsoluteConstraints(10, 22, 93, 23));
har.setText("Harga");
getContentPane().add(har, new
org.netbeans.lib.awtextra.AbsoluteConstraints(10, 186, 93, 23));

napes.setText("Nama Pemesanan ");


getContentPane().add(napes, new
org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 93, 23));

nolap.setText("kode tiket");
getContentPane().add(nolap, new
org.netbeans.lib.awtextra.AbsoluteConstraints(10, 111, 93, 23));

nalap.setText("Nama Tiket");
getContentPane().add(nalap, new
org.netbeans.lib.awtextra.AbsoluteConstraints(10, 150, 93, 25));

hr.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
hrActionPerformed(evt);
}
});
getContentPane().add(hr, new
org.netbeans.lib.awtextra.AbsoluteConstraints(110, 190, 160, 30));

tobe.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
tobeActionPerformed(evt);
}
});
getContentPane().add(tobe, new
org.netbeans.lib.awtextra.AbsoluteConstraints(440, 150, 160, -1));

nape.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
napeActionPerformed(evt);
}
});
getContentPane().add(nape, new
org.netbeans.lib.awtextra.AbsoluteConstraints(110, 70, 160, -1));

nal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
nalActionPerformed(evt);
}
});
getContentPane().add(nal, new
org.netbeans.lib.awtextra.AbsoluteConstraints(110, 150, 160, 30));

jLabel1.setText("Total Bayar");
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(370, 150, 70, 20));

jLabel3.setText("Total");
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(370, 70, 70, 20));

jLabel4.setText("potongan");
getContentPane().add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(370, 110, 70, 20));
nope.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
nopeActionPerformed(evt);
}
});
getContentPane().add(nope, new
org.netbeans.lib.awtextra.AbsoluteConstraints(110, 30, 160, -1));

ls.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
lsActionPerformed(evt);
}
});
getContentPane().add(ls, new
org.netbeans.lib.awtextra.AbsoluteConstraints(440, 30, 110, -1));

tot.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
totActionPerformed(evt);
}
});
getContentPane().add(tot, new
org.netbeans.lib.awtextra.AbsoluteConstraints(440, 70, 160, -1));

pot.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
potActionPerformed(evt);
}
});
getContentPane().add(pot, new
org.netbeans.lib.awtextra.AbsoluteConstraints(440, 110, 160, -1));

kel.setText("keluar");
kel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
kelActionPerformed(evt);
}
});
getContentPane().add(kel, new
org.netbeans.lib.awtextra.AbsoluteConstraints(390, 230, -1, -1));

cmb.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "L1",


"L2", "L3" }));
cmb.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmbActionPerformed(evt);
}
});
getContentPane().add(cmb, new
org.netbeans.lib.awtextra.AbsoluteConstraints(110, 110, 90, -1));

jLabel5.setText("jumlah tiket");
getContentPane().add(jLabel5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(370, 30, 70, 20));

jPanel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N


jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel6.setText("PEMESANAN TIKET KERETA API");
jPanel1.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(79,
0, 440, -1));

getContentPane().add(jPanel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 640, 490));

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

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

// TODO add your handling code here:


}

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

// TODO add your handling code here:


}

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

// TODO add your handling code here:


}

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

// TODO add your handling code here:


}

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

// TODO add your handling code here:


nape.requestFocus();
}

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

// TODO add your handling code here:


double am= Double.parseDouble(hr.getText());
int lm=Integer.parseInt(ls.getText());
double lma= am*lm;
tot.setText(Double.toString(lma));
tobe.setText(Double.toString(lma));
if (lm>5){
double poto = lma*0.1;
pot.setText(Double.toString(poto));
double pto = lma-poto;
tobe.setText(Double.toString(pto));

}
else { pot.setText("0");
}
}

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

// TODO add your handling code here:


}

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

// TODO add your handling code here:


}

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

// TODO add your handling code here:


if (cmb.getSelectedItem().equals("L1")){
nal.setText("VIV");
hr.setText("60000");
}
else if (cmb.getSelectedItem().equals("L2")){
nal.setText("REGULER");
hr.setText("40000");
}
else if (cmb.getSelectedItem().equals("L3")){
nal.setText("EKONOMI");
hr.setText("30000"); }

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

// TODO add your handling code here:


System.exit(0);
}

/**
* @param args 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(uts_12165821_adji_neintyo_eigo.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(uts_12165821_adji_neintyo_eigo.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(uts_12165821_adji_neintyo_eigo.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(uts_12165821_adji_neintyo_eigo.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new uts_12165821_adji_neintyo_eigo().setVisible(true);
}
});
}

// Variables declaration - do not modify


private javax.swing.JComboBox<String> cmb;
private javax.swing.JLabel har;
private javax.swing.JTextField hr;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
private javax.swing.JButton kel;
private javax.swing.JTextField ls;
private javax.swing.JTextField nal;
private javax.swing.JLabel nalap;
private javax.swing.JTextField nape;
private javax.swing.JLabel napes;
private javax.swing.JLabel nolap;
private javax.swing.JTextField nope;
private javax.swing.JLabel nopes;
private javax.swing.JTextField pot;
private javax.swing.JTextField tobe;
private javax.swing.JTextField tot;
// End of variables declaration
}

Das könnte Ihnen auch gefallen