Download as pdf or txt
Download as pdf or txt
You are on page 1of 149

PROJECT: SUPERMARKET DATABASE MANAGEMENT SYSTEM

(Submitted in the Partial fulfilment of the requirements of the Degree of Bachelor of


Computer Applications (BCA)- DA Jain University)

By
Angel Rodrigues 22BCAR0238
Kritika Kanwar 22BCAR0212
Kothapali Prasanna 22BCAR0236
Garima Pundir 22BCAR0208
Guide:

SUSHMA B S

6th OCT 2023

Knowledge Campus Jayanagar 9th Block, Bangalore-560069

1
TOPIC: SUPERMARKET DATABASE MANAGEMENT
SYSTEM
INTRODUCTION
A supermarket management system is a software application designed to
streamline and automate various processes within a supermarket or grocery
store.
*It helps store owners and managers efficiently manage inventory, sales,
customer data, pricing, and other aspects of the business.
*It improves operational efficiency, enhances customer service, and aids
decision-making for supermarket management.
*The system aims to enhance inventory accuracy, optimize pricing tactics, and
enhance customer experience, ultimately increasing the supermarket's
profitability.

DEVELOPMENT TOOLS
Java for front end.

MySql 8.0 for backend.

2
Features:

• Data Security: The system employs robust password policies and multi-
factor authentication to restrict access to authorized users, safeguard
sensitive data, uphold customer trust, and maintain system integrity.
• Accuracy of data: The system ensures inventory availability, pricing
accuracy, and customer satisfaction, and protects the supermarket's
reputation.
• Helps manage the record: The system efficiently manages seller records
by maintaining a detailed database of authorized sellers, their login
time, and their logout time.
• Easy Access to Purchase History to the Customers: The supermarket
management system offers customers easy access to their purchased
products through receipts, allowing them to check their product price
and purchased product.

OBJECTIVES OF THE PROJECT:

A supermarket management system is a software application designed to


streamline and automate various processes within a supermarket or grocery
store.
*It helps store owners and managers efficiently manage inventory, sales,
customer data, pricing, and other aspects of the business.
*It improves operational efficiency, enhances customer service, and aids
decision-making for supermarket management.
*The system aims to enhance inventory accuracy, optimize pricing tactics, and
enhance customer experience, ultimately increasing the supermarket's
profitability.

Description:

Our Supermarket management system consists of 4 functionalities


1. Login Page
2. Managing the product activity
3. Billing point
4. Managing seller's activity

3
On the Login page, the User can select their role, add the password, and login
into the application. The next page comprises the Managing product activity
wherein the Salesman will be adding the product name, its price, its category,
and its quantity which will be displayed in the product list table he can also
perform functions such as editing and deleting information of the mentioned
products that are being updated in case the customer wants to remove or
change the product. The System also comprises the Billing point where the
system will fetch the data of the products taken by the customer from the
product list table and thereafter add the total quantity taken by the customer
and print it in the bill. There also exists a filter button in case the salesman
wants to filter the products that are being added to the list and when the next
customer would like to print the bill of its product the salesman can just click
the refresh button and fetch the new items into the bill. Lastly, In the
Managing Sellers activities, the Seller will add his Name, his ID, the login time,
and the logout time which will be stored in the Sellers detail table, this
functionality will be used by him when he is done with the duty, which will be
useful for the Admin/Manager to keep the track of the seller's details along
with the duration of the work done by him. The seller will also have an option
to edit and delete the changes along with the add button which will be helpful
for him to update his changes. Finally when the details are updated the
salesman can just click the logout button and close the application.

4
ER-DIAGRAM

5
SCREENSHOTS

Splash page

Seller Login page

6
Admin login page

Product Sold

7
Manage Sellers

Billing Point

8
Backend

9
CODE:

Splash page

/*

* 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

*/

/**

* @author Rajesh

*/

