Design Tugas2 java1
Sabtu, 06 April 2013
TUGAS2 JAVA1
TUGAS2 JAVA 1
Mengenai : Aplikasi yang memuat combo box,ceklist,radio button,message dialog
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tugasjava1;
import javax.swing.JOptionPane;
/**
*
* @author acer
*/
public class Tugas2Java1 extends javax.swing.JFrame {
/**
* Creates new form Tugas2Java1
*/
public Tugas2Java1() {
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() {
buttonGroup1 = new javax.swing.ButtonGroup();
jFrame1 = new javax.swing.JFrame();
CbKP1 = new javax.swing.JComboBox();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
txtNP1 = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
RbPaket1 = new javax.swing.JRadioButton();
RbSatuan1 = new javax.swing.JRadioButton();
jLabel9 = new javax.swing.JLabel();
TxtHargaPel1 = new javax.swing.JTextField();
jCheckBox2 = new javax.swing.JCheckBox();
TxtDiskont1 = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
txtHasil1 = new javax.swing.JTextField();
BtnPesan1 = new javax.swing.JButton();
BtnError1 = new javax.swing.JButton();
BtnQuestion1 = new javax.swing.JButton();
CbKP = new javax.swing.JComboBox();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
txtNP = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
RbPaket = new javax.swing.JRadioButton();
RbSatuan = new javax.swing.JRadioButton();
jLabel4 = new javax.swing.JLabel();
TxtHargaPel = new javax.swing.JTextField();
jCheckBox1 = new javax.swing.JCheckBox();
TxtDiskont = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
txtHasil = new javax.swing.JTextField();
BtnPesan = new javax.swing.JButton();
BtnError = new javax.swing.JButton();
BtnQuestion = new javax.swing.JButton();
jFrame1.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
CbKP1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4" }));
CbKP1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CbKP1ActionPerformed(evt);
}
});
jLabel6.setText("Kode Pelayanan");
jLabel7.setText("Nama Pelayanan");
txtNP1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtNP1ActionPerformed(evt);
}
});
jLabel8.setText("Layanan");
RbPaket1.setText("Paket");
RbPaket1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RbPaket1ActionPerformed(evt);
}
});
RbSatuan1.setText("Satuan");
RbSatuan1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RbSatuan1ActionPerformed(evt);
}
});
jLabel9.setText("Harga Pelayanan");
TxtHargaPel1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TxtHargaPel1ActionPerformed(evt);
}
});
jCheckBox2.setText("Diskont 10%");
jCheckBox2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox2ActionPerformed(evt);
}
});
TxtDiskont1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TxtDiskont1ActionPerformed(evt);
}
});
jLabel10.setText("Harga Total");
BtnPesan1.setText("PESAN");
BtnPesan1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnPesan1ActionPerformed(evt);
}
});
BtnError1.setText("ERROR");
BtnError1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnError1ActionPerformed(evt);
}
});
BtnQuestion1.setText("QUESTION");
BtnQuestion1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnQuestion1ActionPerformed(evt);
}
});
javax.swing.GroupLayout jFrame1Layout = new javax.swing.GroupLayout(jFrame1.getContentPane());
jFrame1.getContentPane().setLayout(jFrame1Layout);
jFrame1Layout.setHorizontalGroup(
jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jFrame1Layout.createSequentialGroup()
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jFrame1Layout.createSequentialGroup()
.addGap(51, 51, 51)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jFrame1Layout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(RbSatuan1)
.addComponent(RbPaket1))
.addGap(4, 4, 4))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jFrame1Layout.createSequentialGroup()
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(TxtHargaPel1))
.addGroup(jFrame1Layout.createSequentialGroup()
.addComponent(jCheckBox2)
.addGap(19, 19, 19)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(BtnError1, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtDiskont1, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(jFrame1Layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jFrame1Layout.createSequentialGroup()
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7)
.addComponent(jLabel10))
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jFrame1Layout.createSequentialGroup()
.addGap(38, 38, 38)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtNP1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(CbKP1, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jFrame1Layout.createSequentialGroup()
.addGap(5, 5, 5)
.addComponent(txtHasil1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jFrame1Layout.createSequentialGroup()
.addComponent(BtnPesan1, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 164, Short.MAX_VALUE)
.addComponent(BtnQuestion1)))))
.addContainerGap(47, javax.swing.GroupLayout.PREFERRED_SIZE))
);
jFrame1Layout.setVerticalGroup(
jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jFrame1Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(CbKP1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6))
.addGap(18, 18, 18)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(txtNP1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(RbPaket1)
.addComponent(jLabel8))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(RbSatuan1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(TxtHargaPel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jCheckBox2)
.addComponent(TxtDiskont1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(txtHasil1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(BtnPesan1)
.addComponent(BtnError1)
.addComponent(BtnQuestion1))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
CbKP.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4" }));
CbKP.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CbKPActionPerformed(evt);
}
});
jLabel1.setText("Kode Pelayanan");
jLabel2.setText("Nama Pelayanan");
txtNP.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtNPActionPerformed(evt);
}
});
jLabel3.setText("Layanan");
RbPaket.setText("Paket");
RbPaket.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RbPaketActionPerformed(evt);
}
});
RbSatuan.setText("Satuan");
RbSatuan.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RbSatuanActionPerformed(evt);
}
});
jLabel4.setText("Harga Pelayanan");
TxtHargaPel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TxtHargaPelActionPerformed(evt);
}
});
jCheckBox1.setText("Diskont 10%");
jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox1ActionPerformed(evt);
}
});
TxtDiskont.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TxtDiskontActionPerformed(evt);
}
});
jLabel5.setText("Harga Total");
BtnPesan.setText("PESAN");
BtnPesan.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnPesanActionPerformed(evt);
}
});
BtnError.setText("ERROR");
BtnError.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnErrorActionPerformed(evt);
}
});
BtnQuestion.setText("QUESTION");
BtnQuestion.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnQuestionActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(51, 51, 51)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(RbSatuan)
.addComponent(RbPaket))
.addGap(4, 4, 4))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(TxtHargaPel))
.addGroup(layout.createSequentialGroup()
.addComponent(jCheckBox1)
.addGap(19, 19, 19)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(BtnError, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtDiskont, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jLabel5))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(38, 38, 38)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtNP, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(CbKP, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(5, 5, 5)
.addComponent(txtHasil, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(layout.createSequentialGroup()
.addComponent(BtnPesan, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 164, Short.MAX_VALUE)
.addComponent(BtnQuestion)))))
.addContainerGap(47, javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(CbKP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(txtNP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(RbPaket)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(RbSatuan)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(TxtHargaPel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jCheckBox1)
.addComponent(TxtDiskont, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(txtHasil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(BtnPesan)
.addComponent(BtnError)
.addComponent(BtnQuestion))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void CbKPActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(cbKP.getSelectedItem()=="1"){
NP.setText("gunting");
Hp.setText("25000");
}else if(cbKP.getSelectedItem()=="2"){
NP.setText("cuciblow");
HP.setText("20000");
}else if(cbKP.getSelectedItem()=="3"){
NP.setText("curly");
HP.setText("30000");
}else if(cbKP.getSelectedItem()=="4"){
Np.setText("spa");
HP.setText("50000")
}
}
private void TxtDiskontActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(diskont.isSelected()){
int HP =Integer.parseInt(HP.getText());
int diskont = HP*10%
int total = HP-diskont;
Diskont2.setText(""+diskon);
Hasil.setText(""+total);
}else{
hasil.setText(HP.getTex());
}
}
}
private void BtnPesanActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JOptionPane.showMessageDialog(null,"Silahkan Nomer Berikutnya", "Antrian",JOptionPane.INFORMATION_MESSAGE);
}
private void BtnErrorActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JOptionPane.showMessageDialog(null," Input Data Salah", "Input",JOptionPane.ERROR_MESSAGE);
}
private void BtnQuestionActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JOptionPane.showConfirmDialog(null, "akan selesai?", "Konfirmasi",JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
}
private void txtNPActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void TxtHargaPelActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void RbPaketActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(RbPaket.isSelected()){
txtRb.setText(""+RbPaket.getText());
}
}
private void RbSatuanActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(RbSatuan.isSelected()){
txtRb.setText(""RbSatuan.getText());
}
private void CbKP1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void txtNP1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void RbPaket1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void RbSatuan1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void TxtHargaPel1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void TxtDiskont1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void BtnPesan1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void BtnError1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void BtnQuestion1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @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(Tugas2Java1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Tugas2Java1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Tugas2Java1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Tugas2Java1.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 Tugas2Java1().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton BtnError;
private javax.swing.JButton BtnError1;
private javax.swing.JButton BtnPesan;
private javax.swing.JButton BtnPesan1;
private javax.swing.JButton BtnQuestion;
private javax.swing.JButton BtnQuestion1;
private javax.swing.JComboBox CbKP;
private javax.swing.JComboBox CbKP1;
private javax.swing.JRadioButton RbPaket;
private javax.swing.JRadioButton RbPaket1;
private javax.swing.JRadioButton RbSatuan;
private javax.swing.JRadioButton RbSatuan1;
private javax.swing.JTextField TxtDiskont;
private javax.swing.JTextField TxtDiskont1;
private javax.swing.JTextField TxtHargaPel;
private javax.swing.JTextField TxtHargaPel1;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JCheckBox jCheckBox2;
private javax.swing.JFrame jFrame1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JTextField txtHasil;
private javax.swing.JTextField txtHasil1;
private javax.swing.JTextField txtNP;
private javax.swing.JTextField txtNP1;
// End of variables declaration
}
Mengenai : Aplikasi yang memuat combo box,ceklist,radio button,message dialog
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tugasjava1;
import javax.swing.JOptionPane;
/**
*
* @author acer
*/
public class Tugas2Java1 extends javax.swing.JFrame {
/**
* Creates new form Tugas2Java1
*/
public Tugas2Java1() {
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() {
buttonGroup1 = new javax.swing.ButtonGroup();
jFrame1 = new javax.swing.JFrame();
CbKP1 = new javax.swing.JComboBox();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
txtNP1 = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
RbPaket1 = new javax.swing.JRadioButton();
RbSatuan1 = new javax.swing.JRadioButton();
jLabel9 = new javax.swing.JLabel();
TxtHargaPel1 = new javax.swing.JTextField();
jCheckBox2 = new javax.swing.JCheckBox();
TxtDiskont1 = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
txtHasil1 = new javax.swing.JTextField();
BtnPesan1 = new javax.swing.JButton();
BtnError1 = new javax.swing.JButton();
BtnQuestion1 = new javax.swing.JButton();
CbKP = new javax.swing.JComboBox();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
txtNP = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
RbPaket = new javax.swing.JRadioButton();
RbSatuan = new javax.swing.JRadioButton();
jLabel4 = new javax.swing.JLabel();
TxtHargaPel = new javax.swing.JTextField();
jCheckBox1 = new javax.swing.JCheckBox();
TxtDiskont = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
txtHasil = new javax.swing.JTextField();
BtnPesan = new javax.swing.JButton();
BtnError = new javax.swing.JButton();
BtnQuestion = new javax.swing.JButton();
jFrame1.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
CbKP1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4" }));
CbKP1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CbKP1ActionPerformed(evt);
}
});
jLabel6.setText("Kode Pelayanan");
jLabel7.setText("Nama Pelayanan");
txtNP1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtNP1ActionPerformed(evt);
}
});
jLabel8.setText("Layanan");
RbPaket1.setText("Paket");
RbPaket1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RbPaket1ActionPerformed(evt);
}
});
RbSatuan1.setText("Satuan");
RbSatuan1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RbSatuan1ActionPerformed(evt);
}
});
jLabel9.setText("Harga Pelayanan");
TxtHargaPel1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TxtHargaPel1ActionPerformed(evt);
}
});
jCheckBox2.setText("Diskont 10%");
jCheckBox2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox2ActionPerformed(evt);
}
});
TxtDiskont1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TxtDiskont1ActionPerformed(evt);
}
});
jLabel10.setText("Harga Total");
BtnPesan1.setText("PESAN");
BtnPesan1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnPesan1ActionPerformed(evt);
}
});
BtnError1.setText("ERROR");
BtnError1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnError1ActionPerformed(evt);
}
});
BtnQuestion1.setText("QUESTION");
BtnQuestion1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnQuestion1ActionPerformed(evt);
}
});
javax.swing.GroupLayout jFrame1Layout = new javax.swing.GroupLayout(jFrame1.getContentPane());
jFrame1.getContentPane().setLayout(jFrame1Layout);
jFrame1Layout.setHorizontalGroup(
jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jFrame1Layout.createSequentialGroup()
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jFrame1Layout.createSequentialGroup()
.addGap(51, 51, 51)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jFrame1Layout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(RbSatuan1)
.addComponent(RbPaket1))
.addGap(4, 4, 4))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jFrame1Layout.createSequentialGroup()
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(TxtHargaPel1))
.addGroup(jFrame1Layout.createSequentialGroup()
.addComponent(jCheckBox2)
.addGap(19, 19, 19)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(BtnError1, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtDiskont1, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(jFrame1Layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jFrame1Layout.createSequentialGroup()
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7)
.addComponent(jLabel10))
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jFrame1Layout.createSequentialGroup()
.addGap(38, 38, 38)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtNP1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(CbKP1, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jFrame1Layout.createSequentialGroup()
.addGap(5, 5, 5)
.addComponent(txtHasil1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jFrame1Layout.createSequentialGroup()
.addComponent(BtnPesan1, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 164, Short.MAX_VALUE)
.addComponent(BtnQuestion1)))))
.addContainerGap(47, javax.swing.GroupLayout.PREFERRED_SIZE))
);
jFrame1Layout.setVerticalGroup(
jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jFrame1Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(CbKP1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6))
.addGap(18, 18, 18)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(txtNP1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(RbPaket1)
.addComponent(jLabel8))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(RbSatuan1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(TxtHargaPel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jCheckBox2)
.addComponent(TxtDiskont1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(txtHasil1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(BtnPesan1)
.addComponent(BtnError1)
.addComponent(BtnQuestion1))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
CbKP.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4" }));
CbKP.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CbKPActionPerformed(evt);
}
});
jLabel1.setText("Kode Pelayanan");
jLabel2.setText("Nama Pelayanan");
txtNP.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtNPActionPerformed(evt);
}
});
jLabel3.setText("Layanan");
RbPaket.setText("Paket");
RbPaket.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RbPaketActionPerformed(evt);
}
});
RbSatuan.setText("Satuan");
RbSatuan.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RbSatuanActionPerformed(evt);
}
});
jLabel4.setText("Harga Pelayanan");
TxtHargaPel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TxtHargaPelActionPerformed(evt);
}
});
jCheckBox1.setText("Diskont 10%");
jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox1ActionPerformed(evt);
}
});
TxtDiskont.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TxtDiskontActionPerformed(evt);
}
});
jLabel5.setText("Harga Total");
BtnPesan.setText("PESAN");
BtnPesan.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnPesanActionPerformed(evt);
}
});
BtnError.setText("ERROR");
BtnError.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnErrorActionPerformed(evt);
}
});
BtnQuestion.setText("QUESTION");
BtnQuestion.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnQuestionActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(51, 51, 51)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(RbSatuan)
.addComponent(RbPaket))
.addGap(4, 4, 4))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(TxtHargaPel))
.addGroup(layout.createSequentialGroup()
.addComponent(jCheckBox1)
.addGap(19, 19, 19)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(BtnError, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtDiskont, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jLabel5))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(38, 38, 38)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtNP, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(CbKP, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(5, 5, 5)
.addComponent(txtHasil, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(layout.createSequentialGroup()
.addComponent(BtnPesan, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 164, Short.MAX_VALUE)
.addComponent(BtnQuestion)))))
.addContainerGap(47, javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(CbKP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(txtNP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(RbPaket)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(RbSatuan)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(TxtHargaPel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jCheckBox1)
.addComponent(TxtDiskont, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(txtHasil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(BtnPesan)
.addComponent(BtnError)
.addComponent(BtnQuestion))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void CbKPActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(cbKP.getSelectedItem()=="1"){
NP.setText("gunting");
Hp.setText("25000");
}else if(cbKP.getSelectedItem()=="2"){
NP.setText("cuciblow");
HP.setText("20000");
}else if(cbKP.getSelectedItem()=="3"){
NP.setText("curly");
HP.setText("30000");
}else if(cbKP.getSelectedItem()=="4"){
Np.setText("spa");
HP.setText("50000")
}
}
private void TxtDiskontActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(diskont.isSelected()){
int HP =Integer.parseInt(HP.getText());
int diskont = HP*10%
int total = HP-diskont;
Diskont2.setText(""+diskon);
Hasil.setText(""+total);
}else{
hasil.setText(HP.getTex());
}
}
}
private void BtnPesanActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JOptionPane.showMessageDialog(null,"Silahkan Nomer Berikutnya", "Antrian",JOptionPane.INFORMATION_MESSAGE);
}
private void BtnErrorActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JOptionPane.showMessageDialog(null," Input Data Salah", "Input",JOptionPane.ERROR_MESSAGE);
}
private void BtnQuestionActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JOptionPane.showConfirmDialog(null, "akan selesai?", "Konfirmasi",JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
}
private void txtNPActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void TxtHargaPelActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void RbPaketActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(RbPaket.isSelected()){
txtRb.setText(""+RbPaket.getText());
}
}
private void RbSatuanActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(RbSatuan.isSelected()){
txtRb.setText(""RbSatuan.getText());
}
private void CbKP1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void txtNP1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void RbPaket1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void RbSatuan1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void TxtHargaPel1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void TxtDiskont1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void BtnPesan1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void BtnError1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void BtnQuestion1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @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(Tugas2Java1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Tugas2Java1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Tugas2Java1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Tugas2Java1.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 Tugas2Java1().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton BtnError;
private javax.swing.JButton BtnError1;
private javax.swing.JButton BtnPesan;
private javax.swing.JButton BtnPesan1;
private javax.swing.JButton BtnQuestion;
private javax.swing.JButton BtnQuestion1;
private javax.swing.JComboBox CbKP;
private javax.swing.JComboBox CbKP1;
private javax.swing.JRadioButton RbPaket;
private javax.swing.JRadioButton RbPaket1;
private javax.swing.JRadioButton RbSatuan;
private javax.swing.JRadioButton RbSatuan1;
private javax.swing.JTextField TxtDiskont;
private javax.swing.JTextField TxtDiskont1;
private javax.swing.JTextField TxtHargaPel;
private javax.swing.JTextField TxtHargaPel1;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JCheckBox jCheckBox2;
private javax.swing.JFrame jFrame1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JTextField txtHasil;
private javax.swing.JTextField txtHasil1;
private javax.swing.JTextField txtNP;
private javax.swing.JTextField txtNP1;
// End of variables declaration
}
Langganan:
Postingan (Atom)