Database Laundry
Database Laundry
Tabel login
Tabel isi data laundry
Login
Menu isi data
Menu update
Menu hapus
Menu kluar
Menu untuk exit.
package controler;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.swing.JOptionPane;
}
}
return koneksi;
}
static Object getConnection(){
throw new UnsupportedOperationException("not yet implemented");
}
Login
package home;
import controler.koneksi;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
public login() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
pack();
setLocationRelativeTo(null);
}// </editor-fold>
/**
* @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(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
Isi data
package home;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;
import static java.lang.Class.forName;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
public class system_laundry extends javax.swing.JFrame {
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
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();
No_pendaftar = new javax.swing.JTextField();
no_hp = new javax.swing.JTextField();
Nama = new javax.swing.JTextField();
jenis_cucian = new javax.swing.JComboBox<>();
pewangi = new javax.swing.JComboBox<>();
jLabel8 = new javax.swing.JLabel();
btinsert = new javax.swing.JButton();
btupdate = new javax.swing.JButton();
jScrollPane3 = new javax.swing.JScrollPane();
jTable2 = new javax.swing.JTable();
btexit = new javax.swing.JButton();
btdelete = new javax.swing.JButton();
bt_transaksi = new javax.swing.JButton();
jLabel9 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
alamat = new javax.swing.JTextPane();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("id_Pelanggan");
jLabel2.setText("nama ");
jLabel3.setText("no_hp");
jLabel5.setText("jenis cucian");
No_pendaftar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
No_pendaftarActionPerformed(evt);
}
});
Nama.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
NamaActionPerformed(evt);
}
});
jLabel8.setText("alamat");
btinsert.setText("Insert");
btinsert.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btinsertActionPerformed(evt);
}
});
btupdate.setText("Update");
btupdate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btupdateActionPerformed(evt);
}
});
btexit.setText("Exit");
btexit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btexitActionPerformed(evt);
}
});
btdelete.setText("Delete");
btdelete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btdeleteActionPerformed(evt);
}
});
bt_transaksi.setText("Transaksi");
bt_transaksi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bt_transaksiActionPerformed(evt);
}
});
jScrollPane1.setViewportView(alamat);
pack();
}// </editor-fold>
stat.executeUpdate();
JOptionPane.showMessageDialog(null, "data tersimpan !");
tampilan();
reset();
}
catch (SQLException se){
JOptionPane.showMessageDialog(null, "data tidak tersimpan !");
}
stat.close();
}
catch(Exception e){
System.out.println("pesan eror"+e);
}
}
No_pendaftar.setText(jTable2.getValueAt(jTable2.getSelectedRow(),0).toString());
Nama.setText(jTable2.getValueAt(jTable2.getSelectedRow(),1).toString());
no_hp.setText(jTable2.getValueAt(jTable2.getSelectedRow(),2).toString());
jenis_cucian.setSelectedItem(jTable2.getValueAt(jTable2.getSelectedRow(),3).toString());
pewangi.setSelectedItem(jTable2.getValueAt(jTable2.getSelectedRow(),4).toString());
alamat.setText(jTable2.getValueAt(jTable2.getSelectedRow(),5).toString());
btinsert.setEnabled(false);
btupdate.setEnabled(true);
btdelete.setEnabled(true);
new login().show();
this.dispose();
}
}
}
public void tampilan(){
try{
Statement stat=(Statement) con.createStatement();
ResultSet rset=stat.executeQuery("Select * From isidata");
int brs=0;
while (rset.next()) {
String id=rset.getString("id_pelanggan");
String nama=rset.getString("nama");
String nohp=rset.getString("no_hp");
String jc=rset.getString("jenis_cucian");
String jp=rset.getString("jenis_pewangi");
String Almt=rset.getString("alamat");
jTable2.setValueAt(id, brs,0);
jTable2.setValueAt(nama, brs,1);
jTable2.setValueAt(nohp, brs,2);
jTable2.setValueAt(jc, brs,3);
jTable2.setValueAt(jp, brs,4);
jTable2.setValueAt(Almt, brs,5);
brs++;
}
stat.close();
}
catch(SQLException se){
System.out.println("SQL salah"+se);
}
catch( Exception e){
System.out.println("pesan error"+e);
}
}
/**
* @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(system_laundry.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(system_laundry.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(system_laundry.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(system_laundry.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
Transaksi
/*
* 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 home;
import javax.swing.JOptionPane;
/**
*
* @author gery umpung
*/
public class transaksi extends javax.swing.JFrame {
int rbt1,rbt2,rbt3,rbt4,harga,beli,total,bayar,kembali;
public transaksi() {
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() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
ta.setColumns(20);
ta.setRows(5);
jScrollPane1.setViewportView(ta);
jButton1.setText("Reset");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
tx_total.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
tx_totalActionPerformed(evt);
}
});
jLabel4.setText("Total Bayar");
jLabel5.setText("Uang Bayar");
jLabel6.setText("Uang Kembali");
tx_bayar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
tx_bayarActionPerformed(evt);
}
});
tx_bayar.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
tx_bayarKeyReleased(evt);
}
});
tx_jmlbeli.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
tx_jmlbeliActionPerformed(evt);
}
});
tx_jmlbeli.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
tx_jmlbeliKeyReleased(evt);
}
});
bt_exit.setText("Exit");
bt_exit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bt_exitActionPerformed(evt);
}
});
bt_cetak.setText("Cetak");
bt_cetak.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bt_cetakActionPerformed(evt);
}
});
jLabel1.setText("jenis cuci");
r1.setText("1 kg");
r1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
r1ActionPerformed(evt);
}
});
r2.setText("3kg");
r2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
r2ActionPerformed(evt);
}
});
r3.setText("5kg");
r3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
r3ActionPerformed(evt);
}
});
jLabel8.setText("Harga");
r4.setText("10kg");
r4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
r4ActionPerformed(evt);
}
});
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(tx_harga, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(r1)
.addGap(18, 18, 18)
.addComponent(r2)))
.addGap(18, 18, 18)
.addComponent(r3))
.addGroup(jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jrsn, javax.swing.GroupLayout.PREFERRED_SIZE, 146,
javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap(169, Short.MAX_VALUE)))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(53, 53, 53)
.addComponent(r4)
.addContainerGap(82, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 26,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jrsn, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(3, 3, 3)))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(r1)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 26,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(r2)
.addComponent(r3))
.addGap(28, 28, 28)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tx_harga, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(21, Short.MAX_VALUE)))
);
pack();
}// </editor-fold>
}
else if(jrsn.getSelectedItem().equals("cuci/strika/pewangi")){
rbt1=3000;
rbt2=15000;
rbt3=25000;
rbt4=50000;
}
else if(jrsn.getSelectedItem().equals("cuci/pewangi")){
rbt1=2000;
rbt2=10000;
rbt3=20000;
rbt4=40000;
}
else if(jrsn.getSelectedItem().equals("cuci")){
rbt1=1000;
rbt2=5000;
rbt3=10000;
rbt4=30000;
}
}
}
}
}
}
/**
* @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(transaksi.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(transaksi.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(transaksi.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(transaksi.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
}
//</editor-fold>