public class Splash extends javax.swing.JFrame {

/**

* Creates new form Splash

10
*/

public Splash() {

initComponents();

/**

* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always

* regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jPanel1 = new javax.swing.JPanel();

jLabel1 = new javax.swing.JLabel();

11
Percentage = new javax.swing.JLabel();

Myprogress = new javax.swing.JProgressBar();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setText(" Family Point Supermarket");

Percentage.setText(" %");

javax.swing.GroupLayout jPanel1Layout = new


javax.swing.GroupLayout(jPanel1);

jPanel1.setLayout(jPanel1Layout);

jPanel1Layout.setHorizontalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(Myprogress, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

12
.addGroup(jPanel1Layout.createSequentialGroup()

.addContainerGap(311, Short.MAX_VALUE)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.LEADING)

.addComponent(Percentage,
javax.swing.GroupLayout.PREFERRED_SIZE, 276,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
160, javax.swing.GroupLayout.PREFERRED_SIZE))

.addContainerGap(195, Short.MAX_VALUE))

);

jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addGap(36, 36, 36)

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 42,


javax.swing.GroupLayout.PREFERRED_SIZE)

13
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 267,
Short.MAX_VALUE)

.addComponent(Percentage, javax.swing.GroupLayout.PREFERRED_SIZE,
84, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(18, 18, 18)

.addComponent(Myprogress, javax.swing.GroupLayout.PREFERRED_SIZE,
28, javax.swing.GroupLayout.PREFERRED_SIZE))

);

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addContainerGap()

14
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addContainerGap())

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addContainerGap()

.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addContainerGap())

);

pack();

}// </editor-fold>

15
/**

* @param args the command line arguments

*/

public static void main(String args[]) {

Splash Mysplash = new Splash();

Mysplash.setVisible(true);

try{

for(int i = 0 ; i <= 100 ; i++ )

Thread.sleep(40);

Mysplash.Myprogress.setValue(i);

Mysplash.Percentage.setText(Integer.toString(i)+"%");

}catch(Exception e)

16
/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code


(optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.

* For details see


http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

17
java.util.logging.Logger.getLogger(Splash.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Splash.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(Splash.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Splash.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);

//</editor-fold>

/* Create and display the form */

18
java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new Splash().setVisible(true);

});

new Login().setVisible(true);

Mysplash.dispose();

// Variables declaration - do not modify

private javax.swing.JProgressBar Myprogress;

private javax.swing.JLabel Percentage;

private javax.swing.JLabel jLabel1;

private javax.swing.JPanel jPanel1;

19
// End of variables declaration

Seller Login Page

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.Statement;

import java.sql.SQLException;

import javax.swing.JOptionPane;

/*

* 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

*/

/**

20
*

* @author Rajesh

*/

public class Login extends javax.swing.JFrame {

/**

* Creates new form Login

*/

public Login() {

initComponents();

Connection Con = null;

Statement St = null;

ResultSet Rs = null;

/**

21
* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always

* regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jTextField1 = new javax.swing.JTextField();

RoleCb = new javax.swing.JComboBox<>();

jLabel1 = new javax.swing.JLabel();

jButton1 = new javax.swing.JButton();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

jButton2 = new javax.swing.JButton();

Password = new javax.swing.JTextField();

22
jLabel4 = new javax.swing.JLabel();

jTextField1.setText("jTextField1");

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

RoleCb.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] {


"Seller", "Admin" }));

RoleCb.addActionListener(new java.awt.event.ActionListener() {

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

RoleCbActionPerformed(evt);

});

jLabel1.setText(" LOGIN");

jButton1.setText("Login");

23
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jButton1MouseClicked(evt);

});

jLabel2.setText("Select Role");

jLabel3.setText("Password");

jButton2.setText("Clear");

jLabel4.setText(" X");

jLabel4.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jLabel4MouseClicked(evt);

24
}

});

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(layout.createSequentialGroup()

.addGap(47, 47, 47)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG, false)

.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE,
163, Short.MAX_VALUE)
25
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addGap(26, 26, 26)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG, false)

.addComponent(RoleCb, 0, 285, Short.MAX_VALUE)

.addComponent(Password)))

.addGroup(layout.createSequentialGroup()

.addGap(81, 81, 81)

.addComponent(jButton1,
javax.swing.GroupLayout.PREFERRED_SIZE, 115,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(133, 133, 133)

.addComponent(jButton2,
javax.swing.GroupLayout.PREFERRED_SIZE, 113,
javax.swing.GroupLayout.PREFERRED_SIZE)))

.addContainerGap(146, Short.MAX_VALUE))

26
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addGap(0, 0, Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE,
60, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(14, 14, 14))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
230, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(212, 212, 212))))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

27
.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 30,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(9, 9, 9)

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 61,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(45, 45, 45)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

.addComponent(RoleCb, javax.swing.GroupLayout.PREFERRED_SIZE,
56, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE,
56, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(54, 54, 54)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

28
.addComponent(Password, javax.swing.GroupLayout.PREFERRED_SIZE,
54, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE,
54, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(65, 65, 65)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE,
42, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE,
42, javax.swing.GroupLayout.PREFERRED_SIZE))

.addContainerGap(109, Short.MAX_VALUE))

);

pack();

}// </editor-fold>

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


29
// TODO add your handling code here:

private void jLabel4MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

System.exit(0);

private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

if(RoleCb.getSelectedItem().toString().equals("Seller"))

String Query="select * from sellertbl where


Selpass='"+Password.getText()+"'";

try {

30
Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/Supermarket","root"
,"Gabriel@19");

St= Con.createStatement();

Rs = St.executeQuery(Query);

if(Rs.next()){

new Products_Sold().setVisible(true);

this.dispose();

else{

JOptionPane.showMessageDialog(this,"Wrong Seller Id or Password");

catch(SQLException ex)

ex.printStackTrace();

31
}

else{

String Query="select * from adtable where APwd='"+Password.getText()+"'";

try{

Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/Supermarket","root"
,"Gabriel@19");

St= Con.createStatement();

Rs = St.executeQuery(Query);

if(Rs.next()){

new Products_Sold().setVisible(true);

this.dispose();

else{

JOptionPane.showMessageDialog(this,"Wrong Admin Id or Password");

32
catch(SQLException ex)

ex.printStackTrace();

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code


(optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.

* For details see


http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

33
*/

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.Lev
el.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

34
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new Login().setVisible(true);

});

35
// Variables declaration - do not modify

private javax.swing.JTextField Password;

private javax.swing.JComboBox<String> RoleCb;

private javax.swing.JButton jButton1;

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.JTextField jTextField1;

// End of variables declaration

Admin Login page

import java.sql.DriverManager;

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

36
import java.sql.Statement;

import javax.swing.JOptionPane;

import java.sql.SQLException;

import java.util.logging.Level;

import java.util.logging.Logger;

/*

* 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

*/

/**

* @author Rajesh

*/

37
public class UpdateAdmin extends javax.swing.JFrame {

/**

* Creates new form UpdateAdmin

*/

public UpdateAdmin() {

initComponents();

Connection Con = null;

Statement St = null;

ResultSet Rs = null;

/**

* 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.

38
*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jLabel1 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

AdminName = new javax.swing.JTextField();

AdminPassword = new javax.swing.JTextField();

jButton1 = new javax.swing.JButton();

jButton2 = new javax.swing.JButton();

jLabel4 = new javax.swing.JLabel();

jButton3 = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

39
jLabel1.setText(" X");

jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jLabel1MouseClicked(evt);

});

jLabel2.setText("Name");

jLabel3.setText("Password");

jButton1.setText("Update");

jButton1.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jButton1MouseClicked(evt);

40
}

});

jButton2.setText("Clear");

jButton2.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jButton2MouseClicked(evt);

});

jLabel4.setText(" UpdateAdmin");

jButton3.setText("Manage Seller");

jButton3.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jButton3MouseClicked(evt);

41
}

});

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addGap(0, 767, Short.MAX_VALUE)

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 29,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)

.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE,
129, javax.swing.GroupLayout.PREFERRED_SIZE)
42
.addGap(120, 120, 120)

.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE,
136, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(186, 186, 186))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addGap(23, 23, 23)

.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE,
158, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 74,
Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILI
NG, false)

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE,
147, javax.swing.GroupLayout.PREFERRED_SIZE)

43
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(AdminPassword,
javax.swing.GroupLayout.PREFERRED_SIZE, 193,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE,
147, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(95, 95, 95)

.addComponent(AdminName,
javax.swing.GroupLayout.PREFERRED_SIZE, 193,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE,
210, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(169, 169, 169)))

.addGap(106, 106, 106))

);

44
layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addComponent(jLabel1)

.addGap(21, 21, 21)

.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 52,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(30, 30, 30)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE,
50, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(AdminName,
javax.swing.GroupLayout.PREFERRED_SIZE, 50,
javax.swing.GroupLayout.PREFERRED_SIZE))

45
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(layout.createSequentialGroup()

.addGap(60, 60, 60)

.addComponent(AdminPassword,
javax.swing.GroupLayout.PREFERRED_SIZE, 50,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addGap(51, 51, 51)

.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE,
50, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addGap(25, 25, 25)

.addComponent(jButton3,
javax.swing.GroupLayout.PREFERRED_SIZE, 49,
javax.swing.GroupLayout.PREFERRED_SIZE)))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 70,
Short.MAX_VALUE)
46
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE,
43, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE,
43, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(126, 126, 126))

);

pack();

}// </editor-fold>

private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

System.exit(0);

47
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

AdminName.setText("");

AdminPassword.setText("");

private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

if(AdminName.getText().isEmpty()|| AdminPassword.getText().isEmpty())

JOptionPane.showMessageDialog(this,"Missing Information");

else

try {

48
Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket","root"
,"Gabriel@19");

PreparedStatement add = Con.prepareStatement("insert into adtable


values(?,?)");

add.setString(1, AdminName.getText());

add.setString(2, AdminPassword.getText());

int row = add.executeUpdate();

JOptionPane.showMessageDialog(this,"Password Successfully Updated");

Con.close();

catch (SQLException e)

e.printStackTrace();

49
}

private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

new Seller_Details().setVisible(true);

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code


(optional) ">

50
/* 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(UpdateAdmin.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

51
java.util.logging.Logger.getLogger(UpdateAdmin.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(UpdateAdmin.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(UpdateAdmin.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new UpdateAdmin().setVisible(true);

}
52
});

// Variables declaration - do not modify

private javax.swing.JTextField AdminName;

private javax.swing.JTextField AdminPassword;

private javax.swing.JButton jButton1;

private javax.swing.JButton jButton2;

private javax.swing.JButton jButton3;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

// End of variables declaration

53
Product Sold

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.JOptionPane;

import javax.swing.table.DefaultTableModel;

import net.proteanit.sql.DbUtils;

import java.sql.*;

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to
change this license

54
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit
this template

*/

/**

* @author Rajesh

*/

public class Products_Sold extends javax.swing.JFrame {

/**

* Creates new form Products_Sold

*/

public Products_Sold() {

initComponents();

SelectSeller();

Connection Con = null;

55
Statement St = null;

ResultSet Rs = null;

public void SelectSeller() {

try {

Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");

St = Con.createStatement();

Rs = St.executeQuery("Select * from producttbl");

JTable1.setModel(DbUtils.resultSetToTableModel(Rs));

} catch (Exception e) {

e.printStackTrace();

56
/**

* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always

* regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jLabel1 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

jLabel4 = new javax.swing.JLabel();

jLabel6 = new javax.swing.JLabel();

jLabel7 = new javax.swing.JLabel();

57
AddBtn = new javax.swing.JButton();

EditBtn = new javax.swing.JButton();

ClearBin = new javax.swing.JButton();

DeleteBtn = new javax.swing.JButton();

ProdID = new javax.swing.JTextField();

ProdName = new javax.swing.JTextField();

ProdPrice = new javax.swing.JTextField();

ProdQuantity = new javax.swing.JTextField();

jLabel8 = new javax.swing.JLabel();

Selling = new javax.swing.JButton();

Logout = new javax.swing.JButton();

jScrollPane2 = new javax.swing.JScrollPane();

JTable1 = new javax.swing.JTable();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

58
jLabel1.setText(" X");

jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jLabel1MouseClicked(evt);

});

jLabel2.setText(" MANAGE PRODUCTS");

jLabel3.setText("ProductID");

jLabel4.setText("Name");

jLabel6.setText("Quantity");

jLabel7.setText("Price");

59
AddBtn.setText("Add");

AddBtn.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

AddBtnMouseClicked(evt);

});

EditBtn.setText("Edit");

EditBtn.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

EditBtnMouseClicked(evt);

});

ClearBin.setText("Clear");

60
ClearBin.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

ClearBinMouseClicked(evt);

});

DeleteBtn.setText("Delete");

DeleteBtn.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

DeleteBtnMouseClicked(evt);

});

ProdName.addActionListener(new java.awt.event.ActionListener() {

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

ProdNameActionPerformed(evt);

61
}

});

jLabel8.setText("PRODUCT LIST");

Selling.setText("Selling");

Selling.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

SellingMouseClicked(evt);

});

Logout.setText("Logout");

Logout.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

LogoutMouseClicked(evt);

62
}

});

JTable1.setModel(new javax.swing.table.DefaultTableModel(

new Object [][] {

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null}

},

new String [] {

"Title 1", "Title 2", "Title 3", "Title 4"

));

JTable1.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

63
JTable1MouseClicked(evt);

});

jScrollPane2.setViewportView(JTable1);

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(71, 71, 71)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE,
37, javax.swing.GroupLayout.PREFERRED_SIZE)

64
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE,
66, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(47, 47, 47)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addComponent(ProdID, javax.swing.GroupLayout.PREFERRED_SIZE,
96, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(ProdName,
javax.swing.GroupLayout.PREFERRED_SIZE, 96,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE,
37, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE,
103, javax.swing.GroupLayout.PREFERRED_SIZE))

65
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addComponent(ProdQuantity,
javax.swing.GroupLayout.PREFERRED_SIZE, 98,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(ProdPrice, javax.swing.GroupLayout.PREFERRED_SIZE,
98, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(264, 264, 264))

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

66
.addComponent(Selling)

.addGroup(layout.createSequentialGroup()

.addGap(97, 97, 97)

.addComponent(AddBtn)

.addGap(76, 76, 76)

.addComponent(EditBtn)))

.addGap(93, 93, 93)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addComponent(jLabel8,
javax.swing.GroupLayout.PREFERRED_SIZE, 252,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(layout.createSequentialGroup()

.addComponent(DeleteBtn)

.addGap(87, 87, 87)

.addComponent(ClearBin)))

.addGap(0, 0, Short.MAX_VALUE))

67
.addGroup(layout.createSequentialGroup()

.addComponent(Logout)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 35,
Short.MAX_VALUE)

.addComponent(jScrollPane2,
javax.swing.GroupLayout.PREFERRED_SIZE, 830,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(27, 27, 27))))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE,
338, javax.swing.GroupLayout.PREFERRED_SIZE)

68
.addGap(290, 290, 290))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
58, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(19, 19, 19))))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addComponent(jLabel1)

.addGap(45, 45, 45)

.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

69
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

.addComponent(jLabel7)

.addComponent(ProdID, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel3))

.addComponent(ProdPrice, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(layout.createSequentialGroup()

.addGap(28, 28, 28)

70
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

.addComponent(jLabel4)

.addComponent(ProdName,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(108, 108, 108)

.addComponent(Selling)

.addGap(60, 60, 60)

.addComponent(Logout)

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))

.addGroup(layout.createSequentialGroup()

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

71
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

.addComponent(ProdQuantity,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel6))

.addGap(46, 46, 46)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

.addComponent(DeleteBtn)

.addComponent(ClearBin)

.addComponent(AddBtn)

.addComponent(EditBtn))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE,
41, javax.swing.GroupLayout.PREFERRED_SIZE)
72
.addGap(29, 29, 29)

.addComponent(jScrollPane2,
javax.swing.GroupLayout.PREFERRED_SIZE, 233,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(81, 81, 81))))

);

pack();

}// </editor-fold>

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

// // TODO add your handling code here:

private void AddBtnMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

73
if (ProdID.getText().isEmpty() || ProdName.getText().isEmpty() ||
ProdPrice.getText().isEmpty() || ProdQuantity.getText().isEmpty())

JOptionPane.showMessageDialog(this, "Missing Information");

else {

try {

Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");

PreparedStatement add = Con.prepareStatement("insert into producttbl


values(?, ? ,? ,?)");

add.setInt(1, Integer.valueOf(ProdID.getText()));

add.setString(2, ProdName.getText());

add.setInt(3, Integer.valueOf(ProdPrice.getText()));

add.setInt(4, Integer.valueOf(ProdQuantity.getText()));

int row = add.executeUpdate();

74
JOptionPane.showMessageDialog(this, "Product added Succesfully");

Con.close();

SelectSeller();

} catch (Exception e) {

e.printStackTrace();

private void ClearBinMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

ProdID.setText("");

ProdName.setText("");

ProdPrice.setText("");

ProdQuantity.setText("");

75
private void DeleteBtnMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

if (ProdID.getText().isEmpty()) {

JOptionPane.showMessageDialog(this, "Enter the Product to be deleted");

} else {

try {

Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");

String ProductID = ProdID.getText();

Statement st=con.createStatement();

String Query = "Delete from producttbl where ProductID="+ProductID;

Statement Add = Con.createStatement();

Add.executeUpdate(Query);

JOptionPane.showMessageDialog(this, "Product Deleted Successfully");

SelectSeller();

76
} catch (Exception e) {

e.printStackTrace();

private void EditBtnMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

if (ProdID.getText().isEmpty() || ProdName.getText().isEmpty() ||
ProdPrice.getText().isEmpty() || ProdQuantity.getText().isEmpty()) {

JOptionPane.showMessageDialog(this, "Missing Information");

} else {

try {

77
Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");

String Query = "Update producttbl set ProductID ='" + ProdID.getText() +


"'" + ",ProductName='" + ProdName.getText() + "'" + ",ProductPrice='" +
ProdPrice.getText() + "'" + ",ProductQuantity ='" + ProdQuantity.getText() + "'" +
"where ProductID=" + ProdID.getText();

Statement Add = Con.createStatement();

Add.executeUpdate(Query);

JOptionPane.showMessageDialog(this, "Product Edited");

SelectSeller();

} catch (SQLException e) {

e.printStackTrace();

78
private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

System.exit(0);

private void SellingMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

new Selling().setVisible(true);

this.dispose();

private void LogoutMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

new Login().setVisible(true);

this.dispose();

79
private void JTable1MouseClicked(java.awt.event.MouseEvent evt) {

DefaultTableModel model = (DefaultTableModel)JTable1.getModel();

int Myindex= JTable1.getSelectedRow();

ProdID.setText(model.getValueAt (Myindex,0).toString());

ProdName.setText(model.getValueAt (Myindex,1).toString());

ProdPrice.setText (model.getValueAt (Myindex,2).toString());

ProdQuantity.setText(model.getValueAt (Myindex,3).toString());

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

80
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.

* For details see


http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(Products_Sold.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
81
} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Products_Sold.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(Products_Sold.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Products_Sold.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new Products_Sold().setVisible(true);
82
}

});

// Variables declaration - do not modify

private javax.swing.JButton AddBtn;

private javax.swing.JButton ClearBin;

private javax.swing.JButton DeleteBtn;

private javax.swing.JButton EditBtn;

private javax.swing.JTable JTable1;

private javax.swing.JButton Logout;

private javax.swing.JTextField ProdID;

private javax.swing.JTextField ProdName;

private javax.swing.JTextField ProdPrice;

private javax.swing.JTextField ProdQuantity;

83
private javax.swing.JButton Selling;

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.JLabel jLabel7;

private javax.swing.JLabel jLabel8;

private javax.swing.JScrollPane jScrollPane2;

// End of variables declaration

Billing Point

import java.awt.Graphics;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

84
import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.JOptionPane;

import javax.swing.table.DefaultTableModel;

import net.proteanit.sql.DbUtils;

/*

* 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

*/

/**

* @author Rajesh

*/

public class Selling extends javax.swing.JFrame {

85
/**

* Creates new form Selling

*/

public Selling() {

initComponents();

SelectSeller();

Connection Con = null;

Statement St = null;

ResultSet Rs = null;

public void SelectSeller()

try {

86
Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket","root"
,"Gabriel@19");

St= Con.createStatement();

Rs = St.executeQuery("Select * from PRODUCTTBL");

ProductTable.setModel(DbUtils.resultSetToTableModel(Rs));

}catch (Exception e )

e.printStackTrace();

int newQuantity;

public void update()

try {

Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/Supermarket","root"
,"Gabriel@19");

87
String Query="Update PRODUCTTBL set ProductQuantity ="+newQuantity+"
"+"where ProductName="+ProdName.getText();

Statement Add= Con.createStatement();

Add.executeUpdate(Query);

JOptionPane.showMessageDialog(this,"Product Quantity Updated");

SelectSeller();

catch (SQLException e)

e.printStackTrace();

/**

* 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.

88
*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jLabel1 = new javax.swing.JLabel();

jScrollPane1 = new javax.swing.JScrollPane();

ProductTable = new javax.swing.JTable();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

ProdName = new javax.swing.JTextField();

ProdQuantity = new javax.swing.JTextField();

AddBtn = new javax.swing.JButton();

ClearBtn = new javax.swing.JButton();

jLabel4 = new javax.swing.JLabel();

jComboBox1 = new javax.swing.JComboBox<>();

89
jButton4 = new javax.swing.JButton();

jLabel5 = new javax.swing.JLabel();

EditBtn = new javax.swing.JButton();

Grdtotallbl = new javax.swing.JLabel();

jScrollPane2 = new javax.swing.JScrollPane();

BillTxt = new javax.swing.JTextArea();

Seller_Details = new javax.swing.JButton();

PreviousBtn = new javax.swing.JButton();

jLabel6 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setText(" Billing Point");

ProductTable.setModel(new javax.swing.table.DefaultTableModel(

new Object [][] {

90
},

new String [] {

"ID", "Name", "Category", "Price", "Quantity"

));

ProductTable.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

ProductTableMouseClicked(evt);

});

jScrollPane1.setViewportView(ProductTable);

jLabel2.setText("Name");

jLabel3.setText("Quantity");

91
AddBtn.setText("Add to Bill");

AddBtn.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

AddBtnMouseClicked(evt);

});

ClearBtn.setText("Clear");

ClearBtn.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

ClearBtnMouseClicked(evt);

});

jLabel4.setText(" Product List");

92
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new
String[] { "BEVERAGE", "VEGETABLE", "MEAT", "FRUIT", "THING" }));

jComboBox1.addActionListener(new java.awt.event.ActionListener() {

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

jComboBox1ActionPerformed(evt);

});

jButton4.setText("Refresh");

jButton4.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jButton4MouseClicked(evt);

});

jLabel5.setText("X");

93
jLabel5.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jLabel5MouseClicked(evt);

});

EditBtn.setText("Print");

EditBtn.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

EditBtnMouseClicked(evt);

});

EditBtn.addActionListener(new java.awt.event.ActionListener() {

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

EditBtnActionPerformed(evt);

94
});

Grdtotallbl.setText(" RS");

Grdtotallbl.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

GrdtotallblMouseClicked(evt);

});

BillTxt.setColumns(20);

BillTxt.setRows(5);

jScrollPane2.setViewportView(BillTxt);

Seller_Details.setText("Next");

Seller_Details.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

95
Seller_DetailsMouseClicked(evt);

});

PreviousBtn.setText("Previous");

PreviousBtn.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

PreviousBtnMouseClicked(evt);

});

jLabel6.setText(" Filter");

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

96
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addGap(357, 357, 357)

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 156,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE,
18, javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap())

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

97
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE,
142, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(127, 127, 127))))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addContainerGap()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG, false)

.addComponent(PreviousBtn, javax.swing.GroupLayout.DEFAULT_SIZE,
86, Short.MAX_VALUE)

.addComponent(Seller_Details,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15,
Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

98
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addComponent(AddBtn, javax.swing.GroupLayout.PREFERRED_SIZE,
136, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(37, 37, 37)

.addComponent(ClearBtn,
javax.swing.GroupLayout.PREFERRED_SIZE, 129,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(104, 104, 104))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG, false)

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel3,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)

.addGap(31, 31, 31)

99
.addComponent(ProdQuantity,
javax.swing.GroupLayout.PREFERRED_SIZE, 177,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel2,
javax.swing.GroupLayout.PREFERRED_SIZE, 99,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(39, 39, 39)

.addComponent(ProdName,
javax.swing.GroupLayout.PREFERRED_SIZE, 177,
javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGap(70, 70, 70)))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 439,
javax.swing.GroupLayout.PREFERRED_SIZE)

100
.addGap(63, 63, 63))

.addGroup(layout.createSequentialGroup()

.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel6,
javax.swing.GroupLayout.PREFERRED_SIZE, 106,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(27, 27, 27)

.addComponent(jComboBox1,
javax.swing.GroupLayout.PREFERRED_SIZE, 132,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(26, 26, 26)

.addComponent(jButton4,
javax.swing.GroupLayout.PREFERRED_SIZE, 109,
javax.swing.GroupLayout.PREFERRED_SIZE))

101
.addComponent(jScrollPane2,
javax.swing.GroupLayout.PREFERRED_SIZE, 401,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(84, 84, 84))))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILI
NG)

.addComponent(EditBtn)

.addComponent(Grdtotallbl,
javax.swing.GroupLayout.PREFERRED_SIZE, 61,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(219, 219, 219))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

102
.addGroup(layout.createSequentialGroup()

.addGap(7, 7, 7)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
43, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(55, 55, 55)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG, false)

.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(ProdName,
javax.swing.GroupLayout.DEFAULT_SIZE, 44, Short.MAX_VALUE))

.addGap(13, 13, 13)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILI
NG)
103
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

.addComponent(ProdQuantity,
javax.swing.GroupLayout.PREFERRED_SIZE, 44,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel3,
javax.swing.GroupLayout.PREFERRED_SIZE, 36,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addComponent(Seller_Details,
javax.swing.GroupLayout.PREFERRED_SIZE, 37,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(18, 18, 18)

.addComponent(PreviousBtn,
javax.swing.GroupLayout.PREFERRED_SIZE, 36,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(1, 1, 1)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

104
.addComponent(AddBtn,
javax.swing.GroupLayout.PREFERRED_SIZE, 41,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(ClearBtn,
javax.swing.GroupLayout.PREFERRED_SIZE, 41,
javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel5)

.addGap(10, 10, 10)

.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE,
26, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

.addComponent(jButton4,
javax.swing.GroupLayout.PREFERRED_SIZE, 40,
javax.swing.GroupLayout.PREFERRED_SIZE)

105
.addComponent(jComboBox1,
javax.swing.GroupLayout.PREFERRED_SIZE, 40,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel6,
javax.swing.GroupLayout.PREFERRED_SIZE, 41,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 193,
javax.swing.GroupLayout.PREFERRED_SIZE)))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(jScrollPane2,
javax.swing.GroupLayout.PREFERRED_SIZE, 180,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(Grdtotallbl)

106
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(EditBtn)

.addGap(17, 17, 17))

);

pack();

}// </editor-fold>

private void ProductTableMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here

double Uprice;

double ProdTot=0.0;

double GrdTotal=0.0;

int AvailQty;

DefaultTableModel model = (DefaultTableModel)ProductTable.getModel();

int Myindex= ProductTable.getSelectedRow();

107
ProdName.setText(model.getValueAt(Myindex,1).toString());

AvailQty = Integer.valueOf(model.getValueAt(Myindex, 2).toString());

newQuantity = AvailQty-Integer.valueOf(ProdQuantity.getText());

Uprice = Double.valueOf(model.getValueAt(Myindex, 3).toString());

ProdQuantity.setText(model.getValueAt(Myindex,4).toString());

private void AddBtnMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

int i = 0;

double Uprice=10;

double ProdTot=10.0;

double GrdTotal=10.0;

int AvailQty=10;

108
if(ProdName.getText().isEmpty()|| ProdQuantity.getText().isEmpty())

JOptionPane.showMessageDialog(this,"Missing Information");

else if(AvailQty <= (Integer.valueOf(ProdQuantity.getText())));

JOptionPane.showMessageDialog(this,"Added successfully ");

i++;

ProdTot= Uprice * Double.valueOf(ProdQuantity.getText());

GrdTotal = GrdTotal+ProdTot;

if(i==1)

109
BillTxt.setText(BillTxt.getText() + " ********Family Point*********\n " +
"Num Product Price Quantity Total\n" + i + " "+ProdName.getText()+"
"+Uprice+" "+ProdQuantity.getText()+" "+ProdTot+"\n " );

else{

BillTxt.setText(BillTxt.getText()+i+" "+ProdName.getText()+"
"+Uprice+" "+ProdQuantity.getText()+" "+ProdTot+"\n\t" );

Grdtotallbl.setText(" Rs "+ GrdTotal);

update();

private void EditBtnMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

JOptionPane.showMessageDialog(this,"Printing on progress .....");

110
}

private void ClearBtnMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

ProdName.setText("");

ProdQuantity.setText("");

private void Seller_DetailsMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

new Seller_Details().setVisible(true);

this.dispose();

private void PreviousBtnMouseClicked(java.awt.event.MouseEvent evt) {

111
// TODO add your handling code here:

new Products_Sold().setVisible(true);

this.dispose();

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

// TODO add your handling code here:

private void jButton4MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

SelectSeller();

private void jLabel5MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

112
System.exit(0);

private void GrdtotallblMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

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

// TODO add your handling code here:

/**

* @param args the command line arguments

*/

113
public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code


(optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.

* For details see


http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

114
java.util.logging.Logger.getLogger(Selling.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Selling.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(Selling.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Selling.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);

//</editor-fold>

/* Create and display the form */

115
java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new Selling().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JButton AddBtn;

private javax.swing.JTextArea BillTxt;

private javax.swing.JButton ClearBtn;

private javax.swing.JButton EditBtn;

private javax.swing.JLabel Grdtotallbl;

private javax.swing.JButton PreviousBtn;

private javax.swing.JTextField ProdName;

private javax.swing.JTextField ProdQuantity;

116
private javax.swing.JTable ProductTable;

private javax.swing.JButton Seller_Details;

private javax.swing.JButton jButton4;

private javax.swing.JComboBox<String> 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.JScrollPane jScrollPane2;

// End of variables declaration

117
Manage Sellers

import java.sql.Connection;

import java.sql.Statement;

import java.sql.ResultSet;

import java.sql.DriverManager;

import javax.swing.JOptionPane;

import java.sql.PreparedStatement;

import javax.swing.table.DefaultTableModel;

import java.sql.SQLException;

import net.proteanit.sql.DbUtils;

/*

* 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

118
*/

/**

* @author Rajesh

*/

public class Seller_Details extends javax.swing.JFrame {

/**

* Creates new form Seller_Details

*/

public Seller_Details() {

initComponents();

SelectSeller();

Connection Con = null;

119
Statement St = null;

ResultSet Rs = null;

public void SelectSeller() {

try {

Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");

St = Con.createStatement();

Rs = St.executeQuery("Select * from SELLERTBL");

JTable2.setModel(DbUtils.resultSetToTableModel(Rs));

} catch (Exception e) {

e.printStackTrace();

120
/**

* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always

* regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jLabel1 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

jLabel4 = new javax.swing.JLabel();

jLabel5 = new javax.swing.JLabel();

121
SName = new javax.swing.JTextField();

TIMEIN = new javax.swing.JTextField();

SPass = new javax.swing.JTextField();

TIMEOUT = new javax.swing.JTextField();

jScrollPane1 = new javax.swing.JScrollPane();

JTable2 = new javax.swing.JTable();

ADDBIN = new javax.swing.JButton();

UpdateBtn = new javax.swing.JButton();

DELETEBIN = new javax.swing.JButton();

CLEARBIN = new javax.swing.JButton();

jLabel6 = new javax.swing.JLabel();

LogoutBtn = new javax.swing.JButton();

jLabel7 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

122
jLabel1.setText("MANAGE SELLERS");

jLabel2.setText("NAME");

jLabel3.setText(" LOGIN TIME");

jLabel4.setText("PASSWORD");

jLabel5.setText("LOGOUT TIME");

TIMEIN.addActionListener(new java.awt.event.ActionListener() {

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

TIMEINActionPerformed(evt);

});

123
JTable2.setModel(new javax.swing.table.DefaultTableModel(

new Object [][] {

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null}

},

new String [] {

"NAME", "PASSWORD", "LOGIN TIME", "LOGOUT TIME"

));

JTable2.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

JTable2MouseClicked(evt);

});

124
jScrollPane1.setViewportView(JTable2);

ADDBIN.setText("ADD");

ADDBIN.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

ADDBINMouseClicked(evt);

});

UpdateBtn.setText("EDIT");

UpdateBtn.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

UpdateBtnMouseClicked(evt);

});

UpdateBtn.addActionListener(new java.awt.event.ActionListener() {

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

UpdateBtnActionPerformed(evt);

});

DELETEBIN.setText("DELETE");

DELETEBIN.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

DELETEBINMouseClicked(evt);

});

CLEARBIN.setText("CLEAR");

CLEARBIN.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

CLEARBINMouseClicked(evt);

126
}

});

jLabel6.setText("SELLERS DETAILS");

LogoutBtn.setText("Logout");

LogoutBtn.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

LogoutBtnMouseClicked(evt);

});

LogoutBtn.addActionListener(new java.awt.event.ActionListener() {

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

LogoutBtnActionPerformed(evt);

});

127
jLabel7.setText(" X");

jLabel7.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jLabel7MouseClicked(evt);

});

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

128
.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(layout.createSequentialGroup()

.addGap(100, 100, 100)

.addComponent(ADDBIN)

.addGap(88, 88, 88)

.addComponent(UpdateBtn))

.addGroup(layout.createSequentialGroup()

.addGap(34, 34, 34)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addComponent(jLabel2)

.addComponent(jLabel3,
javax.swing.GroupLayout.PREFERRED_SIZE, 73,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(39, 39, 39)


129
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG, false)

.addComponent(SName,
javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)

.addComponent(TIMEIN))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(layout.createSequentialGroup()

.addGap(61, 61, 61)

.addComponent(jLabel5,
javax.swing.GroupLayout.PREFERRED_SIZE, 89,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addGap(59, 59, 59)


130
.addComponent(jLabel4,
javax.swing.GroupLayout.PREFERRED_SIZE, 77,
javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGap(76, 76, 76)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG, false)

.addComponent(SPass,
javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)

.addComponent(TIMEOUT)))

.addGroup(layout.createSequentialGroup()

.addGap(149, 149, 149)

.addComponent(DELETEBIN)

.addGap(95, 95, 95)

.addComponent(CLEARBIN))

.addGroup(layout.createSequentialGroup()

.addGap(61, 61, 61)

131
.addComponent(jLabel6,
javax.swing.GroupLayout.PREFERRED_SIZE, 194,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addGap(59, 59, 59)

.addComponent(jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 174,
javax.swing.GroupLayout.PREFERRED_SIZE))))

.addGroup(layout.createSequentialGroup()

.addGap(34, 34, 34)

.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 870,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addGap(15, 15, 15)

.addComponent(LogoutBtn,
javax.swing.GroupLayout.PREFERRED_SIZE, 103,
javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGap(0, 40, Short.MAX_VALUE))

132
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addGap(0, 0, Short.MAX_VALUE)

.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE,
37, javax.swing.GroupLayout.PREFERRED_SIZE)))

.addContainerGap())

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addComponent(jLabel7)

.addGap(35, 35, 35)

133
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
48, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(40, 40, 40)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

.addComponent(jLabel4)

.addComponent(SPass,
javax.swing.GroupLayout.PREFERRED_SIZE, 49,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(SName,
javax.swing.GroupLayout.PREFERRED_SIZE, 49,
javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGroup(layout.createSequentialGroup()

.addGap(35, 35, 35)

.addComponent(LogoutBtn,
javax.swing.GroupLayout.PREFERRED_SIZE, 39,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(91, 91, 91)

.addComponent(jLabel2)))
134
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42,
Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

.addComponent(jLabel3)

.addComponent(jLabel5)

.addComponent(TIMEIN, javax.swing.GroupLayout.PREFERRED_SIZE,
44, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(TIMEOUT, javax.swing.GroupLayout.PREFERRED_SIZE,
44, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(29, 29, 29)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)

.addComponent(ADDBIN)

.addComponent(UpdateBtn)

.addComponent(DELETEBIN)

135
.addComponent(CLEARBIN))

.addGap(34, 34, 34)

.addComponent(jLabel6)

.addGap(18, 18, 18)

.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 236,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(39, 39, 39))

);

pack();

}// </editor-fold>

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

// TODO add your handling code here:

136
private void ADDBINMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

if (SName.getText().isEmpty() || SPass.getText().isEmpty() ||
TIMEIN.getText().isEmpty() || TIMEOUT.getText().isEmpty())

JOptionPane.showMessageDialog(this, "Missing Information");

else {

try {

Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");

PreparedStatement add = Con.prepareStatement("insert into SELLERTBL


values(?, ? ,? ,?)");

add.setString(1, SName.getText());

add.setString(2, SPass.getText());

add.setString(3, TIMEIN.getText());

137
add.setString(4, TIMEOUT.getText());

int row = add.executeUpdate();

JOptionPane.showMessageDialog(this, "Selling info added Succesfully");

Con.close();

SelectSeller();

} catch (Exception e) {

e.printStackTrace();

private void JTable2MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

DefaultTableModel model = (DefaultTableModel)JTable2.getModel();

138
int Myindex= JTable2.getSelectedRow();

SName.setText(model.getValueAt (Myindex,0).toString());

SPass.setText(model.getValueAt (Myindex,1).toString());

TIMEIN.setText (model.getValueAt (Myindex,2).toString());

TIMEOUT.setText(model.getValueAt (Myindex,3).toString());

private void CLEARBINMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

SName.setText("");

SPass.setText("");

TIMEIN.setText("");

TIMEOUT.setText("");

139
private void DELETEBINMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

if (SPass.getText().isEmpty()) {

JOptionPane.showMessageDialog(this, "Enter the seller to be deleted");

else {

try {

Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");

String SelPass = SPass.getText();

Statement st=con.createStatement();

String Query = "Delete from SELLERTBL where SelPass="+SPass;

Statement Add = Con.createStatement();

Add.executeUpdate(Query);

JOptionPane.showMessageDialog(this, "Seller Deleted Successfully");

SelectSeller();

140
} catch (Exception e) {

e.printStackTrace();

private void UpdateBtnMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

if (SName.getText().isEmpty() || SPass.getText().isEmpty() ||
TIMEIN.getText().isEmpty() || TIMEOUT.getText().isEmpty()) {

JOptionPane.showMessageDialog(this, "Missing Information");

} else {

try {

141
Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");

String Query = "Update SELLERTBL set SelName ='" + SName.getText() + "'"


+ ",SelPass='" + SPass.getText() + "'" + ",INTIME='" + TIMEIN.getText() + "'" +
",OUTTIME='" + TIMEOUT.getText()+ "'" + "where SelPass=" + SPass.getText();

Statement Add = Con.createStatement();

Add.executeUpdate(Query);

JOptionPane.showMessageDialog(this, "Selling info Edited");

SelectSeller();

} catch (SQLException e) {

e.printStackTrace();

142
private void LogoutBtnActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

private void LogoutBtnMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

new Login().setVisible(true);

this.dispose();

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

// TODO add your handling code here:

private void jLabel7MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

143
System.exit(0);

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code


(optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.

* For details see


http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

144
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(Seller_Details.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Seller_Details.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(Seller_Details.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);

145
} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Seller_Details.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run()

new Seller_Details().setVisible(true);

});

// Variables declaration - do not modify

146
private javax.swing.JButton ADDBIN;

private javax.swing.JButton CLEARBIN;

private javax.swing.JButton DELETEBIN;

private javax.swing.JTable JTable2;

private javax.swing.JButton LogoutBtn;

private javax.swing.JTextField SName;

private javax.swing.JTextField SPass;

private javax.swing.JTextField TIMEIN;

private javax.swing.JTextField TIMEOUT;

private javax.swing.JButton UpdateBtn;

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;

147
private javax.swing.JLabel jLabel7;

private javax.swing.JScrollPane jScrollPane1;

// End of variables declaration

148
CONCLUSION
In conclusion, this synopsis has provided an overview of the development of a
comprehensive supermarket management system that holds immense
promise in revolutionizing the retail industry. The system's multifaceted
approach to enhancing inventory management, customer engagement, and
operational efficiency presents a dynamic solution to the challenges faced by
modern supermarkets. In summation, the supermarket management system
not only optimizes the operational aspects of the retail ecosystem but also
places customer experience at the forefront. Its holistic approach to inventory
management, customer engagement, and operational streamlining positions it
as an invaluable asset in shaping the future of supermarkets, enabling them to
thrive in an ever-changing market.

149

You might also like