Anda di halaman 1dari 19

/*

* 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 learn;

/**
*
* @author Dell
*/
public class pblgui extends javax.swing.JFrame {

/**
* Creates new form pblgui
*/
public pblgui() {

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")
double total;
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

MAKANAN = new javax.swing.JLabel();

MINUMAN = new javax.swing.JLabel();


LNASI = new javax.swing.JLabel();
LAYAM = new javax.swing.JLabel();
LIKAN = new javax.swing.JLabel();
LDAGING = new javax.swing.JLabel();
LSAYUR = new javax.swing.JLabel();
LSIRAP = new javax.swing.JLabel();
LTEH = new javax.swing.JLabel();
LMILO = new javax.swing.JLabel();
LKOPI = new javax.swing.JLabel();
LAIS = new javax.swing.JLabel();
NASI = new javax.swing.JTextField();
SIRAP = new javax.swing.JTextField();
AYAM = new javax.swing.JTextField();
DAGING = new javax.swing.JTextField();
IKAN = new javax.swing.JTextField();
KOPI = new javax.swing.JTextField();
SAYUR = new javax.swing.JTextField();
TEH = new javax.swing.JTextField();
AIS = new javax.swing.JTextField();
MILO = new javax.swing.JTextField();
BJUMLAH = new javax.swing.JButton();
JUMLAH = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
BAKI = new javax.swing.JButton();
BAKINYA = new javax.swing.JLabel();
BERI = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
CLEAR = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setAlwaysOnTop(true);
setMinimumSize(new java.awt.Dimension(520, 470));

MAKANAN.setBackground(new java.awt.Color(51, 51, 0));


MAKANAN.setText("MAKANAN");

MINUMAN.setText("MINUMAN");

LNASI.setText("NASI");

LAYAM.setText("AYAM");

LIKAN.setText("IKAN");

LDAGING.setText("DAGING");

LSAYUR.setText("SAYUR");

LSIRAP.setText("SIRAP");

LTEH.setText("TEH O AIS");

LMILO.setText("MILO");

LKOPI.setText("KOPI");

LAIS.setText("AIS KOSONG");

NASI.setText("0");
NASI.setMinimumSize(new java.awt.Dimension(6, 25));
NASI.addActionListener(new java.awt.event.ActionListener() {

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


NASIActionPerformed(evt);
}
});

SIRAP.setText("0");
SIRAP.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SIRAPActionPerformed(evt);
}
});

AYAM.setText("0");
AYAM.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AYAMActionPerformed(evt);
}
});

DAGING.setText("0");
DAGING.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
DAGINGActionPerformed(evt);
}
});

IKAN.setText("0");
IKAN.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
IKANActionPerformed(evt);
}
});

KOPI.setText("0");
KOPI.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
KOPIActionPerformed(evt);
}
});

SAYUR.setText("0");
SAYUR.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SAYURActionPerformed(evt);
}
});

TEH.setText("0");
TEH.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TEHActionPerformed(evt);
}
});

AIS.setText("0");
AIS.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AISActionPerformed(evt);
}
});

MILO.setText("0");
MILO.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {

MILOActionPerformed(evt);
}
});

BJUMLAH.setText("JUMLAH");
BJUMLAH.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BJUMLAHActionPerformed(evt);
}
});

JUMLAH.setText("RM ");

jPanel1.setBackground(new java.awt.Color(204, 204, 204));


jPanel1.setBorder(new javax.swing.border.MatteBorder(null));

jLabel2.setText("WANG DIBERI (RM) :");

BAKI.setText("WANG BAKI :");


BAKI.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BAKIActionPerformed(evt);
}
});

BAKINYA.setText("RM");

jLabel1.setFont(new java.awt.Font("Arial", 3, 12)); // NOI18N


jLabel1.setText("KIRAAN");
jLabel1.setBorder(new
javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

javax.swing.GroupLayout jPanel1Layout = new


javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2)
.addGap(18, 18, 18)
.addComponent(BERI, javax.swing.GroupLayout.PREFERRED_SIZE,
80, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(80, 80, 80)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.LEADING)
.addComponent(BAKI)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(BAKINYA)))))
.addContainerGap(33, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(90, 90, 90))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.BASELINE)
.addComponent(jLabel2)
.addComponent(BERI, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(BAKI)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(BAKINYA)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);

CLEAR.setText("PESANAN BARU");
CLEAR.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CLEARActionPerformed(evt);
}
});

jLabel4.setFont(new java.awt.Font("Tahoma", 3, 12)); // NOI18N


jLabel4.setText("MESIN KIRA KIRA MAMAK");

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);

layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(130, 130, 130)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE,
200, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(50, 50, 50)
.addComponent(MAKANAN)
.addGap(171, 171, 171)
.addComponent(MINUMAN))
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(LNASI)
.addGap(81, 81, 81)
.addComponent(NASI, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(75, 75, 75)
.addComponent(LSIRAP, javax.swing.GroupLayout.PREFERRED_SIZE,
49, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(85, 85, 85)
.addComponent(SIRAP, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(LAYAM)
.addGap(77, 77, 77)
.addComponent(AYAM, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(74, 74, 74)
.addComponent(LTEH)
.addGap(85, 85, 85)
.addComponent(TEH, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(LIKAN)
.addGap(81, 81, 81)
.addComponent(IKAN, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(74, 74, 74)
.addComponent(LMILO)
.addGap(110, 110, 110)
.addComponent(MILO, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addGroup(layout.createSequentialGroup()
.addGap(105, 105, 105)
.addComponent(DAGING,
javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(LDAGING,
javax.swing.GroupLayout.PREFERRED_SIZE, 122,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(75, 75, 75)
.addComponent(LKOPI)
.addGap(110, 110, 110)
.addComponent(KOPI, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(LSAYUR)
.addGap(72, 72, 72)
.addComponent(SAYUR, javax.swing.GroupLayout.PREFERRED_SIZE,
32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(75, 75, 75)

.addComponent(LAIS)
.addGap(72, 72, 72)
.addComponent(AIS, javax.swing.GroupLayout.PREFERRED_SIZE, 31,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(148, 148, 148)
.addComponent(CLEAR))
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(BJUMLAH))
.addComponent(JUMLAH,
javax.swing.GroupLayout.PREFERRED_SIZE, 71,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(69, 69, 69)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE,
20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(MAKANAN)
.addComponent(MINUMAN))
.addGap(15, 15, 15)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(LNASI)
.addComponent(NASI, javax.swing.GroupLayout.PREFERRED_SIZE,
25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(LSIRAP)
.addComponent(SIRAP, javax.swing.GroupLayout.PREFERRED_SIZE,
25, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(AYAM, javax.swing.GroupLayout.PREFERRED_SIZE,
25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TEH, javax.swing.GroupLayout.PREFERRED_SIZE,
25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGap(5, 5, 5)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(LAYAM)
.addComponent(LTEH))))
.addGap(22, 22, 22)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(IKAN, javax.swing.GroupLayout.PREFERRED_SIZE,
25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(MILO, javax.swing.GroupLayout.PREFERRED_SIZE,
25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGap(5, 5, 5)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(LIKAN)

.addComponent(LMILO))))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(DAGING,
javax.swing.GroupLayout.PREFERRED_SIZE, 25,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(KOPI, javax.swing.GroupLayout.PREFERRED_SIZE,
25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGap(5, 5, 5)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(LDAGING)
.addComponent(LKOPI))))
.addGap(25, 25, 25)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(SAYUR, javax.swing.GroupLayout.PREFERRED_SIZE,
25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(AIS, javax.swing.GroupLayout.PREFERRED_SIZE, 25,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGap(5, 5, 5)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(LSAYUR)
.addComponent(LAIS))))
.addGap(11, 11, 11)
.addComponent(CLEAR)
.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addGroup(layout.createSequentialGroup()
.addGap(1, 1, 1)
.addComponent(BJUMLAH)
.addGap(10, 10, 10)
.addComponent(JUMLAH,
javax.swing.GroupLayout.PREFERRED_SIZE, 22,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
122, javax.swing.GroupLayout.PREFERRED_SIZE)))
);

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

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


// TODO add your handling code here:
}

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


// TODO add your handling code here:
}

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


// TODO add your handling code here:
}

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


// TODO add your handling code here:
}

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

// TODO add your handling code here:


}

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


// TODO add your handling code here:
}

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


// TODO add your handling code here:
}

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


// TODO add your handling code here:
}

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


// TODO add your handling code here:
}

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


// TODO add your handling code here:
}

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


// TODO add your handling code here:
int a, b, c, d, e, f, g, h, i, j;
a = (int)((Double.parseDouble(AIS.getText())));
b = (int)((Double.parseDouble(AYAM.getText())));
c = (int)((Double.parseDouble(DAGING.getText())));
d = (int)((Double.parseDouble(IKAN.getText())));
e = (int)((Double.parseDouble(KOPI.getText())));
f = (int)((Double.parseDouble(MILO.getText())));

g = (int)((Double.parseDouble(NASI.getText())));
h = (int)((Double.parseDouble(SAYUR.getText())));
i = (int)((Double.parseDouble(SIRAP.getText())));
j = (int)((Double.parseDouble(TEH.getText())));

total = ((0.50*a)+(2.50*b)+(2.00*c)+(3.00*d)+(2.00*e)
+(2.00*f)+(1.00*g)+(1.50*h)+(1.50*i)+(1.50*j));

JUMLAH.setText("RM " + total );


}

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


// TODO add your handling code here:
AIS.setText("0");
AYAM.setText("0");
DAGING.setText("0");
IKAN.setText("0");
KOPI.setText("0");
MILO.setText("0");
NASI.setText("0");
SAYUR.setText("0");
SIRAP.setText("0");
TEH.setText("0");
JUMLAH.setText("RM");
BERI.setText("");
}

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


// TODO add your handling code here:
double x = (int)((Double.parseDouble(BERI.getText())));
double hasil = x - total;
BAKINYA.setText("RM " + hasil );

/**
* @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(pblgui.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(pblgui.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(pblgui.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {

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

/* Create and display the form */


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

// Variables declaration - do not modify


private javax.swing.JTextField AIS;
private javax.swing.JTextField AYAM;
private javax.swing.JButton BAKI;
private javax.swing.JLabel BAKINYA;
private javax.swing.JTextField BERI;
private javax.swing.JButton BJUMLAH;
private javax.swing.JButton CLEAR;
private javax.swing.JTextField DAGING;
private javax.swing.JTextField IKAN;
private javax.swing.JLabel JUMLAH;
private javax.swing.JTextField KOPI;
private javax.swing.JLabel LAIS;
private javax.swing.JLabel LAYAM;
private javax.swing.JLabel LDAGING;
private javax.swing.JLabel LIKAN;
private javax.swing.JLabel LKOPI;
private javax.swing.JLabel LMILO;
private javax.swing.JLabel LNASI;

private javax.swing.JLabel LSAYUR;


private javax.swing.JLabel LSIRAP;
private javax.swing.JLabel LTEH;
private javax.swing.JLabel MAKANAN;
private javax.swing.JTextField MILO;
private javax.swing.JLabel MINUMAN;
private javax.swing.JTextField NASI;
private javax.swing.JTextField SAYUR;
private javax.swing.JTextField SIRAP;
private javax.swing.JTextField TEH;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}

Anda mungkin juga menyukai