diff --git a/system/AddNewProduct.form b/system/AddNewProduct.form
new file mode 100644
index 0000000..e622e42
--- /dev/null
+++ b/system/AddNewProduct.form
@@ -0,0 +1,216 @@
+
+
+
diff --git a/system/AddNewProduct.java b/system/AddNewProduct.java
new file mode 100644
index 0000000..5a2ad7a
--- /dev/null
+++ b/system/AddNewProduct.java
@@ -0,0 +1,239 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
+ */
+package cafe.management.system;
+import java.util.ArrayList;
+import java.util.Iterator;
+import model.Category;
+import model.Product;
+import dao.CategoryDao;
+import dao.ProductDao;
+
+/**
+ *
+ * @author Acer
+ */
+public class AddNewProduct extends javax.swing.JFrame {
+
+ /**
+ * Creates new form AddNewProduct
+ */
+ public AddNewProduct() {
+ initComponents();
+
+ //save button should disabled when this fun call
+ btnSave.setEnabled(false);
+ }
+
+ //field validation
+ public void validateFields(){
+ String name = txtName.getText();
+ String price = txtPrice.getText();
+ if(!name.equals("") && !price.equals(""))
+ {
+ btnSave.setEnabled(true);
+ }
+ else
+ {
+ btnSave.setEnabled(false);
+ }
+ }
+
+ /**
+ * 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+ jButton1 = new javax.swing.JButton();
+ jLabel2 = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+ jLabel4 = new javax.swing.JLabel();
+ txtName = new javax.swing.JTextField();
+ txtPrice = new javax.swing.JTextField();
+ txtCategory = new javax.swing.JComboBox<>();
+ btnSave = new javax.swing.JButton();
+ btnClear = new javax.swing.JButton();
+ jLabel5 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setLocation(new java.awt.Point(350, 134));
+ setUndecorated(true);
+ addComponentListener(new java.awt.event.ComponentAdapter() {
+ public void componentShown(java.awt.event.ComponentEvent evt) {
+ formComponentShown(evt);
+ }
+ });
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ jLabel1.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel1.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/new product.png"))); // NOI18N
+ jLabel1.setText("New Product");
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 6, -1, -1));
+
+ jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/close.png"))); // NOI18N
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton1ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(668, 6, -1, -1));
+
+ jLabel2.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel2.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel2.setText("Name");
+ getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(91, 120, -1, -1));
+
+ jLabel3.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel3.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel3.setText("Category");
+ getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(91, 166, -1, -1));
+
+ jLabel4.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel4.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel4.setText("Price");
+ getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(91, 212, -1, -1));
+
+ txtName.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtName.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtNameKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtName, new org.netbeans.lib.awtextra.AbsoluteConstraints(237, 117, 354, -1));
+
+ txtPrice.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtPrice.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtPriceKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtPrice, new org.netbeans.lib.awtextra.AbsoluteConstraints(237, 209, 354, -1));
+
+ txtCategory.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ getContentPane().add(txtCategory, new org.netbeans.lib.awtextra.AbsoluteConstraints(237, 163, 354, -1));
+
+ btnSave.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/save.png"))); // NOI18N
+ btnSave.setText("Save");
+ btnSave.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSaveActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnSave, new org.netbeans.lib.awtextra.AbsoluteConstraints(237, 267, -1, -1));
+
+ btnClear.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnClear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/clear.png"))); // NOI18N
+ btnClear.setText("Clear");
+ btnClear.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnClearActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnClear, new org.netbeans.lib.awtextra.AbsoluteConstraints(487, 267, -1, -1));
+
+ jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/small-page-background.png"))); // NOI18N
+ getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void txtNameKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNameKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtNameKeyReleased
+
+ private void txtPriceKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPriceKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtPriceKeyReleased
+
+ private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
+ // TODO add your handling code here:
+ ArrayList list = CategoryDao.getAllRecords();
+ Iterator itr = list.iterator();
+ while(itr.hasNext())
+ {
+ Category categoryObj = itr.next();
+ txtCategory.addItem(categoryObj.getName());
+ }
+ }//GEN-LAST:event_formComponentShown
+
+ private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
+ // TODO add your handling code here:
+ Product product = new Product();
+ product.setName(txtName.getText());
+ product.setCategory((String) txtCategory.getSelectedItem());
+ product.setPrice(txtPrice.getText());
+ ProductDao.save(product);
+ setVisible(false);
+ new AddNewProduct().setVisible(true);
+ }//GEN-LAST:event_btnSaveActionPerformed
+
+ private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ new AddNewProduct().setVisible(true);
+ }//GEN-LAST:event_btnClearActionPerformed
+
+ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ }//GEN-LAST:event_jButton1ActionPerformed
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* Set the Nimbus look and feel */
+ //
+ /* 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(AddNewProduct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (InstantiationException ex) {
+ java.util.logging.Logger.getLogger(AddNewProduct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ java.util.logging.Logger.getLogger(AddNewProduct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(AddNewProduct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+ //
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new AddNewProduct().setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnClear;
+ private javax.swing.JButton btnSave;
+ private javax.swing.JButton jButton1;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JComboBox txtCategory;
+ private javax.swing.JTextField txtName;
+ private javax.swing.JTextField txtPrice;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/system/CafeManagementSystem.java b/system/CafeManagementSystem.java
new file mode 100644
index 0000000..d9d2077
--- /dev/null
+++ b/system/CafeManagementSystem.java
@@ -0,0 +1,20 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
+ */
+package cafe.management.system;
+
+/**
+ *
+ * @author Acer
+ */
+public class CafeManagementSystem {
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String[] args) {
+ // TODO code application logic here
+ }
+
+}
diff --git a/system/ChangePassword.form b/system/ChangePassword.form
new file mode 100644
index 0000000..5a9a2d4
--- /dev/null
+++ b/system/ChangePassword.form
@@ -0,0 +1,213 @@
+
+
+
diff --git a/system/ChangePassword.java b/system/ChangePassword.java
new file mode 100644
index 0000000..bccb96f
--- /dev/null
+++ b/system/ChangePassword.java
@@ -0,0 +1,234 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
+ */
+package cafe.management.system;
+
+import dao.UserDao;
+
+/**
+ *
+ * @author Acer
+ */
+public class ChangePassword extends javax.swing.JFrame {
+ public String userEmail;
+
+ /**
+ * Creates new form ChangePassword
+ */
+ public ChangePassword() {
+ initComponents();
+ }
+
+ public ChangePassword(String email) {
+ initComponents();
+ userEmail = email;
+ btnUpdate.setEnabled(false);
+ }
+
+ public void validateField(){
+ String oldPassword = txtOldPassword.getText();
+ String newPassword = txtNewPassword.getText();
+ String confirmPassword = txtConfirmPassword.getText();
+ if(!oldPassword.equals("") && !newPassword.equals("") && !confirmPassword.equals("") && newPassword.equals(confirmPassword))
+ {
+ btnUpdate.setEnabled(true);
+ }
+ else
+ {
+ btnUpdate.setEnabled(false);
+ }
+
+ }
+
+ /**
+ * 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+ jButton1 = new javax.swing.JButton();
+ jLabel2 = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+ jLabel4 = new javax.swing.JLabel();
+ txtOldPassword = new javax.swing.JPasswordField();
+ txtNewPassword = new javax.swing.JPasswordField();
+ txtConfirmPassword = new javax.swing.JPasswordField();
+ btnUpdate = new javax.swing.JButton();
+ btnClear = new javax.swing.JButton();
+ jLabel5 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setLocation(new java.awt.Point(350, 134));
+ setUndecorated(true);
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ jLabel1.setFont(new java.awt.Font("Bookman Old Style", 1, 24)); // NOI18N
+ jLabel1.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/change Password.png"))); // NOI18N
+ jLabel1.setText("Change Password");
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 6, -1, -1));
+
+ jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/close.png"))); // NOI18N
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton1ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(668, 6, -1, -1));
+
+ jLabel2.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel2.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel2.setText("Old Password");
+ getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 123, -1, -1));
+
+ jLabel3.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel3.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel3.setText("New Password");
+ getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 169, -1, -1));
+
+ jLabel4.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel4.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel4.setText("Confirm Password");
+ getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 215, -1, -1));
+
+ txtOldPassword.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtOldPassword.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtOldPasswordKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtOldPassword, new org.netbeans.lib.awtextra.AbsoluteConstraints(275, 120, 329, -1));
+
+ txtNewPassword.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtNewPassword.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtNewPasswordKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtNewPassword, new org.netbeans.lib.awtextra.AbsoluteConstraints(275, 166, 329, -1));
+
+ txtConfirmPassword.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtConfirmPassword.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtConfirmPasswordKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtConfirmPassword, new org.netbeans.lib.awtextra.AbsoluteConstraints(275, 212, 329, -1));
+
+ btnUpdate.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnUpdate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/save.png"))); // NOI18N
+ btnUpdate.setText("Update");
+ btnUpdate.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnUpdateActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnUpdate, new org.netbeans.lib.awtextra.AbsoluteConstraints(275, 272, -1, -1));
+
+ btnClear.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnClear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/clear.png"))); // NOI18N
+ btnClear.setText("Clear");
+ btnClear.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnClearActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnClear, new org.netbeans.lib.awtextra.AbsoluteConstraints(500, 272, -1, -1));
+
+ jLabel5.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/small-page-background.png"))); // NOI18N
+ getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void txtOldPasswordKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtOldPasswordKeyReleased
+ // TODO add your handling code here:
+ validateField();
+ }//GEN-LAST:event_txtOldPasswordKeyReleased
+
+ private void txtNewPasswordKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNewPasswordKeyReleased
+ // TODO add your handling code here:
+ validateField();
+ }//GEN-LAST:event_txtNewPasswordKeyReleased
+
+ private void txtConfirmPasswordKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtConfirmPasswordKeyReleased
+ // TODO add your handling code here:
+ validateField();
+ }//GEN-LAST:event_txtConfirmPasswordKeyReleased
+
+ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ }//GEN-LAST:event_jButton1ActionPerformed
+
+ private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ new ChangePassword(userEmail).setVisible(true);
+ }//GEN-LAST:event_btnClearActionPerformed
+
+ private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateActionPerformed
+ // TODO add your handling code here:
+ String oldPassword = txtOldPassword.getText();
+ String newPassword = txtNewPassword.getText();
+// String confirmPassword = txtConfirmPassword.getText();
+ UserDao.changePassword(userEmail, oldPassword, newPassword);
+ setVisible(false);
+ new ChangePassword(userEmail).setVisible(true);
+ }//GEN-LAST:event_btnUpdateActionPerformed
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* Set the Nimbus look and feel */
+ //
+ /* 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(ChangePassword.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (InstantiationException ex) {
+ java.util.logging.Logger.getLogger(ChangePassword.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ java.util.logging.Logger.getLogger(ChangePassword.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(ChangePassword.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+ //
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new ChangePassword().setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnClear;
+ private javax.swing.JButton btnUpdate;
+ private javax.swing.JButton jButton1;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JPasswordField txtConfirmPassword;
+ private javax.swing.JPasswordField txtNewPassword;
+ private javax.swing.JPasswordField txtOldPassword;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/system/ForgotPassword.form b/system/ForgotPassword.form
new file mode 100644
index 0000000..733de49
--- /dev/null
+++ b/system/ForgotPassword.form
@@ -0,0 +1,323 @@
+
+
+
diff --git a/system/ForgotPassword.java b/system/ForgotPassword.java
new file mode 100644
index 0000000..58ddb95
--- /dev/null
+++ b/system/ForgotPassword.java
@@ -0,0 +1,388 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
+ */
+package cafe.management.system;
+
+import javax.swing.JOptionPane;
+import model.User;
+import dao.UserDao;
+
+/**
+ *
+ * @author Acer
+ */
+public class ForgotPassword extends javax.swing.JFrame {
+
+ private String dbAnswer = null;
+ private String email = null;
+ private String emailPattern = "^[a-zA-Z0-9]+[@]+[a-zA-Z0-9]+[.]+[a-zA-Z0-9]+$";
+
+ /**
+ * Creates new form ForgotPassword
+ */
+ public ForgotPassword() {
+ initComponents();
+
+ //disable update and search button when this page load
+ btnUpdate.setEnabled(false);
+ btnSearch.setEnabled(false);
+ txtSecQue.setEditable(false);
+ }
+
+ //method for clear fields
+ public void clear(){
+ //btn disable after clear
+ btnUpdate.setEnabled(false);
+ btnSearch.setEnabled(false);
+ //email field become editable
+ txtEmail.setEditable(true);
+ txtEmail.setText("");
+ txtSecQue.setText("");
+ txtAnswer.setText("");
+ txtNewPassword.setText("");
+
+ }
+
+ //method for email validation
+ public void validateEmail(){
+ email = txtEmail.getText();
+ if(email.matches(emailPattern))
+ {
+ btnSearch.setEnabled(true);
+ }
+ else
+ {
+ btnSearch.setEnabled(false);
+ }
+ }
+
+ //method for validate fields
+ public void validateFields(){
+ String password = txtNewPassword.getText();
+ String answer = txtAnswer.getText();
+ String securityQuestion = txtSecQue.getText();
+ if(!password.equals("") && !answer.equals("") && !securityQuestion.equals(""))
+ {
+ btnUpdate.setEnabled(true);
+ }
+ else
+ {
+ btnUpdate.setEnabled(false);
+ }
+ }
+
+ /**
+ * 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")
+ // //GEN-BEGIN:initComponents
+ 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();
+ txtEmail = new javax.swing.JTextField();
+ txtSecQue = new javax.swing.JTextField();
+ txtAnswer = new javax.swing.JTextField();
+ btnSearch = new javax.swing.JButton();
+ btnUpdate = new javax.swing.JButton();
+ btnClear = new javax.swing.JButton();
+ btnExit = new javax.swing.JButton();
+ jButton5 = new javax.swing.JButton();
+ jButton6 = new javax.swing.JButton();
+ txtNewPassword = new javax.swing.JPasswordField();
+ jLabel6 = new javax.swing.JLabel();
+ jLabel7 = new javax.swing.JLabel();
+ jLabel8 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setUndecorated(true);
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ jLabel1.setFont(new java.awt.Font("Sitka Text", 1, 36)); // NOI18N
+ jLabel1.setForeground(new java.awt.Color(255, 102, 102));
+ jLabel1.setText("Forgot Password?");
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(510, 210, -1, -1));
+
+ jLabel2.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel2.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel2.setText("Email");
+ getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 320, -1, -1));
+
+ jLabel3.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel3.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel3.setText("Your Security Question");
+ getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 370, -1, -1));
+
+ jLabel4.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel4.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel4.setText("New Password");
+ getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 460, -1, -1));
+
+ jLabel5.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel5.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel5.setText("Your Answer");
+ getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 420, -1, -1));
+
+ txtEmail.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtEmail.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtEmailKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtEmail, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 320, 382, -1));
+
+ txtSecQue.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtSecQue.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ txtSecQueActionPerformed(evt);
+ }
+ });
+ txtSecQue.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtSecQueKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtSecQue, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 370, 382, -1));
+
+ txtAnswer.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtAnswer.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtAnswerKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtAnswer, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 410, 382, -1));
+
+ btnSearch.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnSearch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/search.png"))); // NOI18N
+ btnSearch.setText("Search");
+ btnSearch.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSearchActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnSearch, new org.netbeans.lib.awtextra.AbsoluteConstraints(970, 320, -1, -1));
+
+ btnUpdate.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnUpdate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/save.png"))); // NOI18N
+ btnUpdate.setText("Update");
+ btnUpdate.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnUpdateActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnUpdate, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 520, -1, -1));
+
+ btnClear.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnClear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/clear.png"))); // NOI18N
+ btnClear.setText("Clear");
+ btnClear.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnClearActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnClear, new org.netbeans.lib.awtextra.AbsoluteConstraints(720, 520, -1, -1));
+
+ btnExit.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/exit small.png"))); // NOI18N
+ btnExit.setText("Exit");
+ btnExit.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnExitActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnExit, new org.netbeans.lib.awtextra.AbsoluteConstraints(850, 520, -1, -1));
+
+ jButton5.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jButton5.setText("SignUp");
+ jButton5.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton5ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 580, -1, -1));
+
+ jButton6.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jButton6.setText("Login");
+ jButton6.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton6ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton6, new org.netbeans.lib.awtextra.AbsoluteConstraints(860, 580, -1, -1));
+
+ txtNewPassword.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtNewPassword.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtNewPasswordKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtNewPassword, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 470, 390, -1));
+
+ jLabel6.setFont(new java.awt.Font("Bookman Old Style", 3, 48)); // NOI18N
+ jLabel6.setForeground(new java.awt.Color(204, 51, 255));
+ jLabel6.setText("Cafex");
+ getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(590, 30, 150, -1));
+
+ jLabel7.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel7.setForeground(new java.awt.Color(255, 102, 255));
+ jLabel7.setText("The True cafe of Love");
+ getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 90, -1, -1));
+
+ jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/home-background-image.png"))); // NOI18N
+ getContentPane().add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
+ // TODO add your handling code here:
+ clear();
+ }//GEN-LAST:event_btnClearActionPerformed
+
+ private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSearchActionPerformed
+ // TODO add your handling code here:
+ email = txtEmail.getText();
+ User user = null;
+ user = UserDao.getSecurityQuestion(email); //particular email address ka security question is stored into user variable
+ if(user == null)
+ {
+ JOptionPane.showMessageDialog(null,"Incorrect Email","Message",JOptionPane.ERROR_MESSAGE);
+ }
+ else
+ {
+ //if user is not exist
+ btnSearch.setEnabled(false);
+ txtEmail.setEditable(false);
+ dbAnswer = user.getAnswer();
+ txtSecQue.setText(user.getSecurityQuestion());
+ validateFields();
+ }
+ }//GEN-LAST:event_btnSearchActionPerformed
+
+ private void txtSecQueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtSecQueActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_txtSecQueActionPerformed
+
+ private void txtEmailKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtEmailKeyReleased
+ // TODO add your handling code here:
+ validateEmail();
+ }//GEN-LAST:event_txtEmailKeyReleased
+
+ private void txtSecQueKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtSecQueKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtSecQueKeyReleased
+
+ private void txtAnswerKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtAnswerKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtAnswerKeyReleased
+
+ private void txtNewPasswordKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNewPasswordKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtNewPasswordKeyReleased
+
+ private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExitActionPerformed
+ // TODO add your handling code here:
+ //when user click on exit it will show a message
+ int a = JOptionPane.showConfirmDialog(null,"Do you really want to Close Application","Select",JOptionPane.YES_NO_OPTION);
+ //if user select YES
+ if(a==0)
+ {
+ System.exit(0);
+ }
+ }//GEN-LAST:event_btnExitActionPerformed
+
+ private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateActionPerformed
+ // TODO add your handling code here:
+ String answer = txtAnswer.getText();
+ String newPassword = txtNewPassword.getText();
+
+ //if answer match the answer stored in data base
+ if(answer.equals(dbAnswer))
+ {
+ UserDao.update(email, newPassword);
+ clear();
+ }
+ else
+ {
+ JOptionPane.showMessageDialog(null,"Incorrect Answer","Message",JOptionPane.ERROR_MESSAGE);
+ }
+
+ }//GEN-LAST:event_btnUpdateActionPerformed
+
+ private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ new Signup().setVisible(true);
+ }//GEN-LAST:event_jButton5ActionPerformed
+
+ private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ new Login().setVisible(true);
+ }//GEN-LAST:event_jButton6ActionPerformed
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* Set the Nimbus look and feel */
+ //
+ /* 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(ForgotPassword.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (InstantiationException ex) {
+ java.util.logging.Logger.getLogger(ForgotPassword.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ java.util.logging.Logger.getLogger(ForgotPassword.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(ForgotPassword.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+ //
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new ForgotPassword().setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnClear;
+ private javax.swing.JButton btnExit;
+ private javax.swing.JButton btnSearch;
+ private javax.swing.JButton btnUpdate;
+ private javax.swing.JButton jButton5;
+ private javax.swing.JButton jButton6;
+ private javax.swing.JLabel jLabel1;
+ 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.JTextField txtAnswer;
+ private javax.swing.JTextField txtEmail;
+ private javax.swing.JPasswordField txtNewPassword;
+ private javax.swing.JTextField txtSecQue;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/system/Home.form b/system/Home.form
new file mode 100644
index 0000000..a079f4d
--- /dev/null
+++ b/system/Home.form
@@ -0,0 +1,245 @@
+
+
+
diff --git a/system/Home.java b/system/Home.java
new file mode 100644
index 0000000..bd0cebc
--- /dev/null
+++ b/system/Home.java
@@ -0,0 +1,277 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
+ */
+package cafe.management.system;
+
+import javax.swing.JOptionPane;
+
+/**
+ *
+ * @author Acer
+ */
+public class Home extends javax.swing.JFrame {
+
+ public String email;
+
+ /**
+ * Creates new form Home
+ */
+ public Home() {
+ initComponents();
+ }
+
+ public Home(String userEmail) {
+ initComponents();
+
+ email = userEmail;
+
+ //disable all the button which are not for user
+ if(!email.equals("admin@gmail.com"))
+ {
+ btnCategory.setVisible(false);
+ btnNewProduct.setVisible(false);
+ btnViewEditDelete.setVisible(false);
+ btnVerifyUsers.setVisible(false);
+ }
+
+
+ }
+
+ /**
+ * 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jButton1 = new javax.swing.JButton();
+ jButton2 = new javax.swing.JButton();
+ jButton3 = new javax.swing.JButton();
+ jButton4 = new javax.swing.JButton();
+ jButton6 = new javax.swing.JButton();
+ btnCategory = new javax.swing.JButton();
+ btnNewProduct = new javax.swing.JButton();
+ btnViewEditDelete = new javax.swing.JButton();
+ btnVerifyUsers = new javax.swing.JButton();
+ jLabel1 = new javax.swing.JLabel();
+ jLabel2 = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setUndecorated(true);
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ jButton1.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/logout.png"))); // NOI18N
+ jButton1.setText("LogOut");
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton1ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(1120, 480, -1, -1));
+
+ jButton2.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/place order.png"))); // NOI18N
+ jButton2.setText("Place Order");
+ jButton2.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton2ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 60, -1, -1));
+
+ jButton3.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/View Bills & Order Placed Details.png"))); // NOI18N
+ jButton3.setText("View Bill & Order placed Details");
+ jButton3.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton3ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 60, -1, -1));
+
+ jButton4.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/change Password.png"))); // NOI18N
+ jButton4.setText("Change Password");
+ jButton4.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton4ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(1060, 60, -1, -1));
+
+ jButton6.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/exit.png"))); // NOI18N
+ jButton6.setText("Exit");
+ jButton6.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton6ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton6, new org.netbeans.lib.awtextra.AbsoluteConstraints(1130, 570, -1, -1));
+
+ btnCategory.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnCategory.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/category.png"))); // NOI18N
+ btnCategory.setText("Manage Category");
+ btnCategory.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCategoryActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnCategory, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 570, -1, -1));
+
+ btnNewProduct.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnNewProduct.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/new product.png"))); // NOI18N
+ btnNewProduct.setText("New Product");
+ btnNewProduct.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnNewProductActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnNewProduct, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 570, -1, -1));
+
+ btnViewEditDelete.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnViewEditDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/view edit delete product.png"))); // NOI18N
+ btnViewEditDelete.setText("View, Edit & Delete Products");
+ btnViewEditDelete.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnViewEditDeleteActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnViewEditDelete, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 640, -1, -1));
+
+ btnVerifyUsers.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnVerifyUsers.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/verify users.png"))); // NOI18N
+ btnVerifyUsers.setText("Verify Users");
+ btnVerifyUsers.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnVerifyUsersActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnVerifyUsers, new org.netbeans.lib.awtextra.AbsoluteConstraints(1090, 390, -1, -1));
+
+ jLabel1.setFont(new java.awt.Font("Bookman Old Style", 3, 48)); // NOI18N
+ jLabel1.setForeground(new java.awt.Color(153, 51, 255));
+ jLabel1.setText("Cafex");
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(54, 39, 151, -1));
+
+ jLabel2.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel2.setForeground(new java.awt.Color(204, 102, 255));
+ jLabel2.setText("The True cafe of Love");
+ getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(31, 102, -1, -1));
+
+ jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/home-background-image.png"))); // NOI18N
+ getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
+ // TODO add your handling code here:
+ new ViewBillsOrderPlacedDetails().setVisible(true);
+ }//GEN-LAST:event_jButton3ActionPerformed
+
+ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
+ // TODO add your handling code here:
+ int a = JOptionPane.showConfirmDialog(null,"Do you really want to LogOut","Select",JOptionPane.YES_NO_OPTION);
+ if(a == 0)
+ {
+ setVisible(false);
+ new Login().setVisible(true);
+ }
+ }//GEN-LAST:event_jButton1ActionPerformed
+
+ private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
+ // TODO add your handling code here:
+ int a = JOptionPane.showConfirmDialog(null,"Do you really want to Close Application","Select",JOptionPane.YES_NO_OPTION);
+ if(a == 0)
+ {
+ System.exit(0);
+ }
+ }//GEN-LAST:event_jButton6ActionPerformed
+
+ private void btnCategoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCategoryActionPerformed
+ // TODO add your handling code here:
+ new ManageCategory().setVisible(true);
+ }//GEN-LAST:event_btnCategoryActionPerformed
+
+ private void btnNewProductActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewProductActionPerformed
+ // TODO add your handling code here:
+ new AddNewProduct().setVisible(true);
+ }//GEN-LAST:event_btnNewProductActionPerformed
+
+ private void btnViewEditDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViewEditDeleteActionPerformed
+ // TODO add your handling code here:
+ new ViewEditDeleteProduct().setVisible(true);
+ }//GEN-LAST:event_btnViewEditDeleteActionPerformed
+
+ private void btnVerifyUsersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVerifyUsersActionPerformed
+ // TODO add your handling code here:
+ new VerifyUsers().setVisible(true);
+ }//GEN-LAST:event_btnVerifyUsersActionPerformed
+
+ private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ new PlaceOrder(email).setVisible(true);
+ }//GEN-LAST:event_jButton2ActionPerformed
+
+ private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
+ // TODO add your handling code here:
+ new ChangePassword(email).setVisible(true);
+ }//GEN-LAST:event_jButton4ActionPerformed
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* Set the Nimbus look and feel */
+ //
+ /* 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(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (InstantiationException ex) {
+ java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+ //
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new Home().setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnCategory;
+ private javax.swing.JButton btnNewProduct;
+ private javax.swing.JButton btnVerifyUsers;
+ private javax.swing.JButton btnViewEditDelete;
+ private javax.swing.JButton jButton1;
+ private javax.swing.JButton jButton2;
+ private javax.swing.JButton jButton3;
+ private javax.swing.JButton jButton4;
+ private javax.swing.JButton jButton6;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/system/Login.form b/system/Login.form
new file mode 100644
index 0000000..bc9c343
--- /dev/null
+++ b/system/Login.form
@@ -0,0 +1,243 @@
+
+
+
diff --git a/system/Login.java b/system/Login.java
new file mode 100644
index 0000000..0b3fd8a
--- /dev/null
+++ b/system/Login.java
@@ -0,0 +1,307 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
+ */
+package cafe.management.system;
+
+import javax.swing.JOptionPane;
+import javax.swing.ImageIcon;
+import model.User;
+import dao.UserDao;
+
+/**
+ *
+ * @author Acer
+ */
+public class Login extends javax.swing.JFrame {
+ //save the email pattern for login
+ public String emailPattern = "^[a-zA-Z0-9]+[@]+[a-zA-Z0-9]+[.]+[a-zA-Z0-9]+$";
+
+ /**
+ * Creates new form Login
+ */
+ public Login() {
+ initComponents();
+ //when this page loads--> login button should be disabled
+ btnLogin.setEnabled(false);
+ }
+
+ //clear function for clearing the fields
+ public void Clear(){
+ txtEmail.setText("");
+ txtPassword.setText("");
+ btnLogin.setEnabled(false);
+ }
+
+ public void validateFields(){
+ String email = txtEmail.getText();
+ String password = txtPassword.getText();
+ if(email.matches(emailPattern) && !password.equals(""))
+ {
+ btnLogin.setEnabled(true);
+ }
+ else
+ {
+ btnLogin.setEnabled(false);
+ }
+ }
+
+ /**
+ * 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+ jLabel2 = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+ txtEmail = new javax.swing.JTextField();
+ txtPassword = new javax.swing.JPasswordField();
+ btnLogin = new javax.swing.JButton();
+ btnClear = new javax.swing.JButton();
+ btnExit = new javax.swing.JButton();
+ jButton4 = new javax.swing.JButton();
+ jButton5 = new javax.swing.JButton();
+ jLabel5 = new javax.swing.JLabel();
+ jLabel4 = new javax.swing.JLabel();
+ jLabel6 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setUndecorated(true);
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ jLabel1.setFont(new java.awt.Font("Sitka Text", 1, 36)); // NOI18N
+ jLabel1.setForeground(new java.awt.Color(255, 102, 102));
+ jLabel1.setText("Login");
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(630, 250, -1, -1));
+
+ jLabel2.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel2.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel2.setText("Email");
+ getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 350, 64, -1));
+
+ jLabel3.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel3.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel3.setText("Password");
+ getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 390, -1, -1));
+
+ txtEmail.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtEmail.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ txtEmailActionPerformed(evt);
+ }
+ });
+ txtEmail.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtEmailKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtEmail, new org.netbeans.lib.awtextra.AbsoluteConstraints(530, 350, 432, -1));
+
+ txtPassword.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtPassword.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ txtPasswordActionPerformed(evt);
+ }
+ });
+ txtPassword.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtPasswordKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtPassword, new org.netbeans.lib.awtextra.AbsoluteConstraints(530, 390, 432, -1));
+
+ btnLogin.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnLogin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/login.png"))); // NOI18N
+ btnLogin.setText("Login");
+ btnLogin.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnLoginActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnLogin, new org.netbeans.lib.awtextra.AbsoluteConstraints(530, 450, -1, -1));
+
+ btnClear.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnClear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/clear.png"))); // NOI18N
+ btnClear.setText("Clear");
+ btnClear.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnClearActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnClear, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, 450, -1, -1));
+
+ btnExit.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/exit small.png"))); // NOI18N
+ btnExit.setText("Exit");
+ btnExit.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnExitActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnExit, new org.netbeans.lib.awtextra.AbsoluteConstraints(870, 450, -1, -1));
+
+ jButton4.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jButton4.setText("Forgot Password?");
+ jButton4.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton4ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(530, 510, -1, -1));
+
+ jButton5.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jButton5.setText("SignUp");
+ jButton5.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton5ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(860, 510, -1, -1));
+
+ jLabel5.setFont(new java.awt.Font("Bookman Old Style", 3, 48)); // NOI18N
+ jLabel5.setForeground(new java.awt.Color(204, 0, 204));
+ jLabel5.setText("Cafex ");
+ getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(601, 57, -1, -1));
+
+ jLabel4.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel4.setForeground(new java.awt.Color(255, 153, 255));
+ jLabel4.setText("The True cafe of Love");
+ getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(580, 120, -1, -1));
+
+ jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/home-background-image.png"))); // NOI18N
+ getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1370, -1));
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void txtEmailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtEmailActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_txtEmailActionPerformed
+
+ private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
+ // TODO add your handling code here:
+ Clear();
+ }//GEN-LAST:event_btnClearActionPerformed
+
+ private void txtPasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtPasswordActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_txtPasswordActionPerformed
+
+ private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoginActionPerformed
+ // TODO add your handling code here:
+ String email = txtEmail.getText();
+ String password = txtPassword.getText();
+ User user = null;
+ user = UserDao.Login(email, password);
+ if(user == null)
+ {
+ JOptionPane.showMessageDialog(null,"Incorrect Username or Password","Message",JOptionPane.ERROR_MESSAGE);
+
+ }
+ else
+ {
+ //user is not active -->did not get approval from admin
+ if(user.getStatus().equals("false"))
+ {
+ //also change icon of this
+ ImageIcon icon = new ImageIcon("src/popupicon/wait.png");
+ JOptionPane.showMessageDialog(null,"Wait for Admin Approval","Message",JOptionPane.INFORMATION_MESSAGE,icon);
+ Clear();
+ }
+ if(user.getStatus().equals("true"))
+ {
+ //hide this page and move to the another page
+ setVisible(false);
+ new Home(email).setVisible(true);
+ }
+ }
+
+ }//GEN-LAST:event_btnLoginActionPerformed
+
+ private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExitActionPerformed
+ // TODO add your handling code here:
+ int a = JOptionPane.showConfirmDialog(null,"Do you really want to Close Application","Select",JOptionPane.YES_NO_OPTION);
+ //if user select YES
+ if(a==0)
+ {
+ System.exit(0);
+ }
+ }//GEN-LAST:event_btnExitActionPerformed
+
+ private void txtEmailKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtEmailKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtEmailKeyReleased
+
+ private void txtPasswordKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPasswordKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtPasswordKeyReleased
+
+ private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ new Signup().setVisible(true);
+ }//GEN-LAST:event_jButton5ActionPerformed
+
+ private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ new ForgotPassword().setVisible(true);
+ }//GEN-LAST:event_jButton4ActionPerformed
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* Set the Nimbus look and feel */
+ //
+ /* 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);
+ }
+ //
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new Login().setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnClear;
+ private javax.swing.JButton btnExit;
+ private javax.swing.JButton btnLogin;
+ private javax.swing.JButton jButton4;
+ private javax.swing.JButton jButton5;
+ private javax.swing.JLabel jLabel1;
+ 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.JTextField txtEmail;
+ private javax.swing.JPasswordField txtPassword;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/system/ManageCategory.form b/system/ManageCategory.form
new file mode 100644
index 0000000..2e4ee3e
--- /dev/null
+++ b/system/ManageCategory.form
@@ -0,0 +1,234 @@
+
+
+
diff --git a/system/ManageCategory.java b/system/ManageCategory.java
new file mode 100644
index 0000000..5a27836
--- /dev/null
+++ b/system/ManageCategory.java
@@ -0,0 +1,261 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
+ */
+package cafe.management.system;
+import model.Category;
+import dao.CategoryDao;
+import javax.swing.JOptionPane;
+import javax.swing.table.TableModel;
+import javax.swing.table.DefaultTableModel;
+import java.util.ArrayList;
+import java.util.*;
+
+
+/**
+ *
+ * @author Acer
+ */
+public class ManageCategory extends javax.swing.JFrame {
+
+ /**
+ * Creates new form ManageCategory
+ */
+ public ManageCategory() {
+ initComponents();
+
+ //disable save button when this page load
+ btnSave.setEnabled(false);
+ }
+
+// method for validation
+ public void validateFields(){
+ String category = txtName.getText();
+ if(!category.equals(""))
+ {
+ btnSave.setEnabled(true);
+ }
+ else
+ {
+ btnSave.setEnabled(false);
+ }
+ }
+
+ /**
+ * 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jButton2 = new javax.swing.JButton();
+ jLabel1 = new javax.swing.JLabel();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ jTable1 = new javax.swing.JTable();
+ jLabel2 = new javax.swing.JLabel();
+ txtName = new javax.swing.JTextField();
+ btnSave = new javax.swing.JButton();
+ btnClear = new javax.swing.JButton();
+ jLabel3 = new javax.swing.JLabel();
+ jLabel5 = new javax.swing.JLabel();
+ jLabel4 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setLocation(new java.awt.Point(350, 134));
+ setUndecorated(true);
+ addComponentListener(new java.awt.event.ComponentAdapter() {
+ public void componentShown(java.awt.event.ComponentEvent evt) {
+ formComponentShown(evt);
+ }
+ });
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ jButton2.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/close.png"))); // NOI18N
+ jButton2.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton2ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(660, 10, -1, -1));
+
+ jLabel1.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel1.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel1.setText("View Category");
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 70, -1, -1));
+
+ jTable1.setFont(new java.awt.Font("Bookman Old Style", 1, 14)); // NOI18N
+ jTable1.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+
+ },
+ new String [] {
+ "ID", "Category"
+ }
+ ));
+ jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ jTable1MouseClicked(evt);
+ }
+ });
+ jScrollPane1.setViewportView(jTable1);
+
+ getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 110, 262, 221));
+
+ jLabel2.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel2.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel2.setText("Add New Category");
+ getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(118, 145, -1, -1));
+
+ txtName.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtName.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtNameKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtName, new org.netbeans.lib.awtextra.AbsoluteConstraints(56, 179, 300, -1));
+
+ btnSave.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/save.png"))); // NOI18N
+ btnSave.setText("Save");
+ btnSave.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSaveActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnSave, new org.netbeans.lib.awtextra.AbsoluteConstraints(56, 225, -1, -1));
+
+ btnClear.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnClear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/clear.png"))); // NOI18N
+ btnClear.setText("Clear");
+ btnClear.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnClearActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnClear, new org.netbeans.lib.awtextra.AbsoluteConstraints(252, 225, -1, -1));
+
+ jLabel3.setFont(new java.awt.Font("Bookman Old Style", 1, 14)); // NOI18N
+ jLabel3.setForeground(new java.awt.Color(255, 153, 0));
+ jLabel3.setText("*Click on row to Delete Category");
+ getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 370, -1, -1));
+
+ jLabel5.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel5.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/category.png"))); // NOI18N
+ jLabel5.setText("Manage Category");
+ getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1));
+
+ jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/small-page-background.png"))); // NOI18N
+ jLabel4.setText("jLabel4");
+ getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 700, -1));
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void txtNameKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNameKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtNameKeyReleased
+
+ private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
+ // TODO add your handling code here:
+ Category category = new Category();
+ category.setName(txtName.getText());
+ CategoryDao.save(category);
+ setVisible(false);
+ new ManageCategory().setVisible(true);
+ }//GEN-LAST:event_btnSaveActionPerformed
+
+ private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
+ // TODO add your handling code here:
+ DefaultTableModel dtm = (DefaultTableModel) jTable1.getModel();
+ ArrayList list = CategoryDao.getAllRecords();
+ Iterator itr = list.iterator();
+ while(itr.hasNext())
+ {
+ Category categoryObj = itr.next();
+ dtm.addRow(new Object[]{
+ categoryObj.getId(),
+ categoryObj.getName()
+ });
+ }
+ }//GEN-LAST:event_formComponentShown
+
+ private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
+ // TODO add your handling code here:
+ int index = jTable1.getSelectedRow();
+ TableModel model = jTable1.getModel();
+ String id = model.getValueAt(index, 0).toString();
+ String name = model.getValueAt(index, 1).toString();
+ int a = JOptionPane.showConfirmDialog(null,"Do you want to Delete "+name+" category","Select",JOptionPane.YES_NO_OPTION);
+ if(a == 0)
+ {
+ CategoryDao.delete(id);
+ setVisible(false);
+ new ManageCategory().setVisible(true);
+ }
+ }//GEN-LAST:event_jTable1MouseClicked
+
+ private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ new ManageCategory().setVisible(true);
+ }//GEN-LAST:event_btnClearActionPerformed
+
+ private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ }//GEN-LAST:event_jButton2ActionPerformed
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* Set the Nimbus look and feel */
+ //
+ /* 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(ManageCategory.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (InstantiationException ex) {
+ java.util.logging.Logger.getLogger(ManageCategory.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ java.util.logging.Logger.getLogger(ManageCategory.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(ManageCategory.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+ //
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new ManageCategory().setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnClear;
+ private javax.swing.JButton btnSave;
+ private javax.swing.JButton jButton2;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JTable jTable1;
+ private javax.swing.JTextField txtName;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/system/PlaceOrder.form b/system/PlaceOrder.form
new file mode 100644
index 0000000..bc95805
--- /dev/null
+++ b/system/PlaceOrder.form
@@ -0,0 +1,624 @@
+
+
+
diff --git a/system/PlaceOrder.java b/system/PlaceOrder.java
new file mode 100644
index 0000000..f79966b
--- /dev/null
+++ b/system/PlaceOrder.java
@@ -0,0 +1,646 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
+ */
+package cafe.management.system;
+
+import com.itextpdf.text.Paragraph;
+import com.itextpdf.text.pdf.PdfPTable;
+import com.itextpdf.text.pdf.PdfWriter;
+import common.OpenPdf;
+import dao.BillDao;
+import dao.CategoryDao;
+import dao.ProductDao;
+import java.io.FileOutputStream;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import javax.swing.JFormattedTextField;
+import javax.swing.JOptionPane;
+import javax.swing.JSpinner;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableModel;
+import model.Bill;
+import model.Category;
+import model.Product;
+
+
+/**
+ *
+ * @author Acer
+ */
+public class PlaceOrder extends javax.swing.JFrame {
+ public int billId = 1;
+ public int grandTotal = 0;
+ public int productPrice = 0;
+ public int productTotal = 0;
+ public String emailPattern = "^[a-zA-Z0-9]+[@]+[a-zA-Z0-9]+[.]+[a-zA-Z0-9]+$";
+ public String phoneNumberPattern = "^[0-9]*$";
+ public String userEmail;
+ /**
+ * Creates new form PlaceOrder
+ */
+ public PlaceOrder() {
+ initComponents();
+ }
+
+ public PlaceOrder(String email) {
+ initComponents();
+
+ //product details fiels should be disabled
+ txtProName.setEditable(false);
+ txtProPrice.setEditable(false);
+ txtProTotal.setEditable(false);
+ btnAddToCart.setEnabled(false);
+ btnGenerateBillPrint.setEnabled(false);
+
+ JFormattedTextField tf = ((JSpinner.DefaultEditor) jSpinner1.getEditor()).getTextField();
+ tf.setEditable(false);
+ userEmail = email;
+ }
+
+ public void productNameByCategory(String category){
+ DefaultTableModel dtm = (DefaultTableModel) jTable1.getModel();
+ dtm.setRowCount(0);
+ ArrayList list = ProductDao.getAllRecordsByCategory(category);
+ Iterator itr = list.iterator();
+ while(itr.hasNext())
+ {
+ Product productObj = itr.next();
+ dtm.addRow(new Object[]{productObj.getName()});
+
+ }
+ }
+
+ public void filterProductByname(String name, String category){
+ DefaultTableModel dtm = (DefaultTableModel) jTable1.getModel();
+ dtm.setRowCount(0);
+ ArrayList list = ProductDao.filterProductByname(name,category);
+ Iterator itr = list.iterator();
+ while(itr.hasNext())
+ {
+ Product productObj = itr.next();
+ dtm.addRow(new Object[]{productObj.getName()});
+
+ }
+ }
+
+ public void clearProductFields(){
+ txtProName.setText("");
+ txtProPrice.setText("");
+ jSpinner1.setValue(1);
+ txtProTotal.setText("");
+ btnAddToCart.setEnabled(false);
+ }
+
+ public void validateField(){
+ String customerName = txtCusName.getText();
+ String customerPhoneNumber = txtCusPhoneNo.getText();
+ String customerEmail = txtCusEmail.getText();
+ if(!customerName.equals("") && customerPhoneNumber.matches(phoneNumberPattern) && customerPhoneNumber.length()==10 && customerEmail.matches(emailPattern) && grandTotal>0)
+ {
+ btnGenerateBillPrint.setEnabled(true);
+ }
+ else
+ {
+ btnGenerateBillPrint.setEnabled(false);
+ }
+ }
+
+ /**
+ * 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+ jButton1 = new javax.swing.JButton();
+ jLabel2 = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+ jLabel4 = new javax.swing.JLabel();
+ txtCusName = new javax.swing.JTextField();
+ jLabel5 = new javax.swing.JLabel();
+ txtCusPhoneNo = new javax.swing.JTextField();
+ jLabel6 = new javax.swing.JLabel();
+ txtCusEmail = new javax.swing.JTextField();
+ jLabel7 = new javax.swing.JLabel();
+ jLabel8 = new javax.swing.JLabel();
+ jComboBox1 = new javax.swing.JComboBox<>();
+ jLabel9 = new javax.swing.JLabel();
+ txtSearch = new javax.swing.JTextField();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ jTable1 = new javax.swing.JTable();
+ jLabel10 = new javax.swing.JLabel();
+ txtProName = new javax.swing.JTextField();
+ jLabel11 = new javax.swing.JLabel();
+ txtProPrice = new javax.swing.JTextField();
+ jLabel12 = new javax.swing.JLabel();
+ jSpinner1 = new javax.swing.JSpinner();
+ jLabel13 = new javax.swing.JLabel();
+ txtProTotal = new javax.swing.JTextField();
+ btnClear = new javax.swing.JButton();
+ btnAddToCart = new javax.swing.JButton();
+ jScrollPane2 = new javax.swing.JScrollPane();
+ jTable2 = new javax.swing.JTable();
+ jLabel14 = new javax.swing.JLabel();
+ btnGenerateBillPrint = new javax.swing.JButton();
+ lblGrandTotal = new javax.swing.JLabel();
+ jLabel16 = new javax.swing.JLabel();
+ jLabel15 = new javax.swing.JLabel();
+ jLabel18 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setUndecorated(true);
+ addComponentListener(new java.awt.event.ComponentAdapter() {
+ public void componentShown(java.awt.event.ComponentEvent evt) {
+ formComponentShown(evt);
+ }
+ });
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ jLabel1.setFont(new java.awt.Font("Bookman Old Style", 1, 24)); // NOI18N
+ jLabel1.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/place order.png"))); // NOI18N
+ jLabel1.setText("Place Order");
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 6, 180, -1));
+
+ jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/close.png"))); // NOI18N
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton1ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(1334, 6, -1, -1));
+
+ jLabel2.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel2.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel2.setText("Bill ID : ");
+ getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 280, -1, -1));
+
+ jLabel3.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel3.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel3.setText("--");
+ getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 280, 37, -1));
+
+ jLabel4.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel4.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel4.setText("Name :");
+ getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 400, -1, -1));
+
+ txtCusName.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtCusName.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtCusNameKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtCusName, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 430, 254, -1));
+
+ jLabel5.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel5.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel5.setText("Phone Number :");
+ getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 490, -1, -1));
+
+ txtCusPhoneNo.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtCusPhoneNo.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtCusPhoneNoKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtCusPhoneNo, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 520, 254, -1));
+
+ jLabel6.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel6.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel6.setText("Email :");
+ getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 580, -1, -1));
+
+ txtCusEmail.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtCusEmail.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtCusEmailKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtCusEmail, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 610, 254, -1));
+
+ jLabel7.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel7.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel7.setText("Customer Details - ");
+ getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 360, -1, -1));
+
+ jLabel8.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel8.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel8.setText("Category :");
+ getContentPane().add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(324, 92, -1, -1));
+
+ jComboBox1.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jComboBox1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jComboBox1ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(324, 126, 250, -1));
+
+ jLabel9.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel9.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel9.setText("Search :");
+ getContentPane().add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(324, 170, -1, -1));
+
+ txtSearch.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtSearch.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtSearchKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtSearch, new org.netbeans.lib.awtextra.AbsoluteConstraints(324, 210, 250, -1));
+
+ jTable1.setFont(new java.awt.Font("Bookman Old Style", 1, 14)); // NOI18N
+ jTable1.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+
+ },
+ new String [] {
+ "Name"
+ }
+ ));
+ jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ jTable1MouseClicked(evt);
+ }
+ });
+ jScrollPane1.setViewportView(jTable1);
+
+ getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(324, 278, 250, 395));
+
+ jLabel10.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel10.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel10.setText("Name :");
+ getContentPane().add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(662, 92, -1, -1));
+
+ txtProName.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ getContentPane().add(txtProName, new org.netbeans.lib.awtextra.AbsoluteConstraints(662, 126, 250, -1));
+
+ jLabel11.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel11.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel11.setText("Price :");
+ getContentPane().add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(1055, 92, -1, -1));
+
+ txtProPrice.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ getContentPane().add(txtProPrice, new org.netbeans.lib.awtextra.AbsoluteConstraints(1055, 126, 252, -1));
+
+ jLabel12.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel12.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel12.setText("Quantity :");
+ getContentPane().add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(662, 170, -1, -1));
+
+ jSpinner1.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jSpinner1.addChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent evt) {
+ jSpinner1StateChanged(evt);
+ }
+ });
+ getContentPane().add(jSpinner1, new org.netbeans.lib.awtextra.AbsoluteConstraints(662, 210, 250, -1));
+
+ jLabel13.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel13.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel13.setText("Total :");
+ getContentPane().add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(1055, 170, -1, -1));
+
+ txtProTotal.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ getContentPane().add(txtProTotal, new org.netbeans.lib.awtextra.AbsoluteConstraints(1055, 210, 252, -1));
+
+ btnClear.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnClear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/clear.png"))); // NOI18N
+ btnClear.setText("Clear");
+ btnClear.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnClearActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnClear, new org.netbeans.lib.awtextra.AbsoluteConstraints(662, 278, -1, -1));
+
+ btnAddToCart.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnAddToCart.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/add to cart.png"))); // NOI18N
+ btnAddToCart.setText("Add to Cart");
+ btnAddToCart.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnAddToCartActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnAddToCart, new org.netbeans.lib.awtextra.AbsoluteConstraints(1141, 278, -1, -1));
+
+ jTable2.setFont(new java.awt.Font("Bookman Old Style", 1, 14)); // NOI18N
+ jTable2.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+
+ },
+ new String [] {
+ "Name", "Price", "Quantity", "Total"
+ }
+ ));
+ jTable2.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ jTable2MouseClicked(evt);
+ }
+ });
+ jScrollPane2.setViewportView(jTable2);
+
+ getContentPane().add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(662, 333, 645, 340));
+
+ jLabel14.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel14.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel14.setText("Grand Total : Rs.");
+ getContentPane().add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(662, 685, -1, -1));
+
+ btnGenerateBillPrint.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnGenerateBillPrint.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/generate bill & print.png"))); // NOI18N
+ btnGenerateBillPrint.setText("Generate Bill & Print");
+ btnGenerateBillPrint.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnGenerateBillPrintActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnGenerateBillPrint, new org.netbeans.lib.awtextra.AbsoluteConstraints(1051, 685, -1, -1));
+
+ lblGrandTotal.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ lblGrandTotal.setForeground(new java.awt.Color(255, 255, 255));
+ lblGrandTotal.setText("000");
+ getContentPane().add(lblGrandTotal, new org.netbeans.lib.awtextra.AbsoluteConstraints(838, 685, 160, -1));
+
+ jLabel16.setFont(new java.awt.Font("Bookman Old Style", 3, 48)); // NOI18N
+ jLabel16.setForeground(new java.awt.Color(153, 102, 255));
+ jLabel16.setText("Cafex");
+ getContentPane().add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 110, 150, -1));
+
+ jLabel15.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel15.setForeground(new java.awt.Color(255, 153, 255));
+ jLabel15.setText("The True cafe of Love");
+ getContentPane().add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 170, -1, -1));
+
+ jLabel18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/home-background-image.png"))); // NOI18N
+ getContentPane().add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
+ // TODO add your handling code here:
+ clearProductFields();
+ }//GEN-LAST:event_btnClearActionPerformed
+
+ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ new Home(userEmail).setVisible(true);
+
+ }//GEN-LAST:event_jButton1ActionPerformed
+
+ private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
+ // TODO add your handling code here:
+ billId = Integer.parseInt(BillDao.getId());
+ jLabel3.setText(BillDao.getId());
+ ArrayList list = CategoryDao.getAllRecords();
+ Iterator itr = list.iterator();
+ while(itr.hasNext())
+ {
+ Category categoryObj = itr.next();
+ jComboBox1.addItem(categoryObj.getName());
+ }
+ String category = (String) jComboBox1.getSelectedItem();
+ productNameByCategory(category);
+ }//GEN-LAST:event_formComponentShown
+
+ private void txtSearchKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtSearchKeyReleased
+ // TODO add your handling code here:
+ String name = txtSearch.getText();
+ String category = (String) jComboBox1.getSelectedItem();
+ filterProductByname(name,category);
+ }//GEN-LAST:event_txtSearchKeyReleased
+
+ private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
+ // TODO add your handling code here:
+ int index = jTable1.getSelectedRow();
+ TableModel model = jTable1.getModel();
+ String productName = model.getValueAt(index, 0).toString();
+ Product product = ProductDao.getProductByname(productName);
+ txtProName.setText(product.getName());
+ txtProPrice.setText(product.getPrice());
+ jSpinner1.setValue(1);
+ txtProTotal.setText(product.getPrice());
+ productPrice = Integer.parseInt(product.getPrice());
+ productTotal = Integer.parseInt(product.getPrice());
+ btnAddToCart.setEnabled(true);
+ }//GEN-LAST:event_jTable1MouseClicked
+
+ private void jSpinner1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSpinner1StateChanged
+ // TODO add your handling code here:
+ int quantity = (Integer) jSpinner1.getValue();
+ if(quantity<=1)
+ {
+ jSpinner1.setValue(1);
+ quantity = 1;
+ }
+
+ productTotal = productPrice * quantity;
+ txtProTotal.setText(String.valueOf(productTotal));
+
+ }//GEN-LAST:event_jSpinner1StateChanged
+
+ private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
+ // TODO add your handling code here:
+ String category = (String) jComboBox1.getSelectedItem();
+ productNameByCategory(category);
+ }//GEN-LAST:event_jComboBox1ActionPerformed
+
+ private void btnAddToCartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddToCartActionPerformed
+ // TODO add your handling code here:
+ String name = txtProName.getText();
+ String price = txtProPrice.getText();
+ String quantity = String.valueOf(jSpinner1.getValue());
+ DefaultTableModel dtm = (DefaultTableModel) jTable2.getModel();
+ dtm.addRow(new Object[]{name,price,quantity,productTotal});
+
+ grandTotal = grandTotal + productTotal;
+ lblGrandTotal.setText(String.valueOf(grandTotal));
+
+ clearProductFields();
+ validateField();
+ }//GEN-LAST:event_btnAddToCartActionPerformed
+
+ private void txtCusNameKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCusNameKeyReleased
+ // TODO add your handling code here:
+ validateField();
+ }//GEN-LAST:event_txtCusNameKeyReleased
+
+ private void txtCusPhoneNoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCusPhoneNoKeyReleased
+ // TODO add your handling code here:
+ validateField();
+ }//GEN-LAST:event_txtCusPhoneNoKeyReleased
+
+ private void txtCusEmailKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCusEmailKeyReleased
+ // TODO add your handling code here:
+ validateField();
+ }//GEN-LAST:event_txtCusEmailKeyReleased
+
+ private void btnGenerateBillPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGenerateBillPrintActionPerformed
+ // TODO add your handling code here:
+ String customerName = txtCusName.getText();
+ String customerPhoneNumber = txtCusPhoneNo.getText();
+ String customerEmail = txtCusEmail.getText();
+
+ SimpleDateFormat dFormat = new SimpleDateFormat("dd-MM-yyyy");
+ Date date = new Date();
+ String todaydate = dFormat.format(date);
+
+ String total = String.valueOf(grandTotal);
+ String createdBy = userEmail;
+
+ Bill bill = new Bill();
+ bill.setId(billId);
+ bill.setName(customerName);
+ bill.setPhoneNumber(customerPhoneNumber);
+ bill.setEmail(customerEmail);
+ bill.setDate(todaydate);
+ bill.setCreatedBy(createdBy);
+ BillDao.save(bill);
+
+// create bill Doc
+ String path = "E:\\";
+ com.itextpdf.text.Document doc = new com.itextpdf.text.Document();
+
+
+ try{
+ PdfWriter.getInstance(doc, new FileOutputStream(path + "" + billId +".pdf"));
+ doc.open();
+ Paragraph cafeName = new Paragraph(" Cafex\n");
+ doc.add(cafeName);
+ Paragraph starLine = new Paragraph("***************************************************************************************************************");
+ doc.add(starLine);
+ Paragraph paragraph3 = new Paragraph("\tBill ID: "+billId+"\nCustomer Name: "+customerName+"\nTotal Amount: "+grandTotal);
+ doc.add(paragraph3);
+ doc.add(starLine);
+ PdfPTable tb1 = new PdfPTable(4);
+ tb1.addCell("Name");
+ tb1.addCell("Price");
+ tb1.addCell("Quantity");
+ tb1.addCell("Total");
+ for(int i=0; i
+ /* 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(PlaceOrder.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (InstantiationException ex) {
+ java.util.logging.Logger.getLogger(PlaceOrder.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ java.util.logging.Logger.getLogger(PlaceOrder.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(PlaceOrder.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+ //
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new PlaceOrder().setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnAddToCart;
+ private javax.swing.JButton btnClear;
+ private javax.swing.JButton btnGenerateBillPrint;
+ private javax.swing.JButton jButton1;
+ private javax.swing.JComboBox jComboBox1;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel10;
+ private javax.swing.JLabel jLabel11;
+ private javax.swing.JLabel jLabel12;
+ private javax.swing.JLabel jLabel13;
+ private javax.swing.JLabel jLabel14;
+ private javax.swing.JLabel jLabel15;
+ private javax.swing.JLabel jLabel16;
+ private javax.swing.JLabel jLabel18;
+ 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.JScrollPane jScrollPane1;
+ private javax.swing.JScrollPane jScrollPane2;
+ private javax.swing.JSpinner jSpinner1;
+ private javax.swing.JTable jTable1;
+ private javax.swing.JTable jTable2;
+ private javax.swing.JLabel lblGrandTotal;
+ private javax.swing.JTextField txtCusEmail;
+ private javax.swing.JTextField txtCusName;
+ private javax.swing.JTextField txtCusPhoneNo;
+ private javax.swing.JTextField txtProName;
+ private javax.swing.JTextField txtProPrice;
+ private javax.swing.JTextField txtProTotal;
+ private javax.swing.JTextField txtSearch;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/system/Signup.form b/system/Signup.form
new file mode 100644
index 0000000..b94988a
--- /dev/null
+++ b/system/Signup.form
@@ -0,0 +1,402 @@
+
+
+
diff --git a/system/Signup.java b/system/Signup.java
new file mode 100644
index 0000000..219cd47
--- /dev/null
+++ b/system/Signup.java
@@ -0,0 +1,432 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
+ */
+package cafe.management.system;
+import javax.swing.JOptionPane;
+import model.User;
+import dao.UserDao;
+
+/**
+ *
+ * @author Acer
+ */
+public class Signup extends javax.swing.JFrame {
+
+// email and mobile number pattern
+ public String emailPattern = "^[a-zA-Z0-9]+[@]+[a-zA-Z0-9]+[.]+[a-zA-Z0-9]+$";
+ public String phoneNumberPattern = "^[0-9]*$";
+ /*
+ * Creates new form SignUp
+ */
+ public Signup() {
+ initComponents();
+
+ //when ever this page is load save button is disabled-->so use this code
+ btnSave.setEnabled(false);
+
+ }
+
+ //create a clear method
+ //when this function call it clear all the fields and disabled the save button
+ public void clear(){
+ txtName.setText("");
+ txtEmail.setText("");
+ txtPhoneNumber.setText("");
+ txtAddress.setText("");
+ txtSecurityQuestion.setText("");
+ txtAnswer.setText("");
+ txtPassword.setText("");
+ btnSave.setEnabled(false);
+ }
+
+// function for data validation
+ public void validateFields(){
+ //here we match the things with the pattern
+ String name = txtName.getText();
+ String email = txtEmail.getText();
+ String phoneNumber = txtPhoneNumber.getText();
+ String address = txtAddress.getText();
+ String password = txtPassword.getText();
+ String securityQuestion = txtSecurityQuestion.getText();
+ String answer = txtAnswer.getText();
+
+ //condition for validation
+ if(!name.equals("") && email.matches(emailPattern) && phoneNumber.matches(phoneNumberPattern) && phoneNumber.length() == 10 && !address.equals("") && !password.equals("") && !securityQuestion.equals("") && !answer.equals(""))
+ {
+ btnSave.setEnabled(true);
+ }
+ else
+ {
+ btnSave.setEnabled(false);
+ }
+ }
+
+ /**
+ * 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")
+ // //GEN-BEGIN:initComponents
+ 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();
+ jLabel6 = new javax.swing.JLabel();
+ jLabel7 = new javax.swing.JLabel();
+ jLabel8 = new javax.swing.JLabel();
+ txtName = new javax.swing.JTextField();
+ txtEmail = new javax.swing.JTextField();
+ txtPhoneNumber = new javax.swing.JTextField();
+ txtAddress = new javax.swing.JTextField();
+ txtPassword = new javax.swing.JPasswordField();
+ txtSecurityQuestion = new javax.swing.JTextField();
+ txtAnswer = new javax.swing.JTextField();
+ btnSave = new javax.swing.JButton();
+ btnExit = new javax.swing.JButton();
+ btnClear = new javax.swing.JButton();
+ jButton4 = new javax.swing.JButton();
+ jButton5 = new javax.swing.JButton();
+ jLabel9 = new javax.swing.JLabel();
+ jLabel10 = new javax.swing.JLabel();
+ jLabel11 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setUndecorated(true);
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ jLabel1.setFont(new java.awt.Font("Sitka Text", 1, 36)); // NOI18N
+ jLabel1.setForeground(new java.awt.Color(255, 102, 102));
+ jLabel1.setText("SignUp");
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(590, 190, -1, 57));
+
+ jLabel2.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel2.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel2.setText("Name");
+ getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 280, -1, -1));
+
+ jLabel3.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel3.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel3.setText("Email");
+ getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 320, 121, -1));
+
+ jLabel4.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel4.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel4.setText("Phone Number");
+ getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 360, -1, -1));
+
+ jLabel5.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel5.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel5.setText("Address");
+ getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 400, -1, -1));
+
+ jLabel6.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel6.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel6.setText("Password");
+ getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 450, -1, -1));
+
+ jLabel7.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel7.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel7.setText("Security Question");
+ getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 490, -1, -1));
+
+ jLabel8.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel8.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel8.setText("Answer");
+ getContentPane().add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 530, -1, -1));
+
+ txtName.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtName.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ txtNameActionPerformed(evt);
+ }
+ });
+ txtName.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtNameKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtName, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 270, 351, -1));
+
+ txtEmail.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtEmail.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ txtEmailActionPerformed(evt);
+ }
+ });
+ txtEmail.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtEmailKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtEmail, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 320, 351, -1));
+
+ txtPhoneNumber.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtPhoneNumber.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtPhoneNumberKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtPhoneNumber, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 360, 351, -1));
+
+ txtAddress.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtAddress.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ txtAddressActionPerformed(evt);
+ }
+ });
+ txtAddress.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtAddressKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtAddress, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 400, 351, -1));
+
+ txtPassword.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtPassword.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtPasswordKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtPassword, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 450, 351, -1));
+
+ txtSecurityQuestion.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtSecurityQuestion.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtSecurityQuestionKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtSecurityQuestion, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 490, 351, -1));
+
+ txtAnswer.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtAnswer.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtAnswerKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtAnswer, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 530, 351, -1));
+
+ btnSave.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/save.png"))); // NOI18N
+ btnSave.setText("Save");
+ btnSave.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSaveActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnSave, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 600, -1, -1));
+
+ btnExit.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/exit small.png"))); // NOI18N
+ btnExit.setText("Exit");
+ btnExit.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnExitActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnExit, new org.netbeans.lib.awtextra.AbsoluteConstraints(850, 600, -1, -1));
+
+ btnClear.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnClear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/clear.png"))); // NOI18N
+ btnClear.setText("Clear");
+ btnClear.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnClearActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnClear, new org.netbeans.lib.awtextra.AbsoluteConstraints(720, 600, -1, -1));
+
+ jButton4.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jButton4.setText("Forget Password ?");
+ jButton4.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton4ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 670, -1, -1));
+
+ jButton5.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jButton5.setText("Login");
+ jButton5.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton5ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(860, 670, -1, -1));
+
+ jLabel9.setFont(new java.awt.Font("Bookman Old Style", 3, 48)); // NOI18N
+ jLabel9.setForeground(new java.awt.Color(204, 0, 204));
+ jLabel9.setText("Cafex");
+ getContentPane().add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(570, 24, 150, -1));
+
+ jLabel10.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel10.setForeground(new java.awt.Color(255, 153, 255));
+ jLabel10.setText("The True cafe of Love");
+ getContentPane().add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(541, 88, -1, -1));
+
+ jLabel11.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/home-background-image.png"))); // NOI18N
+ getContentPane().add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void txtNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNameActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_txtNameActionPerformed
+
+ private void txtEmailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtEmailActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_txtEmailActionPerformed
+
+ private void txtAddressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtAddressActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_txtAddressActionPerformed
+
+ private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
+ // TODO add your handling code here:
+ //create a new Object of user class
+ User user = new User();
+ user.setName(txtName.getText());
+ user.setEmail(txtEmail.getText());
+ user.setPhoneNumber(txtPhoneNumber.getText());
+ user.setAddress(txtAddress.getText());
+ user.setPassword(txtPassword.getText());
+ user.setSecurityQuestion(txtSecurityQuestion.getText());
+ user.setAnswer(txtAnswer.getText());
+
+ //now call user dao method
+ UserDao.save(user);
+ //this will execute the user query get all data of user
+ clear();
+
+ }//GEN-LAST:event_btnSaveActionPerformed
+
+ private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExitActionPerformed
+ // TODO add your handling code here:
+ //when user click on exit it will show a message
+ int a = JOptionPane.showConfirmDialog(null,"Do you really want to Close Application","Select",JOptionPane.YES_NO_OPTION);
+ //if user select YES
+ if(a==0)
+ {
+ System.exit(0);
+ }
+ }//GEN-LAST:event_btnExitActionPerformed
+
+ private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
+ // TODO add your handling code here:
+ clear();
+ }//GEN-LAST:event_btnClearActionPerformed
+
+ private void txtNameKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNameKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtNameKeyReleased
+
+ private void txtEmailKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtEmailKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtEmailKeyReleased
+
+ private void txtPhoneNumberKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPhoneNumberKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtPhoneNumberKeyReleased
+
+ private void txtAddressKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtAddressKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtAddressKeyReleased
+
+ private void txtPasswordKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPasswordKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtPasswordKeyReleased
+
+ private void txtSecurityQuestionKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtSecurityQuestionKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtSecurityQuestionKeyReleased
+
+ private void txtAnswerKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtAnswerKeyReleased
+ // TODO add your handling code here:
+ validateFields();
+ }//GEN-LAST:event_txtAnswerKeyReleased
+
+ private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ new Login().setVisible(true);
+ }//GEN-LAST:event_jButton5ActionPerformed
+
+ private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ new ForgotPassword().setVisible(true);
+ }//GEN-LAST:event_jButton4ActionPerformed
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* Set the Nimbus look and feel */
+ //
+ /* 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(Signup.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (InstantiationException ex) {
+ java.util.logging.Logger.getLogger(Signup.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ java.util.logging.Logger.getLogger(Signup.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(Signup.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+ //
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new Signup().setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnClear;
+ private javax.swing.JButton btnExit;
+ private javax.swing.JButton btnSave;
+ private javax.swing.JButton jButton4;
+ private javax.swing.JButton jButton5;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel10;
+ private javax.swing.JLabel jLabel11;
+ 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 txtAddress;
+ private javax.swing.JTextField txtAnswer;
+ private javax.swing.JTextField txtEmail;
+ private javax.swing.JTextField txtName;
+ private javax.swing.JPasswordField txtPassword;
+ private javax.swing.JTextField txtPhoneNumber;
+ private javax.swing.JTextField txtSecurityQuestion;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/system/VerifyUsers.form b/system/VerifyUsers.form
new file mode 100644
index 0000000..3470851
--- /dev/null
+++ b/system/VerifyUsers.form
@@ -0,0 +1,203 @@
+
+
+
diff --git a/system/VerifyUsers.java b/system/VerifyUsers.java
new file mode 100644
index 0000000..8e9fcb5
--- /dev/null
+++ b/system/VerifyUsers.java
@@ -0,0 +1,214 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
+ */
+package cafe.management.system;
+
+import java.util.ArrayList;
+import javax.swing.table.DefaultTableModel;
+import model.User;
+import dao.UserDao;
+import java.util.Iterator;
+import javax.swing.JOptionPane;
+import javax.swing.table.TableModel;
+
+/**
+ *
+ * @author Acer
+ */
+public class VerifyUsers extends javax.swing.JFrame {
+
+ /**
+ * Creates new form VerifyUsers
+ */
+ public VerifyUsers() {
+ initComponents();
+ }
+
+// create a method when this page load and any one search for user
+ public void getAllRecords(String email){
+ DefaultTableModel dtm = (DefaultTableModel) jTable1.getModel();
+ dtm.setRowCount(0);
+ ArrayList list = UserDao.getAllRecords(email);
+ Iterator itr = list.iterator();
+ while(itr.hasNext())
+ {
+ User userObj = itr.next();
+ if(!userObj.getEmail().equals("admin@gmail.com"))
+ {
+ dtm.addRow(new Object[]{userObj.getId(),userObj.getName(),userObj.getEmail(),userObj.getPhoneNumber(),userObj.getAddress(),userObj.getSecurityQuestion(),userObj.getStatus()});
+
+ }
+ }
+
+ }
+
+ /**
+ * 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+ jButton1 = new javax.swing.JButton();
+ jLabel2 = new javax.swing.JLabel();
+ txtEmail = new javax.swing.JTextField();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ jTable1 = new javax.swing.JTable();
+ jLabel3 = new javax.swing.JLabel();
+ jLabel5 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setUndecorated(true);
+ addComponentListener(new java.awt.event.ComponentAdapter() {
+ public void componentShown(java.awt.event.ComponentEvent evt) {
+ formComponentShown(evt);
+ }
+ });
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ jLabel1.setFont(new java.awt.Font("Bookman Old Style", 1, 24)); // NOI18N
+ jLabel1.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/verify users.png"))); // NOI18N
+ jLabel1.setText("Verify Users");
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 6, -1, -1));
+
+ jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/close.png"))); // NOI18N
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton1ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(1334, 6, -1, -1));
+
+ jLabel2.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel2.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel2.setText("Search");
+ getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(462, 106, -1, -1));
+
+ txtEmail.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtEmail.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtEmailKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtEmail, new org.netbeans.lib.awtextra.AbsoluteConstraints(557, 103, 300, -1));
+
+ jTable1.setFont(new java.awt.Font("Bookman Old Style", 1, 14)); // NOI18N
+ jTable1.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+
+ },
+ new String [] {
+ "ID", "Name", "Email", "Phone Number", "Address", "Security Question", "Status"
+ }
+ ));
+ jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ jTable1MouseClicked(evt);
+ }
+ });
+ jScrollPane1.setViewportView(jTable1);
+
+ getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(33, 186, 1299, 458));
+
+ jLabel3.setFont(new java.awt.Font("Bookman Old Style", 1, 14)); // NOI18N
+ jLabel3.setForeground(new java.awt.Color(255, 153, 51));
+ jLabel3.setText("*Click on Row to Change Status");
+ getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(33, 656, -1, -1));
+
+ jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/home-background-image.png"))); // NOI18N
+ getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
+ // TODO add your handling code here:
+ getAllRecords("");
+ }//GEN-LAST:event_formComponentShown
+
+ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ }//GEN-LAST:event_jButton1ActionPerformed
+
+ private void txtEmailKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtEmailKeyReleased
+ // TODO add your handling code here:
+ String email = txtEmail.getText();
+ getAllRecords(email);
+ }//GEN-LAST:event_txtEmailKeyReleased
+
+ private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
+ // TODO add your handling code here:
+ int index = jTable1.getSelectedRow();
+ TableModel model = jTable1.getModel();
+ String email = model.getValueAt(index, 2).toString();
+ String status = model.getValueAt(index, 6).toString();
+ if(!status.equals("true"))
+ {
+ status = "true";
+ }
+ else
+ {
+ status = "false";
+ }
+
+ int a = JOptionPane.showConfirmDialog(null,"Do you want to Change Status of "+email+"","Select",JOptionPane.YES_NO_OPTION);
+ if(a==0)
+ {
+ UserDao.changeStatus(email, status);
+ setVisible(false);
+ new VerifyUsers().setVisible(true);
+ }
+ }//GEN-LAST:event_jTable1MouseClicked
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* Set the Nimbus look and feel */
+ //
+ /* 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(VerifyUsers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (InstantiationException ex) {
+ java.util.logging.Logger.getLogger(VerifyUsers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ java.util.logging.Logger.getLogger(VerifyUsers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(VerifyUsers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+ //
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new VerifyUsers().setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton jButton1;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JTable jTable1;
+ private javax.swing.JTextField txtEmail;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/system/ViewBillsOrderPlacedDetails.form b/system/ViewBillsOrderPlacedDetails.form
new file mode 100644
index 0000000..93d34be
--- /dev/null
+++ b/system/ViewBillsOrderPlacedDetails.form
@@ -0,0 +1,246 @@
+
+
+
diff --git a/system/ViewBillsOrderPlacedDetails.java b/system/ViewBillsOrderPlacedDetails.java
new file mode 100644
index 0000000..8f0dadd
--- /dev/null
+++ b/system/ViewBillsOrderPlacedDetails.java
@@ -0,0 +1,239 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
+ */
+package cafe.management.system;
+
+import common.OpenPdf;
+import dao.BillDao;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableModel;
+import model.Bill;
+
+/**
+ *
+ * @author Acer
+ */
+public class ViewBillsOrderPlacedDetails extends javax.swing.JFrame {
+
+ /**
+ * Creates new form ViewBillsOrderPlacedDetails
+ */
+ public ViewBillsOrderPlacedDetails() {
+ initComponents();
+ SimpleDateFormat dFormat = new SimpleDateFormat("dd-MM-yyyy");
+ Date date = new Date();
+ String todayDate = dFormat.format(date);
+ jTextField1.setText(todayDate);
+ }
+
+ //method fro change the data of table
+ public void tableDetails(){
+ String date = jTextField1.getText();
+ String incDec = (String) jComboBox1.getSelectedItem();
+ DefaultTableModel dtm = (DefaultTableModel) jTable1.getModel();
+ dtm.setRowCount(0);
+ if(incDec.equals("INC"))
+ {
+ ArrayList list = BillDao.getAllRecordsByInc(date);
+ Iterator itr = list.iterator();
+ while(itr.hasNext())
+ {
+ Bill billObj = itr.next();
+ dtm.addRow(new Object[]{billObj.getId(),billObj.getName(),billObj.getPhoneNumber(),billObj.getEmail(),billObj.getDate(),billObj.getTotal(),billObj.getCreatedBy()});
+
+ }
+ }
+ else
+ {
+ ArrayList list = BillDao.getAllRecordsByDesc(date);
+ Iterator itr = list.iterator();
+ while(itr.hasNext())
+ {
+ Bill billObj = itr.next();
+ dtm.addRow(new Object[]{billObj.getId(),billObj.getName(),billObj.getPhoneNumber(),billObj.getEmail(),billObj.getDate(),billObj.getTotal(),billObj.getCreatedBy()});
+
+ }
+ }
+ }
+
+ /**
+ * 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+ jButton1 = new javax.swing.JButton();
+ jLabel2 = new javax.swing.JLabel();
+ jTextField1 = new javax.swing.JTextField();
+ jLabel3 = new javax.swing.JLabel();
+ jComboBox1 = new javax.swing.JComboBox<>();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ jTable1 = new javax.swing.JTable();
+ jLabel4 = new javax.swing.JLabel();
+ jLabel6 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setUndecorated(true);
+ addComponentListener(new java.awt.event.ComponentAdapter() {
+ public void componentShown(java.awt.event.ComponentEvent evt) {
+ formComponentShown(evt);
+ }
+ });
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ jLabel1.setFont(new java.awt.Font("Bookman Old Style", 1, 24)); // NOI18N
+ jLabel1.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/View Bills & Order Placed Details.png"))); // NOI18N
+ jLabel1.setText("View Bills & Order Placed Details");
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 6, -1, -1));
+
+ jButton1.setFont(new java.awt.Font("Segoe UI", 0, 24)); // NOI18N
+ jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/close.png"))); // NOI18N
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton1ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(1334, 6, -1, -1));
+
+ jLabel2.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel2.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel2.setText("Filter By Date");
+ getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 132, -1, -1));
+
+ jTextField1.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ jTextField1KeyReleased(evt);
+ }
+ });
+ getContentPane().add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(331, 126, 270, -1));
+
+ jLabel3.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel3.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel3.setText("Change Order by ID");
+ getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(711, 132, -1, -1));
+
+ jComboBox1.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "INC", "DESC" }));
+ jComboBox1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jComboBox1ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(927, 126, 270, -1));
+
+ jTable1.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jTable1.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+
+ },
+ new String [] {
+ "ID", "Name", "Phone Number", "Email", "Date", "Total", "CreatedBy"
+ }
+ ));
+ jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ jTable1MouseClicked(evt);
+ }
+ });
+ jScrollPane1.setViewportView(jTable1);
+
+ getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(33, 217, 1300, 475));
+
+ jLabel4.setFont(new java.awt.Font("Bookman Old Style", 1, 14)); // NOI18N
+ jLabel4.setForeground(new java.awt.Color(255, 153, 51));
+ jLabel4.setText("*Click on Row to View Bill Details");
+ getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(33, 710, -1, -1));
+
+ jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/home-background-image.png"))); // NOI18N
+ getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ }//GEN-LAST:event_jButton1ActionPerformed
+
+ private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyReleased
+ // TODO add your handling code here:
+ tableDetails();
+ }//GEN-LAST:event_jTextField1KeyReleased
+
+ private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
+ // TODO add your handling code here:
+ tableDetails();
+ }//GEN-LAST:event_jComboBox1ActionPerformed
+
+ private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
+ // TODO add your handling code here:
+ int index = jTable1.getSelectedRow();
+ TableModel model = jTable1.getModel();
+ String id = model.getValueAt(index, 0).toString();
+ OpenPdf.openById(id);
+ }//GEN-LAST:event_jTable1MouseClicked
+
+ private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
+ // TODO add your handling code here:
+ tableDetails();
+ }//GEN-LAST:event_formComponentShown
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* Set the Nimbus look and feel */
+ //
+ /* 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(ViewBillsOrderPlacedDetails.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (InstantiationException ex) {
+ java.util.logging.Logger.getLogger(ViewBillsOrderPlacedDetails.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ java.util.logging.Logger.getLogger(ViewBillsOrderPlacedDetails.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(ViewBillsOrderPlacedDetails.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+ //
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new ViewBillsOrderPlacedDetails().setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton jButton1;
+ private javax.swing.JComboBox jComboBox1;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel6;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JTable jTable1;
+ private javax.swing.JTextField jTextField1;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/system/ViewEditDeleteProduct.form b/system/ViewEditDeleteProduct.form
new file mode 100644
index 0000000..492d112
--- /dev/null
+++ b/system/ViewEditDeleteProduct.form
@@ -0,0 +1,323 @@
+
+
+
diff --git a/system/ViewEditDeleteProduct.java b/system/ViewEditDeleteProduct.java
new file mode 100644
index 0000000..8c50944
--- /dev/null
+++ b/system/ViewEditDeleteProduct.java
@@ -0,0 +1,334 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
+ */
+package cafe.management.system;
+import dao.CategoryDao;
+import dao.ProductDao;
+import java.util.ArrayList;
+import java.util.Iterator;
+import javax.swing.JOptionPane;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableModel;
+import model.Category;
+import model.Product;
+
+/**
+ *
+ * @author Acer
+ */
+public class ViewEditDeleteProduct extends javax.swing.JFrame {
+
+ /**
+ * Creates new form ViewEditDeleteProduct
+ */
+ public ViewEditDeleteProduct() {
+ initComponents();
+ btnUpdate.setEnabled(false);
+ btnDelete.setEnabled(false);
+ }
+
+ public void validateField(){
+ String name = txtName.getText();
+ String price = txtPrice.getText();
+ String category = (String)jComboBox1.getSelectedItem();
+ if(!name.equals("") && !price.equals("") && category != null)
+ {
+ btnUpdate.setEnabled(true);
+ }
+ else
+ {
+ btnUpdate.setEnabled(false);
+ }
+ }
+
+ /**
+ * 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+ jButton1 = new javax.swing.JButton();
+ jLabel2 = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+ jLabel4 = new javax.swing.JLabel();
+ jLabel5 = new javax.swing.JLabel();
+ lblId = new javax.swing.JLabel();
+ txtName = new javax.swing.JTextField();
+ txtPrice = new javax.swing.JTextField();
+ jComboBox1 = new javax.swing.JComboBox<>();
+ btnUpdate = new javax.swing.JButton();
+ btnClear = new javax.swing.JButton();
+ btnDelete = new javax.swing.JButton();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ jTable1 = new javax.swing.JTable();
+ jLabel6 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setUndecorated(true);
+ addComponentListener(new java.awt.event.ComponentAdapter() {
+ public void componentShown(java.awt.event.ComponentEvent evt) {
+ formComponentShown(evt);
+ }
+ });
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ jLabel1.setFont(new java.awt.Font("Bookman Old Style", 1, 24)); // NOI18N
+ jLabel1.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/view edit delete product.png"))); // NOI18N
+ jLabel1.setText("View,Edit & Delete Product");
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 6, -1, -1));
+
+ jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/close.png"))); // NOI18N
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton1ActionPerformed(evt);
+ }
+ });
+ getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(1334, 6, -1, -1));
+
+ jLabel2.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel2.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel2.setText("ID:");
+ getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(79, 237, 37, -1));
+
+ jLabel3.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel3.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel3.setText("Name");
+ getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(79, 280, -1, -1));
+
+ jLabel4.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel4.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel4.setText("Category");
+ getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(79, 326, -1, -1));
+
+ jLabel5.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ jLabel5.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel5.setText("Price");
+ getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(79, 372, -1, -1));
+
+ lblId.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ lblId.setForeground(new java.awt.Color(255, 255, 255));
+ lblId.setText("00");
+ getContentPane().add(lblId, new org.netbeans.lib.awtextra.AbsoluteConstraints(196, 237, 37, -1));
+
+ txtName.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtName.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtNameKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtName, new org.netbeans.lib.awtextra.AbsoluteConstraints(196, 277, 379, -1));
+
+ txtPrice.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ txtPrice.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ txtPriceKeyReleased(evt);
+ }
+ });
+ getContentPane().add(txtPrice, new org.netbeans.lib.awtextra.AbsoluteConstraints(196, 369, 379, -1));
+
+ jComboBox1.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ getContentPane().add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(196, 323, 379, -1));
+
+ btnUpdate.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnUpdate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/save.png"))); // NOI18N
+ btnUpdate.setText("Update");
+ btnUpdate.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnUpdateActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnUpdate, new org.netbeans.lib.awtextra.AbsoluteConstraints(196, 427, -1, -1));
+
+ btnClear.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnClear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/clear.png"))); // NOI18N
+ btnClear.setText("Clear");
+ btnClear.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnClearActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnClear, new org.netbeans.lib.awtextra.AbsoluteConstraints(471, 427, -1, -1));
+
+ btnDelete.setFont(new java.awt.Font("Bookman Old Style", 1, 18)); // NOI18N
+ btnDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/delete.png"))); // NOI18N
+ btnDelete.setText("Delete");
+ btnDelete.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnDeleteActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnDelete, new org.netbeans.lib.awtextra.AbsoluteConstraints(336, 427, -1, -1));
+
+ jTable1.setFont(new java.awt.Font("Bookman Old Style", 1, 14)); // NOI18N
+ jTable1.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+
+ },
+ new String [] {
+ "ID", "Name", "Category", "Price"
+ }
+ ));
+ jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ jTable1MouseClicked(evt);
+ }
+ });
+ jScrollPane1.setViewportView(jTable1);
+
+ getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(736, 157, -1, -1));
+
+ jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/home-background-image.png"))); // NOI18N
+ getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void txtNameKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNameKeyReleased
+ // TODO add your handling code here:
+ validateField();
+
+ }//GEN-LAST:event_txtNameKeyReleased
+
+ private void txtPriceKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPriceKeyReleased
+ // TODO add your handling code here:
+ validateField();
+ }//GEN-LAST:event_txtPriceKeyReleased
+
+ private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateActionPerformed
+ // TODO add your handling code here:
+ Product product = new Product();
+ int id = Integer.parseInt(lblId.getText());
+ product.setId(id);
+ product.setName(txtName.getText());
+ product.setCategory((String)jComboBox1.getSelectedItem());
+ product.setPrice(txtPrice.getText());
+ ProductDao.update(product);
+ setVisible(false);
+ new ViewEditDeleteProduct().setVisible(true);
+ }//GEN-LAST:event_btnUpdateActionPerformed
+
+ private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
+ // TODO add your handling code here:
+ DefaultTableModel dtm = (DefaultTableModel) jTable1.getModel();
+ ArrayList list = ProductDao.getAllRecords();
+ Iterator itr = list.iterator();
+ while(itr.hasNext())
+ {
+ Product productObj = itr.next();
+ dtm.addRow(new Object[]{productObj.getId(),productObj.getName(),productObj.getCategory(),productObj.getPrice()});
+
+ }
+ }//GEN-LAST:event_formComponentShown
+
+ private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
+ // TODO add your handling code here:
+ int index = jTable1.getSelectedRow();
+ TableModel model = jTable1.getModel();
+ String id = model.getValueAt(index, 0).toString();
+ lblId.setText(id);
+ String name = model.getValueAt(index, 1).toString();
+ txtName.setText(name);
+ String category = model.getValueAt(index, 2).toString();
+ String price = model.getValueAt(index, 3).toString();
+ txtPrice.setText(price);
+
+ btnUpdate.setEnabled(true);
+ btnDelete.setEnabled(true);
+ jComboBox1.removeAllItems();
+ jComboBox1.addItem(category);
+ ArrayList categoryList = CategoryDao.getAllRecords();
+ Iterator categoryItr = categoryList.iterator();
+ while(categoryItr.hasNext())
+ {
+ Category categoryObj = categoryItr.next();
+ if(!categoryObj.getName().equals(category))
+ {
+ jComboBox1.addItem(categoryObj.getName());
+ }
+
+ }
+ }//GEN-LAST:event_jTable1MouseClicked
+
+ private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteActionPerformed
+ // TODO add your handling code here:
+ String id = lblId.getText();
+ int a = JOptionPane.showConfirmDialog(null, "Do you want to Delete this Product","Select",JOptionPane.YES_NO_OPTION);
+ if(a==0)
+ {
+ ProductDao.delete(id);
+ setVisible(false);
+ new ViewEditDeleteProduct().setVisible(true);
+ }
+ }//GEN-LAST:event_btnDeleteActionPerformed
+
+ private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ new ViewEditDeleteProduct().setVisible(true);
+ }//GEN-LAST:event_btnClearActionPerformed
+
+ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
+ // TODO add your handling code here:
+ setVisible(false);
+ }//GEN-LAST:event_jButton1ActionPerformed
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* Set the Nimbus look and feel */
+ //
+ /* 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(ViewEditDeleteProduct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (InstantiationException ex) {
+ java.util.logging.Logger.getLogger(ViewEditDeleteProduct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ java.util.logging.Logger.getLogger(ViewEditDeleteProduct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(ViewEditDeleteProduct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+ //
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new ViewEditDeleteProduct().setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnClear;
+ private javax.swing.JButton btnDelete;
+ private javax.swing.JButton btnUpdate;
+ private javax.swing.JButton jButton1;
+ private javax.swing.JComboBox jComboBox1;
+ private javax.swing.JLabel jLabel1;
+ 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.JScrollPane jScrollPane1;
+ private javax.swing.JTable jTable1;
+ private javax.swing.JLabel lblId;
+ private javax.swing.JTextField txtName;
+ private javax.swing.JTextField txtPrice;
+ // End of variables declaration//GEN-END:variables
+}