Professional Documents
Culture Documents
Supermarket Management System Final Project
Supermarket Management System Final Project
By
Angel Rodrigues 22BCAR0238
Kritika Kanwar 22BCAR0212
Kothapali Prasanna 22BCAR0236
Garima Pundir 22BCAR0208
Guide:
SUSHMA B S
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.
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.
Description:
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
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
*/
/**
* @author Rajesh
*/
/**
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
*/
@SuppressWarnings("unchecked")
11
Percentage = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
Percentage.setText(" %");
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()
13
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 267,
Short.MAX_VALUE)
.addComponent(Percentage, javax.swing.GroupLayout.PREFERRED_SIZE,
84, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Myprogress, javax.swing.GroupLayout.PREFERRED_SIZE,
28, javax.swing.GroupLayout.PREFERRED_SIZE))
);
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
/**
*/
Mysplash.setVisible(true);
try{
Thread.sleep(40);
Mysplash.Myprogress.setValue(i);
Mysplash.Percentage.setText(Integer.toString(i)+"%");
}catch(Exception e)
16
/* Set the Nimbus look and feel */
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
17
java.util.logging.Logger.getLogger(Splash.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Splash.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Splash.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Splash.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
//</editor-fold>
18
java.awt.EventQueue.invokeLater(new Runnable() {
new Splash().setVisible(true);
});
new Login().setVisible(true);
Mysplash.dispose();
19
// End of variables declaration
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
*/
/**
20
*
* @author Rajesh
*/
/**
*/
public Login() {
initComponents();
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
*/
@SuppressWarnings("unchecked")
22
jLabel4 = new javax.swing.JLabel();
jTextField1.setText("jTextField1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
RoleCb.addActionListener(new java.awt.event.ActionListener() {
RoleCbActionPerformed(evt);
});
jLabel1.setText(" LOGIN");
jButton1.setText("Login");
23
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
jButton1MouseClicked(evt);
});
jLabel2.setText("Select Role");
jLabel3.setText("Password");
jButton2.setText("Clear");
jLabel4.setText(" X");
jLabel4.addMouseListener(new java.awt.event.MouseAdapter() {
jLabel4MouseClicked(evt);
24
}
});
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()
.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))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG, false)
.addComponent(Password)))
.addGroup(layout.createSequentialGroup()
.addComponent(jButton1,
javax.swing.GroupLayout.PREFERRED_SIZE, 115,
javax.swing.GroupLayout.PREFERRED_SIZE)
.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)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
230, javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
27
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGap(9, 9, 9)
.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))
.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))
.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>
System.exit(0);
if(RoleCb.getSelectedItem().toString().equals("Seller"))
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{
catch(SQLException ex)
ex.printStackTrace();
31
}
else{
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{
32
catch(SQLException ex)
ex.printStackTrace();
/**
*/
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.
33
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
34
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new Login().setVisible(true);
});
35
// Variables declaration - do not modify
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
*/
/**
* @author Rajesh
*/
37
public class UpdateAdmin extends javax.swing.JFrame {
/**
*/
public UpdateAdmin() {
initComponents();
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
38
*/
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
39
jLabel1.setText(" X");
jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
jLabel1MouseClicked(evt);
});
jLabel2.setText("Name");
jLabel3.setText("Password");
jButton1.setText("Update");
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
jButton1MouseClicked(evt);
40
}
});
jButton2.setText("Clear");
jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
jButton2MouseClicked(evt);
});
jLabel4.setText(" UpdateAdmin");
jButton3.setText("Manage Seller");
jButton3.addMouseListener(new java.awt.event.MouseAdapter() {
jButton3MouseClicked(evt);
41
}
});
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.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)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.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)
.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)
);
44
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.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()
.addComponent(AdminPassword,
javax.swing.GroupLayout.PREFERRED_SIZE, 50,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE,
50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.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))
);
pack();
}// </editor-fold>
System.exit(0);
47
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {
AdminName.setText("");
AdminPassword.setText("");
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");
add.setString(1, AdminName.getText());
add.setString(2, AdminPassword.getText());
Con.close();
catch (SQLException e)
e.printStackTrace();
49
}
new Seller_Details().setVisible(true);
/**
*/
50
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(UpdateAdmin.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
51
java.util.logging.Logger.getLogger(UpdateAdmin.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(UpdateAdmin.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(UpdateAdmin.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new UpdateAdmin().setVisible(true);
}
52
});
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 Products_Sold() {
initComponents();
SelectSeller();
55
Statement St = null;
ResultSet Rs = null;
try {
Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");
St = Con.createStatement();
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
*/
@SuppressWarnings("unchecked")
57
AddBtn = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
58
jLabel1.setText(" X");
jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
jLabel1MouseClicked(evt);
});
jLabel3.setText("ProductID");
jLabel4.setText("Name");
jLabel6.setText("Quantity");
jLabel7.setText("Price");
59
AddBtn.setText("Add");
AddBtn.addMouseListener(new java.awt.event.MouseAdapter() {
AddBtnMouseClicked(evt);
});
EditBtn.setText("Edit");
EditBtn.addMouseListener(new java.awt.event.MouseAdapter() {
EditBtnMouseClicked(evt);
});
ClearBin.setText("Clear");
60
ClearBin.addMouseListener(new java.awt.event.MouseAdapter() {
ClearBinMouseClicked(evt);
});
DeleteBtn.setText("Delete");
DeleteBtn.addMouseListener(new java.awt.event.MouseAdapter() {
DeleteBtnMouseClicked(evt);
});
ProdName.addActionListener(new java.awt.event.ActionListener() {
ProdNameActionPerformed(evt);
61
}
});
jLabel8.setText("PRODUCT LIST");
Selling.setText("Selling");
Selling.addMouseListener(new java.awt.event.MouseAdapter() {
SellingMouseClicked(evt);
});
Logout.setText("Logout");
Logout.addMouseListener(new java.awt.event.MouseAdapter() {
LogoutMouseClicked(evt);
62
}
});
JTable1.setModel(new javax.swing.table.DefaultTableModel(
},
new String [] {
));
JTable1.addMouseListener(new java.awt.event.MouseAdapter() {
63
JTable1MouseClicked(evt);
});
jScrollPane2.setViewportView(JTable1);
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.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))
.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))
.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()
.addComponent(AddBtn)
.addComponent(EditBtn)))
.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)
.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)
.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)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.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()
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))
.addComponent(Selling)
.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))
.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)
);
pack();
}// </editor-fold>
73
if (ProdID.getText().isEmpty() || ProdName.getText().isEmpty() ||
ProdPrice.getText().isEmpty() || ProdQuantity.getText().isEmpty())
else {
try {
Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");
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()));
74
JOptionPane.showMessageDialog(this, "Product added Succesfully");
Con.close();
SelectSeller();
} catch (Exception e) {
e.printStackTrace();
ProdID.setText("");
ProdName.setText("");
ProdPrice.setText("");
ProdQuantity.setText("");
75
private void DeleteBtnMouseClicked(java.awt.event.MouseEvent evt) {
if (ProdID.getText().isEmpty()) {
} else {
try {
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");
Statement st=con.createStatement();
Add.executeUpdate(Query);
SelectSeller();
76
} catch (Exception e) {
e.printStackTrace();
if (ProdID.getText().isEmpty() || ProdName.getText().isEmpty() ||
ProdPrice.getText().isEmpty() || ProdQuantity.getText().isEmpty()) {
} else {
try {
77
Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");
Add.executeUpdate(Query);
SelectSeller();
} catch (SQLException e) {
e.printStackTrace();
78
private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {
System.exit(0);
new Selling().setVisible(true);
this.dispose();
new Login().setVisible(true);
this.dispose();
79
private void JTable1MouseClicked(java.awt.event.MouseEvent evt) {
ProdID.setText(model.getValueAt (Myindex,0).toString());
ProdName.setText(model.getValueAt (Myindex,1).toString());
ProdQuantity.setText(model.getValueAt (Myindex,3).toString());
/**
*/
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.
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
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);
java.util.logging.Logger.getLogger(Products_Sold.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Products_Sold.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new Products_Sold().setVisible(true);
82
}
});
83
private javax.swing.JButton Selling;
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
*/
/**
* @author Rajesh
*/
85
/**
*/
public Selling() {
initComponents();
SelectSeller();
Statement St = null;
ResultSet Rs = null;
try {
86
Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket","root"
,"Gabriel@19");
St= Con.createStatement();
ProductTable.setModel(DbUtils.resultSetToTableModel(Rs));
}catch (Exception e )
e.printStackTrace();
int newQuantity;
try {
Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/Supermarket","root"
,"Gabriel@19");
87
String Query="Update PRODUCTTBL set ProductQuantity ="+newQuantity+"
"+"where ProductName="+ProdName.getText();
Add.executeUpdate(Query);
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
88
*/
@SuppressWarnings("unchecked")
89
jButton4 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
ProductTable.setModel(new javax.swing.table.DefaultTableModel(
90
},
new String [] {
));
ProductTable.addMouseListener(new java.awt.event.MouseAdapter() {
ProductTableMouseClicked(evt);
});
jScrollPane1.setViewportView(ProductTable);
jLabel2.setText("Name");
jLabel3.setText("Quantity");
91
AddBtn.setText("Add to Bill");
AddBtn.addMouseListener(new java.awt.event.MouseAdapter() {
AddBtnMouseClicked(evt);
});
ClearBtn.setText("Clear");
ClearBtn.addMouseListener(new java.awt.event.MouseAdapter() {
ClearBtnMouseClicked(evt);
});
92
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new
String[] { "BEVERAGE", "VEGETABLE", "MEAT", "FRUIT", "THING" }));
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
jComboBox1ActionPerformed(evt);
});
jButton4.setText("Refresh");
jButton4.addMouseListener(new java.awt.event.MouseAdapter() {
jButton4MouseClicked(evt);
});
jLabel5.setText("X");
93
jLabel5.addMouseListener(new java.awt.event.MouseAdapter() {
jLabel5MouseClicked(evt);
});
EditBtn.setText("Print");
EditBtn.addMouseListener(new java.awt.event.MouseAdapter() {
EditBtnMouseClicked(evt);
});
EditBtn.addActionListener(new java.awt.event.ActionListener() {
EditBtnActionPerformed(evt);
94
});
Grdtotallbl.setText(" RS");
Grdtotallbl.addMouseListener(new java.awt.event.MouseAdapter() {
GrdtotallblMouseClicked(evt);
});
BillTxt.setColumns(20);
BillTxt.setRows(5);
jScrollPane2.setViewportView(BillTxt);
Seller_Details.setText("Next");
Seller_Details.addMouseListener(new java.awt.event.MouseAdapter() {
95
Seller_DetailsMouseClicked(evt);
});
PreviousBtn.setText("Previous");
PreviousBtn.addMouseListener(new java.awt.event.MouseAdapter() {
PreviousBtnMouseClicked(evt);
});
jLabel6.setText(" Filter");
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
96
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.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)
.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)
.addComponent(ClearBtn,
javax.swing.GroupLayout.PREFERRED_SIZE, 129,
javax.swing.GroupLayout.PREFERRED_SIZE)
.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)
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)
.addComponent(ProdName,
javax.swing.GroupLayout.PREFERRED_SIZE, 177,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.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()
.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)
.addComponent(jComboBox1,
javax.swing.GroupLayout.PREFERRED_SIZE, 132,
javax.swing.GroupLayout.PREFERRED_SIZE)
.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))
.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))
);
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)
.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))
.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))
.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)
.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)
);
pack();
}// </editor-fold>
double Uprice;
double ProdTot=0.0;
double GrdTotal=0.0;
int AvailQty;
107
ProdName.setText(model.getValueAt(Myindex,1).toString());
newQuantity = AvailQty-Integer.valueOf(ProdQuantity.getText());
ProdQuantity.setText(model.getValueAt(Myindex,4).toString());
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");
i++;
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" );
update();
110
}
ProdName.setText("");
ProdQuantity.setText("");
new Seller_Details().setVisible(true);
this.dispose();
111
// TODO add your handling code here:
new Products_Sold().setVisible(true);
this.dispose();
SelectSeller();
112
System.exit(0);
/**
*/
113
public static void main(String args[]) {
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
114
java.util.logging.Logger.getLogger(Selling.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Selling.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Selling.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Selling.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
//</editor-fold>
115
java.awt.EventQueue.invokeLater(new Runnable() {
new Selling().setVisible(true);
});
116
private javax.swing.JTable ProductTable;
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
118
*/
/**
* @author Rajesh
*/
/**
*/
public Seller_Details() {
initComponents();
SelectSeller();
119
Statement St = null;
ResultSet Rs = null;
try {
Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");
St = Con.createStatement();
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
*/
@SuppressWarnings("unchecked")
121
SName = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
122
jLabel1.setText("MANAGE SELLERS");
jLabel2.setText("NAME");
jLabel4.setText("PASSWORD");
jLabel5.setText("LOGOUT TIME");
TIMEIN.addActionListener(new java.awt.event.ActionListener() {
TIMEINActionPerformed(evt);
});
123
JTable2.setModel(new javax.swing.table.DefaultTableModel(
},
new String [] {
));
JTable2.addMouseListener(new java.awt.event.MouseAdapter() {
JTable2MouseClicked(evt);
});
124
jScrollPane1.setViewportView(JTable2);
ADDBIN.setText("ADD");
ADDBIN.addMouseListener(new java.awt.event.MouseAdapter() {
ADDBINMouseClicked(evt);
});
UpdateBtn.setText("EDIT");
UpdateBtn.addMouseListener(new java.awt.event.MouseAdapter() {
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() {
DELETEBINMouseClicked(evt);
});
CLEARBIN.setText("CLEAR");
CLEARBIN.addMouseListener(new java.awt.event.MouseAdapter() {
CLEARBINMouseClicked(evt);
126
}
});
jLabel6.setText("SELLERS DETAILS");
LogoutBtn.setText("Logout");
LogoutBtn.addMouseListener(new java.awt.event.MouseAdapter() {
LogoutBtnMouseClicked(evt);
});
LogoutBtn.addActionListener(new java.awt.event.ActionListener() {
LogoutBtnActionPerformed(evt);
});
127
jLabel7.setText(" X");
jLabel7.addMouseListener(new java.awt.event.MouseAdapter() {
jLabel7MouseClicked(evt);
});
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()
.addComponent(ADDBIN)
.addComponent(UpdateBtn))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(jLabel2)
.addComponent(jLabel3,
javax.swing.GroupLayout.PREFERRED_SIZE, 73,
javax.swing.GroupLayout.PREFERRED_SIZE))
.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()
.addComponent(jLabel5,
javax.swing.GroupLayout.PREFERRED_SIZE, 89,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.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()
.addComponent(DELETEBIN)
.addComponent(CLEARBIN))
.addGroup(layout.createSequentialGroup()
131
.addComponent(jLabel6,
javax.swing.GroupLayout.PREFERRED_SIZE, 194,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 174,
javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 870,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(LogoutBtn,
javax.swing.GroupLayout.PREFERRED_SIZE, 103,
javax.swing.GroupLayout.PREFERRED_SIZE)))
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)
133
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
48, javax.swing.GroupLayout.PREFERRED_SIZE)
.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()
.addComponent(LogoutBtn,
javax.swing.GroupLayout.PREFERRED_SIZE, 39,
javax.swing.GroupLayout.PREFERRED_SIZE)
.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))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASEL
INE)
.addComponent(ADDBIN)
.addComponent(UpdateBtn)
.addComponent(DELETEBIN)
135
.addComponent(CLEARBIN))
.addComponent(jLabel6)
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 236,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>
136
private void ADDBINMouseClicked(java.awt.event.MouseEvent evt) {
if (SName.getText().isEmpty() || SPass.getText().isEmpty() ||
TIMEIN.getText().isEmpty() || TIMEOUT.getText().isEmpty())
else {
try {
Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");
add.setString(1, SName.getText());
add.setString(2, SPass.getText());
add.setString(3, TIMEIN.getText());
137
add.setString(4, TIMEOUT.getText());
Con.close();
SelectSeller();
} catch (Exception e) {
e.printStackTrace();
138
int Myindex= JTable2.getSelectedRow();
SName.setText(model.getValueAt (Myindex,0).toString());
SPass.setText(model.getValueAt (Myindex,1).toString());
TIMEOUT.setText(model.getValueAt (Myindex,3).toString());
SName.setText("");
SPass.setText("");
TIMEIN.setText("");
TIMEOUT.setText("");
139
private void DELETEBINMouseClicked(java.awt.event.MouseEvent evt) {
if (SPass.getText().isEmpty()) {
else {
try {
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");
Statement st=con.createStatement();
Add.executeUpdate(Query);
SelectSeller();
140
} catch (Exception e) {
e.printStackTrace();
if (SName.getText().isEmpty() || SPass.getText().isEmpty() ||
TIMEIN.getText().isEmpty() || TIMEOUT.getText().isEmpty()) {
} else {
try {
141
Con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/supermarket",
"root", "Gabriel@19");
Add.executeUpdate(Query);
SelectSeller();
} catch (SQLException e) {
e.printStackTrace();
142
private void LogoutBtnActionPerformed(java.awt.event.ActionEvent evt) {
new Login().setVisible(true);
this.dispose();
143
System.exit(0);
/**
*/
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.
*/
try {
144
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(Seller_Details.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Seller_Details.class.getName()).log(java.util.log
ging.Level.SEVERE, null, 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>
java.awt.EventQueue.invokeLater(new Runnable() {
new Seller_Details().setVisible(true);
});
146
private javax.swing.JButton ADDBIN;
147
private javax.swing.JLabel jLabel7;
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