Sei sulla pagina 1di 11

Program rumah sakit enggal saras

/*
* 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 latihan_tugas1;
import javax.swing.JOptionPane;
/**
*
* @author semangat
*/
public class Rumah_sakit_enggal_saras extends javax.swing.JFrame {
/**
* Creates new form Rumah_sakit_enggal_saras
*/
public Rumah_sakit_enggal_saras() {
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() {
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();
cmbkode = new javax.swing.JComboBox<>();
enama = new javax.swing.JTextField();
espesialis = new javax.swing.JTextField();
ebyperiksa = new javax.swing.JTextField();
jPanel1 = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
enmobt = new javax.swing.JTextField();
ehrgobt = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
cmbobat = new javax.swing.JComboBox<>();
eubay = new javax.swing.JTextField();
ekembali = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();

bkeluar = new javax.swing.JButton();


btotalbayar = new javax.swing.JButton();
bbersih = new javax.swing.JButton();
etobay = new javax.swing.JTextField();
bhitung = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(0, 51, 255));
addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
hitung(evt);
}
});
jLabel1.setBackground(new java.awt.Color(255, 0, 0));
jLabel1.setFont(new java.awt.Font("Old English Text MT", 0, 36)); // NOI18N
jLabel1.setText("Rumah Sakit Enggal Saras");
jLabel2.setFont(new java.awt.Font("Baskerville Old Face", 1, 14)); // NOI18N
jLabel2.setText("Kode Dokter");
jLabel3.setFont(new java.awt.Font("Baskerville Old Face", 1, 14)); // NOI18N
jLabel3.setText("Nama Dokter");
jLabel4.setFont(new java.awt.Font("Baskerville Old Face", 1, 14)); // NOI18N
jLabel4.setText("Specialist");
jLabel5.setFont(new java.awt.Font("Baskerville Old Face", 1, 14)); // NOI18N
jLabel5.setText("Biaya Periksa");
cmbkode.setBackground(new java.awt.Color(255, 51, 255));
cmbkode.setModel(new javax.swing.DefaultComboBoxModel<>(new
String[] { "<=<=PILIH=>=>", "DRJ01", "DRA02", "DRM03" }));
cmbkode.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmbkodeActionPerformed(evt);
}
});
enama.setName(""); // NOI18N
jPanel1.setBackground(new java.awt.Color(255, 51, 0));
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Data
Obat"));
jPanel1.setLayout(null);
jLabel6.setText("Kode Obat");
jPanel1.add(jLabel6);
jLabel6.setBounds(11, 24, 70, 14);
jPanel1.add(enmobt);

enmobt.setBounds(80, 50, 120, 20);


jPanel1.add(ehrgobt);
ehrgobt.setBounds(80, 80, 120, 20);
jLabel7.setText("Nama Obat");
jPanel1.add(jLabel7);
jLabel7.setBounds(10, 50, 90, 14);
jLabel8.setText("Harga Obat");
jPanel1.add(jLabel8);
jLabel8.setBounds(10, 80, 70, 14);
cmbobat.setBackground(new java.awt.Color(0, 153, 51));
cmbobat.setModel(new javax.swing.DefaultComboBoxModel<>(new
String[] { "<=<=PILIH=>=>", "OBT01", "OBT02", "OBT03" }));
cmbobat.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmbobatActionPerformed(evt);
}
});
jPanel1.add(cmbobat);
cmbobat.setBounds(80, 20, 115, 20);
eubay.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
eubayActionPerformed(evt);
}
});
ekembali.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ekembaliActionPerformed(evt);
}
});
jLabel9.setText("Uang Bayar");
jLabel10.setText("Kembalian");
bkeluar.setBackground(new java.awt.Color(255, 0, 0));
bkeluar.setText("Keluar");
bkeluar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bkeluarActionPerformed(evt);
}
});
btotalbayar.setBackground(new java.awt.Color(0, 0, 204));
btotalbayar.setText("Total Bayar");
btotalbayar.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {


btotalbayarActionPerformed(evt);
}
});
bbersih.setBackground(new java.awt.Color(51, 255, 0));
bbersih.setText("Bersih");
bbersih.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bbersihActionPerformed(evt);
}
});
etobay.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
etobayActionPerformed(evt);
}
});
bhitung.setBackground(new java.awt.Color(255, 255, 0));
bhitung.setText("Hitung");
bhitung.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bhitungActionPerformed(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.LEADI
NG)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addGroup(layout.createSequentialGroup()
.addGap(90, 90, 90)
.addComponent(etobay,
javax.swing.GroupLayout.PREFERRED_SIZE, 119,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(106, 106, 106)
.addComponent(btotalbayar))
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(bbersih))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG, false)
.addComponent(enama)
.addComponent(espesialis)
.addComponent(ebyperiksa)
.addComponent(cmbkode,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(84, 84, 84)
.addComponent(bkeluar)))))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(eubay,
javax.swing.GroupLayout.PREFERRED_SIZE, 122,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel10)
.addGap(18, 18, 18)
.addComponent(ekembali,
javax.swing.GroupLayout.PREFERRED_SIZE, 122,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(55, 55, 55)
.addComponent(bhitung))
.addComponent(jPanel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 210,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()

.addGap(32, 32, 32)


.addComponent(jLabel1)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(cmbkode,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGap(3, 3, 3)
.addComponent(jLabel2,
javax.swing.GroupLayout.PREFERRED_SIZE, 10,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(jLabel3)
.addComponent(enama,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)
.addComponent(jLabel4)
.addComponent(espesialis,
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.BASEL
INE)
.addComponent(ebyperiksa,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)))
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
108, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(6, 6, 6)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)
.addComponent(bhitung)
.addComponent(btotalbayar))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)
.addComponent(eubay,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9))
.addComponent(etobay, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)
.addComponent(jLabel10)
.addComponent(ekembali,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(11, 11, 11)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addComponent(bkeluar)
.addComponent(bbersih))))
.addContainerGap(36, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void bkeluarActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//<=<=<=<=<= Coding Button Keluar =>=>=>=>=>
int answer = JOptionPane.showConfirmDialog
(null,"Yakin Ingin Keluar??..","Informasi",JOptionPane.YES_NO_OPTION);
if (answer==JOptionPane.YES_OPTION){
dispose();
}
else{
return;
}
}
private void ekembaliActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void cmbkodeActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//<=<=<=<=<= Coding untuk JComboBox(Kode Dokter)=>=>=>=>=>
if (cmbkode.getSelectedItem().equals("DRJ01")){
enama.setText("RAFFA");
espesialis.setText("JANTUNG");
ebyperiksa.setText("200000");
}
else if (cmbkode.getSelectedItem().equals("DRA02")){
enama.setText("SHELIA ANISA");
espesialis.setText("ANAK");
ebyperiksa.setText("150000");
}
else if (cmbkode.getSelectedItem().equals("DRM03")){
enama.setText("PUTRI");
espesialis.setText("MATA");
ebyperiksa.setText("125000");
}
}
private void cmbobatActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:

//<=<=<=<=<= Coding untuk JComboBox(Kode Obat)=>=>=>=>=>


if (cmbobat.getSelectedItem().equals("OBT01")){
enmobt.setText("OBAT CAPSUL");
ehrgobt.setText("250000");
}
else if (cmbobat.getSelectedItem().equals("OBT02")){
enmobt.setText("OBAT SIRUP");
ehrgobt.setText("150000");
}
else if (cmbobat.getSelectedItem().equals("OBT03")){
enmobt.setText("OBAT PUYER");
ehrgobt.setText("125000");
}
}
private void etobayActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void btotalbayarActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//<=<=<=<=<= Coding untuk Button total bayar=>=>=>=>=>
double byperiksa;
double hrobat;
double nilai;
String hasil;
byperiksa=Integer.valueOf(ebyperiksa.getText());
hrobat=Integer.valueOf(ehrgobt.getText());
nilai= byperiksa + hrobat ;
hasil = String.valueOf(nilai);
etobay.setText(hasil);
}
private void eubayActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void bbersihActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//<=<=<=<=<= Coding untuk Button Bersih =>=>=>=>=>
cmbkode.setSelectedIndex(0);
enama.setText("");
espesialis.setText("");
ebyperiksa.setText("");
cmbobat.setSelectedIndex(0);
enmobt.setText("");
ehrgobt.setText("");

etobay.setText("");
eubay.setText("");
ekembali.setText("");
}
private void bhitungActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//<=<=<=<=<= Coding untuk Button hitung =>=>=>=>=>
double biayaperiksa;
double hargaobat;
double uangbayar;
double nilai;
String hasil;
biayaperiksa=Integer.valueOf(ebyperiksa.getText());
hargaobat=Integer.valueOf(ehrgobt.getText());
uangbayar=Integer.valueOf(eubay.getText());
nilai= uangbayar - (biayaperiksa + hargaobat);
hasil = String.valueOf(nilai);
ekembali.setText(hasil);
}
private void hitung(java.awt.event.KeyEvent 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(Rumah_sakit_enggal_saras.class.getName()).l
og(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Rumah_sakit_enggal_saras.class.getName()).l
og(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Rumah_sakit_enggal_saras.class.getName()).l
og(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Rumah_sakit_enggal_saras.class.getName()).l
og(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Rumah_sakit_enggal_saras().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton bbersih;
private javax.swing.JButton bhitung;
private javax.swing.JButton bkeluar;
private javax.swing.JButton btotalbayar;
private javax.swing.JComboBox<String> cmbkode;
private javax.swing.JComboBox<String> cmbobat;
private javax.swing.JTextField ebyperiksa;
private javax.swing.JTextField ehrgobt;
private javax.swing.JTextField ekembali;
private javax.swing.JTextField enama;
private javax.swing.JTextField enmobt;
private javax.swing.JTextField espesialis;
private javax.swing.JTextField etobay;
private javax.swing.JTextField eubay;
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.JPanel jPanel1;
// End of variables declaration
}

Potrebbero piacerti anche