Laman
- JENIS PERANGKAT LUNAK
- MITOS PERANGKAT LUNAK
- PEMBAHASAN
- ELISITASI KEBUTUHAN
- SPESIFIKASI
- VORD
- SEKENARIO
- USECASE DIAGRAM
- CLASS DIAGRAM
- ACTIVITY DIAGRAM
- SQUENCE DIAGRAM
- STATECHART DIAGRAM
- COLLABORATION DIAGRAM
- COMPONENT DIAGRAM
- DEPLOYMENT DIAGRAM
- FINAL PROJECT 1
- FINAL PROJECT 2
- FINAL PROJECT 3
- FINAL PROJECT 4
- FINAL PROJECT 5
- MY TEAM
FINAL PROJECT 4
Source code
package AP;
import javax.swing.JOptionPane;
/**
*
* @author Rizal Y.K
*/
public class hl4 extends javax.swing.JFrame {
/**
* Creates new form hl4
*/
public hl4() {
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() {
panelGambarHL1 = new panelGambar.panelGambarHL();
km = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
m1 = new javax.swing.JCheckBox();
kelapa_muda = new javax.swing.JLabel();
h1 = new javax.swing.JLabel();
mega_mendung = new javax.swing.JLabel();
h2 = new javax.swing.JLabel();
m2 = new javax.swing.JCheckBox();
m3 = new javax.swing.JCheckBox();
oj = new javax.swing.JLabel();
h3 = new javax.swing.JLabel();
m4 = new javax.swing.JCheckBox();
tt = new javax.swing.JLabel();
h4 = new javax.swing.JLabel();
h5 = new javax.swing.JLabel();
co = new javax.swing.JLabel();
m5 = new javax.swing.JCheckBox();
jml1 = new javax.swing.JTextField();
jml2 = new javax.swing.JTextField();
jml3 = new javax.swing.JTextField();
jml4 = new javax.swing.JTextField();
jml5 = new javax.swing.JTextField();
total = new javax.swing.JButton();
tharga = new javax.swing.JTextField();
hps = new javax.swing.JButton();
psn = new javax.swing.JButton();
setTitle("TIF Resto - page 4");
km.setText("KEMBALI");
km.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
kmActionPerformed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Coneria Script Demo", 0, 36)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 0, 0));
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("Code");
m1.setText("m1");
m1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m1ActionPerformed(evt);
}
});
kelapa_muda.setFont(new java.awt.Font("David", 0, 18)); // NOI18N
kelapa_muda.setForeground(new java.awt.Color(255, 0, 0));
kelapa_muda.setText("Es Kelapa Muda");
h1.setFont(new java.awt.Font("David", 0, 18)); // NOI18N
h1.setForeground(new java.awt.Color(255, 0, 0));
h1.setText("Rp 10.000");
mega_mendung.setFont(new java.awt.Font("David", 0, 18)); // NOI18N
mega_mendung.setForeground(new java.awt.Color(255, 0, 0));
mega_mendung.setText("Es Mega Mendung");
h2.setFont(new java.awt.Font("David", 0, 18)); // NOI18N
h2.setForeground(new java.awt.Color(255, 0, 0));
h2.setText("Rp 15.000");
m2.setText("m2");
m2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m2ActionPerformed(evt);
}
});
m3.setText("m3");
m3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m3ActionPerformed(evt);
}
});
oj.setFont(new java.awt.Font("David", 0, 18)); // NOI18N
oj.setForeground(new java.awt.Color(255, 0, 0));
oj.setText("Orange juice");
h3.setFont(new java.awt.Font("David", 0, 18)); // NOI18N
h3.setForeground(new java.awt.Color(255, 0, 0));
h3.setText("Rp 7.000");
m4.setText("m4");
m4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m4ActionPerformed(evt);
}
});
tt.setFont(new java.awt.Font("David", 0, 18)); // NOI18N
tt.setForeground(new java.awt.Color(255, 0, 0));
tt.setText("Es Teh Tarik");
h4.setFont(new java.awt.Font("David", 0, 18)); // NOI18N
h4.setForeground(new java.awt.Color(255, 0, 0));
h4.setText("Rp 10.000");
h5.setFont(new java.awt.Font("David", 0, 18)); // NOI18N
h5.setForeground(new java.awt.Color(255, 0, 0));
h5.setText("Rp 7.000");
co.setFont(new java.awt.Font("David", 0, 18)); // NOI18N
co.setForeground(new java.awt.Color(255, 0, 0));
co.setText("Es Coffe Oreo");
m5.setText("m5");
m5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m5ActionPerformed(evt);
}
});
jml1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jml1ActionPerformed(evt);
}
});
jml2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jml2ActionPerformed(evt);
}
});
jml3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jml3ActionPerformed(evt);
}
});
jml4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jml4ActionPerformed(evt);
}
});
jml5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jml5ActionPerformed(evt);
}
});
total.setText("TOTAL");
total.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
totalActionPerformed(evt);
}
});
hps.setText("HAPUS");
hps.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
hpsActionPerformed(evt);
}
});
psn.setText("PESAN");
psn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
psnActionPerformed(evt);
}
});
javax.swing.GroupLayout panelGambarHL1Layout = new javax.swing.GroupLayout(panelGambarHL1);
panelGambarHL1.setLayout(panelGambarHL1Layout);
panelGambarHL1Layout.setHorizontalGroup(
panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGambarHL1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGambarHL1Layout.createSequentialGroup()
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(total)
.addGroup(panelGambarHL1Layout.createSequentialGroup()
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGambarHL1Layout.createSequentialGroup()
.addComponent(m1)
.addGap(41, 41, 41)
.addComponent(kelapa_muda)
.addGap(43, 43, 43)
.addComponent(h1, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelGambarHL1Layout.createSequentialGroup()
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGambarHL1Layout.createSequentialGroup()
.addComponent(m5)
.addGap(41, 41, 41)
.addComponent(co))
.addComponent(km))
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGambarHL1Layout.createSequentialGroup()
.addGap(43, 43, 43)
.addComponent(hps))
.addGroup(panelGambarHL1Layout.createSequentialGroup()
.addGap(59, 59, 59)
.addComponent(h5))))
.addGroup(panelGambarHL1Layout.createSequentialGroup()
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGambarHL1Layout.createSequentialGroup()
.addComponent(m3)
.addGap(41, 41, 41)
.addComponent(oj))
.addGroup(panelGambarHL1Layout.createSequentialGroup()
.addComponent(m2)
.addGap(41, 41, 41)
.addComponent(mega_mendung))
.addGroup(panelGambarHL1Layout.createSequentialGroup()
.addComponent(m4)
.addGap(41, 41, 41)
.addComponent(tt)))
.addGap(26, 26, 26)
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(h4)
.addComponent(h2)
.addComponent(h3))))
.addGap(17, 17, 17)))
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGambarHL1Layout.createSequentialGroup()
.addGap(39, 39, 39)
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jml5, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
.addComponent(jml4, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
.addComponent(jml3, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
.addComponent(jml2, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
.addComponent(jml1)
.addComponent(tharga))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelGambarHL1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 144, Short.MAX_VALUE)
.addComponent(psn)
.addContainerGap())))
.addGroup(panelGambarHL1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
panelGambarHL1Layout.setVerticalGroup(
panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelGambarHL1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(5, 5, 5)
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(m1)
.addComponent(kelapa_muda)
.addComponent(h1)
.addComponent(jml1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(m2)
.addComponent(mega_mendung)
.addComponent(h2)
.addComponent(jml2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(m3)
.addComponent(oj)
.addComponent(h3)
.addComponent(jml3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(m4)
.addComponent(tt)
.addComponent(h4)
.addComponent(jml4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(m5)
.addComponent(co)
.addComponent(h5)
.addComponent(jml5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(33, 33, 33)
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(total)
.addComponent(tharga, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 66, Short.MAX_VALUE)
.addGroup(panelGambarHL1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(km)
.addComponent(hps)
.addComponent(psn))
.addContainerGap())
);
getContentPane().add(panelGambarHL1, java.awt.BorderLayout.CENTER);
getAccessibleContext().setAccessibleName("TIF Resto/page 4");
pack();
}// </editor-fold>
private void kmActionPerformed(java.awt.event.ActionEvent evt) {
new hl2().setVisible(true);
}
private void jml1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jml2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jml3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jml4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jml5ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void totalActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int total = 0;
if (m1.isSelected()){
String m1 = jml1.getText();
int jumlahm1 = Integer.parseInt(m1);
int hargam1 = jumlahm1 * 10000;
total = total + hargam1;
}
if (m2.isSelected()){
String m2 = jml2.getText();
int jumlahm2 = Integer.parseInt(m2);
int hargam2 = jumlahm2 * 15000;
total = total + hargam2;
}
if (m3.isSelected()){
String m3 = jml3.getText();
int jumlahm3 = Integer.parseInt(m3);
int hargam3 = jumlahm3 * 7000;
total = total + hargam3;
}
if (m4.isSelected()){
String m4 = jml4.getText();
int jumlahm4 = Integer.parseInt(m4);
int hargam4 = jumlahm4 * 10000;
total = total + hargam4;
}
if (m5.isSelected()){
String m5 = jml5.getText();
int jumlahm5 = Integer.parseInt(m5);
int hargam5 = jumlahm5 * 7000;
total = total + hargam5;
}
tharga.setText(""+ total);
}
private void hpsActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jml1.setEditable(false);
jml1.setText("");
jml2.setEditable(false);
jml2.setText("");
jml3.setEditable(false);
jml3.setText("");
jml4.setEditable(false);
jml4.setText("");
jml5.setEditable(false);
jml5.setText("");
tharga.setEditable(false);
tharga.setText("");
}
Pada button "PESAN" masukkan source code dibawah ini
private void psnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int total;
String m1 = jml1.getText();
int jumlahm1 = Integer.parseInt(m1);
int hargam1 = jumlahm1 * 10000;
String m2 = jml2.getText();
int jumlahm2 = Integer.parseInt(m2);
int hargam2 = jumlahm2 * 15000;
String m3 = jml3.getText();
int jumlahm3 = Integer.parseInt(m3);
int hargam3 = jumlahm3 * 7000;
String m4 = jml4.getText();
int jumlahm4 = Integer.parseInt(m4);
int hargam4 = jumlahm4 * 10000;
String m5 = jml5.getText();
int jumlahm5 = Integer.parseInt(m5);
int hargam5 = jumlahm5 * 7000;
total=hargam1+hargam2+hargam3+hargam4+hargam5;
JOptionPane.showMessageDialog(null, kelapa_muda.getText()+" --- "+ h1.getText()+" --- jumlah banyaknya "+ jml1.getText()+" --- total harga "+ hargam1
+"\n"+mega_mendung.getText()+" --- "+ h2.getText()+" --- jumlah banyaknya "+ jml2.getText()+" --- total harga "+ hargam2
+"\n"+oj.getText()+" --- "+ h3.getText()+" --- jumlah banyaknya "+ jml3.getText()+" --- total harga "+ hargam3
+"\n"+tt.getText()+" --- "+ h4.getText()+" --- jumlah banyaknya "+ jml4.getText()+" --- total harga "+ hargam4
+"\n"+co.getText()+" --- "+ h5.getText()+" --- jumlah banyaknya "+ jml5.getText()+" --- total harga "+ hargam5
+"\n\n"+"total semuanya = "+total,"INFORMASI PEMESANAN", JOptionPane.INFORMATION_MESSAGE);
new hl5().setVisible(true);
}
Ketika button "PESAN" di klik akan keluar output seperti gambar dibawah
Langganan:
Postingan (Atom)
Tidak ada komentar:
Posting Komentar