0% found this document useful (0 votes)
41 views

Project Report

The document describes a grocery store management project created in Java using object-oriented programming concepts. It contains 3 frames - a login frame, main page frame, and order table frame. The login frame allows users to enter credentials. The main page frame displays product images and menus to select items. The order table frame shows a table to store customer orders along with fields to enter customer details.

Uploaded by

maria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Project Report

The document describes a grocery store management project created in Java using object-oriented programming concepts. It contains 3 frames - a login frame, main page frame, and order table frame. The login frame allows users to enter credentials. The main page frame displays product images and menus to select items. The order table frame shows a table to store customer orders along with fields to enter customer details.

Uploaded by

maria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

DEPARTMENT OF SOFTWARE ENGINEERING

SUBMITTED TO

Ma’am Sadaf Anwar

SUBMITTED BY

MARIA BANO

BSSE-2-(A)-MORNING

NUML-S21-18375

ROLL N0# SP21024

COURSE

Object Oriented Programming

Topic

Project Report
Project About:

Grocery Store:

The project consists of total of 3 frames. The first frame is the login frame where
the user will enter his/her credentials to login into system. The second frame is the
main page of Grocery Store where user will select which item he wants by using
different menus as given. The third frame of grocery store includes a table where al
the items will be stored. The frame also has a customer name, address and phone
number fields where the user will enter the data in order to get his order,

Frame 1:
Code:

package oopproject;

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.*;

import java.sql.*;

import java.util.logging.Level;

import java.util.logging.Logger;

import javax.swing.table.DefaultTableModel;

public class OopProject implements ActionListener{

public static JButton b1;


public static JButton b2;

public static JFrame f;

public static JButton nxt;

public static JButton add;

public static JFrame f2;

public static JTextField t1;

public static JPasswordField t2;

public static JTable tab1;

public static DefaultTableModel dt;

public static JTextField tA;

public static JTextField tB;

public int a;

public String b;

public int P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16;

public int NetP;

public static void main(String[] args) {

f = new JFrame("GOCERY STORE");

f.setSize(1020, 600);

f.setLayout(null);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//panel for login

JPanel p1=new JPanel();

p1.setBounds(510, 0, 600, 600);

p1.setBackground(Color.lightGray);

p1.setLayout(null);

//panel for image

JPanel p2 = new JPanel();

p2.setBounds(0, 0, 600, 600);

p2.setBackground(Color.lightGray);

p2.setLayout(null);

//creating image for panel2(p2).

ImageIcon i=new ImageIcon("F:\\gggs2.jpg");

JLabel l3 = new JLabel();

l3.setIcon(i);

l3.setBounds(0,-20, 600, 600);

p2.add(l3);

//creating image of icon of cart at panel1(p1)

ImageIcon i2=new ImageIcon("F:\\cart6.png");

JLabel l4=new JLabel();

l4.setIcon(i2);
l4.setBounds(70, 50, 70, 70);

p1.add(l4);

//labels for welcome to grocery shop.

JLabel l5=new JLabel("WELCOME");

l5.setFont(new Font("Arial",Font.BOLD,25));

l5.setBounds(150,30,200,80);

p1.add(l5);

JLabel l6=new JLabel("to the grocery store");

l6.setFont(new Font("Arial",Font.BOLD,12));

l6.setBounds(150,50,200,80);

p1.add(l6);

//label for email.

JLabel l1 = new JLabel("Email");

l1.setBounds(70,160,80,80);

l1.setFont(new Font("Arial",Font.BOLD,14));

l1.setForeground(Color.darkGray);

//textfield for entering email.

t1=new JTextField();

t1.setBackground(Color.lightGray);

t1.setBorder(BorderFactory.createLineBorder(Color.white));
t1.setBounds(150, 190, 250, 25);

//label for passwrd.

JLabel l2 = new JLabel("Password");

l2.setBounds(70,204,80,80);

l2.setFont(new Font("Arial",Font.BOLD,14));

l2.setForeground(Color.darkGray);

//password field for entering password

t2=new JPasswordField();

t2.setBounds(150, 232, 250, 25);

t2.setBorder(BorderFactory.createLineBorder(Color.white));

t2.setBackground(Color.lightGray);

//login button.

b1=new JButton("Login");

b1.setBounds(150, 275, 250, 25);

b1.setFocusable(false);

//setting border to login button

b1.setBorder(BorderFactory.createLineBorder(Color.white));

b1.setBackground(Color.white);

b1.addActionListener(new OopProject());
b2=new JButton(" Create an account");

b2.setBounds(150, 310, 250, 25);

b2.addActionListener(new OopProject());

b2.setFocusable(false);

//setting border to create an account button

b2.setBorder(BorderFactory.createLineBorder(Color.white));

b2.setBackground(Color.white);

f.setResizable(false);

f.setVisible(true);

f.add(p1);

f.add(p2);

p1.add(l1);

p1.add(t1);

p1.add(l2);

p1.add(t2);

p1.add(b1);

p1.add(b2);

}
@Override

public void actionPerformed(ActionEvent e) {

if(e.getSource().equals(b2)){

Connection con;

PreparedStatement ps;

try {

Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");

con = DriverManager.getConnection("jdbc:ucanaccess://F:\\login.accdb");

ps = con.prepareStatement("insert into records(Email,Password)values(?,?)");

ps.setString(1, t1.getText());

ps.setString(2, t2.getText());

ps.executeUpdate();

catch (ClassNotFoundException ex) {

Logger.getLogger(OopProject.class.getName()).log(Level.SEVERE, null, ex);

} catch (SQLException ex) {

Logger.getLogger(OopProject.class.getName()).log(Level.SEVERE, null, ex);

}
}

if(e.getSource().equals(b1)){

String len = t2.getText();

if(t1.getText().equals("")&&t2.getText().equals("")){

JOptionPane.showMessageDialog(null," Please first Enter Email and Password");

else{

if(len.length()<4){

JOptionPane.showMessageDialog(null, " Your Paswword must contain atleat 4


characters");

else{

try{

Connection co;

PreparedStatement pst;

ResultSet rs;

Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");

co = DriverManager.getConnection("jdbc:ucanaccess://F:\\login.accdb");

String sql="select * from records where Email='"+t1.getText()+"' and


Password='"+t2.getText()+"'";
pst = co.prepareStatement(sql);

rs=pst.executeQuery();

if(rs.next()){

f.setVisible(false);

Code Screenshot:
Frame 2:
Code:

f2=new JFrame("Grocery Store (home page)");

f2.setSize(1366, 768);

f2.setLayout(null);

f2.setVisible(true);

f2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JLabel p = new JLabel();

p.setBounds(0,0,1366,768);

p.setBackground(Color.lightGray);

ImageIcon pimg = new ImageIcon("F:\\img\\bkgd.jpg");

p.setIcon(pimg);

f2.add(p);

//-------------------------------------------Labels FOR IMAGES---------------------------------------


---//

JLabel pa = new JLabel();

pa.setBounds(120, 40, 300, 200);

pa.setBackground(Color.lightGray);

JLabel pb = new JLabel();


pb.setBounds(930, 40, 300, 200);

pb.setBackground(Color.lightGray);

JLabel pc = new JLabel();

pc.setBounds(120, 370, 300, 200);

pc.setBackground(Color.lightGray);

JLabel pd = new JLabel();

pd.setBounds(930, 370, 300, 200);

pd.setBackground(Color.lightGray);

JLabel pe = new JLabel();

pe.setBounds(520, 200, 300, 200);

pe.setBackground(Color.lightGray);

//

////---------------------------------------Adding Panels on frame---------------------------------------------


-----------//

p.add(pa);

p.add(pb);

p.add(pc);

p.add(pd);

p.add(pe);
////-----------------------------------------------------------------------------------------------------------------
-----//

////-------------------------------------images icons-------------------------------------------------------------
--------//

ImageIcon img1 = new ImageIcon("F:\\img\\bakenbread.jpg");

ImageIcon img2 = new ImageIcon("F:\\img\\fish.jpeg");

ImageIcon img3 = new ImageIcon("F:\\img\\oilsauce.jpg");

ImageIcon img4 = new ImageIcon("F:\\img\\cereals.jpg");

ImageIcon img5 = new ImageIcon("F:\\img\\rice.jpeg");

//

////---------------------adding images on panels---------------------------------------------------------------


--------//

pa.setIcon(img1);

pb.setIcon(img2);

pc.setIcon(img3);

pd.setIcon(img4);

pe.setIcon(img5);

//-------------------------------------Menus list for items------------------------------------------------------


//

JMenuBar mb=new JMenuBar();

mb.setBounds(120, 240, 300, 30);

JMenu m1 = new JMenu("Bakery & Bread");

m1.addActionListener(new ActionListener() {
@Override

public void actionPerformed(ActionEvent e) {

});

mb.add(m1);

JMenuItem m1a =new JMenuItem("Whole weat bread 40pcs RS 200");

m1a.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

tA = new JTextField();

tB = new JTextField();

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

if(a>10){

JOptionPane.showMessageDialog(null," Limit exceeded");

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

P1=200*a;

String S1=Integer.toString(P1);
tA.setText(m1a.getText());

tB.setText(S1);

JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your


item to the cart ");

});

JMenuItem m1b =new JMenuItem("English Muffin RS 100");

m1b.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

tA = new JTextField();

tB = new JTextField();

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

if(a>10){

JOptionPane.showMessageDialog(null," Limit exceeded");

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

tA.setText(m1b.getText());
JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your
item to the cart ");

P2=100*a;

String S1=Integer.toString(P2);

tB.setText(S1);

});

JMenuItem m1c =new JMenuItem("Whole Grain Flour 1Kg RS 220");

m1c.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

tA = new JTextField();

tB = new JTextField();

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

if(a>10){

JOptionPane.showMessageDialog(null," Limit exceeded");

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

tA.setText(m1c.getText());

JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your


item to the cart ");
P3=220*a;

String S1=Integer.toString(P3);

tB.setText(S1);

});

//adding menu items n menu

m1.add(m1a);

m1.add(m1b);

m1.add(m1c);

JMenuBar mb2=new JMenuBar();

mb2.setBounds(930, 240, 300, 30);

JMenu m2 = new JMenu("Meat & Seafood");

mb2.add(m2);

JMenuItem m2a =new JMenuItem("Chicken 1Kg Rs 400");

m2a.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

tA = new JTextField();

tB = new JTextField();

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

if(a>10){
JOptionPane.showMessageDialog(null," Limit exceeded");

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

tA.setText(m2a.getText());

JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your


item to the cart ");

P4=400*a;

String S1=Integer.toString(P4);

tB.setText(S1);

});

JMenuItem m2b =new JMenuItem("Beef 1Kg Rs 600");

m2b.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

tA = new JTextField();

tB = new JTextField();

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

if(a>10){

JOptionPane.showMessageDialog(null," Limit exceeded");

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");


a= Integer.parseInt(b);

tA.setText(m2b.getText());

JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your


item to the cart ");

P5=600*a;

String S1=Integer.toString(P5);

tB.setText(S1);

});

JMenuItem m2c =new JMenuItem("Salmon 500g Rs 500");

m2c.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

tA = new JTextField();

tB = new JTextField();

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

if(a>10){

JOptionPane.showMessageDialog(null," Limit exceeded");

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

}
tA.setText(m2c.getText());

JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your


item to the cart ");

P6=500*a;

String S1=Integer.toString(P6);

tB.setText(S1);

});

//adding menu items on menu

m2.add(m2a);

m2.add(m2b);

m2.add(m2c);

JMenuBar mb3=new JMenuBar();

mb3.setBounds(120, 570, 300, 30);

JMenu m3 = new JMenu("Oils & Sauces");

mb3.add(m3);

JMenuItem m3a =new JMenuItem("Olive oil 1Kg 250");

m3a.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

tA = new JTextField();

tB = new JTextField();
b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

if(a>10){

JOptionPane.showMessageDialog(null," Limit exceeded");

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

tA.setText(m3a.getText());

JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your


item to the cart ");

P7=250*a;

String S1=Integer.toString(P7);

tB.setText(S1);

});

JMenuItem m3b =new JMenuItem(" Cooking oil 1kg Rs 180");

m3b.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

tA = new JTextField();

tB = new JTextField();

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);
if(a>10){

JOptionPane.showMessageDialog(null," Limit exceeded");

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

tA.setText(m3b.getText());

JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your


item to the cart ");

P8=180*a;

String S1=Integer.toString(P8);

tB.setText(S1);

});

JMenuItem m3c =new JMenuItem("Tomato Sauce 1Kg Rs 260");

m3c.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

tA = new JTextField();

tB = new JTextField();

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

if(a>10){

JOptionPane.showMessageDialog(null," Limit exceeded");


b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

tA.setText(m3c.getText());

JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your


item to the cart ");

P9=260*a;

String S1=Integer.toString(P9);

tB.setText(S1);

});

//adding menu items 0n menu

m3.add(m3a);

m3.add(m3b);

m3.add(m3c);

//

JMenuBar mb4=new JMenuBar();

mb4.setBounds(930, 570, 300, 30);

JMenu m4 = new JMenu("Cereals & Breakfast food");

mb4.add(m4);

JMenuItem m4a =new JMenuItem("Multigrain cereals 500g Rs 250");


m4a.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

tA = new JTextField();

tB = new JTextField();

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

if(a>10){

JOptionPane.showMessageDialog(null," Limit exceeded");

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

tA.setText(m4a.getText());

JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your


item to the cart ");

P10=250*a;

String S1=Integer.toString(P10);

tB.setText(S1);

});

JMenuItem m4b =new JMenuItem(" Oat meal 500g Rs 230");

m4b.addActionListener(new ActionListener() {

@Override
public void actionPerformed(ActionEvent e) {

tA = new JTextField();

tB = new JTextField();

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

if(a>10){

JOptionPane.showMessageDialog(null," Limit exceeded");

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

tA.setText(m4b.getText());

JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your


item to the cart ");

P11=230*a;

String S1=Integer.toString(P11);

tB.setText(S1);

});

JMenuItem m4c =new JMenuItem("Wholegrain Cereals bar 500g rs 260");

m4c.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

tA = new JTextField();
tB = new JTextField();

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

if(a>10){

JOptionPane.showMessageDialog(null," Limit exceeded");

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

tA.setText(m4c.getText());

JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your


item to the cart ");

P12=260*a;

String S1=Integer.toString(P12);

tB.setText(S1);

});

//adding menu items on menu

m4.add(m4a);

m4.add(m4b);

m4.add(m4c);
JMenuBar mb5=new JMenuBar();

mb5.setBounds(520, 400, 300, 30);

JMenu m5 = new JMenu("Pasta & Rice");

mb5.add(m5);

JMenuItem m5a =new JMenuItem("brown rice 1kg Rs 400");

m5a.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

tA = new JTextField();

tB = new JTextField();

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

if(a>10){

JOptionPane.showMessageDialog(null," Limit exceeded");

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

tA.setText(m5a.getText());

JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your


item to the cart ");

P13=400*a;
String S1=Integer.toString(P13);

tB.setText(S1);

});

JMenuItem m5b =new JMenuItem("whole weat pasta 500g Rs 230");

m5b.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

tA = new JTextField();

tB = new JTextField();

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

if(a>10){

JOptionPane.showMessageDialog(null," Limit exceeded");

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

tA.setText(m5b.getText());

JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your


item to the cart ");

P14 = 230*a;

String S1=Integer.toString(P14);
tB.setText(S1);

});

JMenuItem m5c =new JMenuItem("Macroni 500g Rs 250");

m5c.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

tA = new JTextField();

tB = new JTextField();

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

if(a>10){

JOptionPane.showMessageDialog(null," Limit exceeded");

b=JOptionPane.showInputDialog(" Enter quantity (limit 10)","1");

a= Integer.parseInt(b);

tA.setText(m5c.getText());

JOptionPane.showMessageDialog(null, "Press 'ADD to CART' Button to add your


item to the cart ");

P15 = 250*a;

String S1=Integer.toString(P15);

tB.setText(S1);
}

});

//adding menu items on menu

m5.add(m5a);

m5.add(m5b);

m5.add(m5c);

//----------------------------------------end of menu list--------------------------------------------------------


---//

//----------------------------------------adding Menu bars on frame------------------------------------------


--------//

p.add(mb);

p.add(mb2);

p.add(mb3);

p.add(mb4);

p.add(mb5);

//---------------------------------------------------------------------------------------------------------------//

//------------------------Table for cart------------------------------------------------------------------------//

tab1 = new JTable(0,3);


tab1.setPreferredSize(new Dimension(520, 300));

tab1.setBackground(new Color(255, 230, 204));

//--------------------Button to add a time on cart----------------------------------------//

add = new JButton(" ADD to CART");

add.setBounds(420, 650, 500, 35);

f2.add(add);

add.setFocusable(false);

add.setBorder(BorderFactory.createLineBorder(Color.black));

add.setBackground(Color.white);

add.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

JOptionPane.showMessageDialog(null," Item Has been Added To Cart! ");

String stg[]={tA.getText(),b,tB.getText()};

dt=(DefaultTableModel)tab1.getModel();

dt.addRow(stg);

});
nxt = new JButton("Next");

nxt.setSize(100, 30);

nxt.setBounds(1150, 650, 100, 30);

f2.add(nxt);

nxt.setFocusable(false);

nxt.setBorder(BorderFactory.createLineBorder(Color.black));

nxt.setBackground(Color.white);

//--------------------------------------------3rd Panel----------------------------------------------------------//

nxt.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

if(e.getSource().equals(nxt)){

f2.setVisible(false);

Code Screenshot:
Frame 3:
Code:

JFrame f3=new JFrame(" Cart ");

f3.setSize(1366, 768);

f3.setLayout(new GridLayout(1,2));

f3.setVisible(true);

//Label for customer data

JLabel p4=new JLabel();

p4.setBackground(Color.lightGray);
p4.setLayout(new FlowLayout());

ImageIcon p4img = new ImageIcon("F:\\img\\bkgd.jpg");

p4.setIcon(p4img);

JLabel lA = new JLabel("CUSTOMER DATA");

lA.setFont(new Font("Arial",Font.BOLD,25));

lA.setPreferredSize(new Dimension (600,300));

lA.setBackground(Color.red);

JLabel la = new JLabel("Customer Name : ");

la.setPreferredSize(new Dimension (270,20));

JTextField ta = new JTextField();

ta.setPreferredSize(new Dimension (270,20));

JLabel lb = new JLabel("Phone no : ");

lb.setPreferredSize(new Dimension (270,20));

JTextField tb = new JTextField();

tb.setPreferredSize(new Dimension (270,20));

JLabel lc = new JLabel("Customer Address : ");

lc.setPreferredSize(new Dimension (270,20));


JTextField tc = new JTextField();

tc.setPreferredSize(new Dimension (270,20));

JLabel ld = new JLabel("Payment Method : CASH ON DELIVERY ");

ld.setPreferredSize(new Dimension (340,80));

JButton done = new JButton("DONE");

done.setPreferredSize(new Dimension(340,20));

done.setBackground(Color.PINK.brighter());

done.setBorder(BorderFactory.createLineBorder(Color.white));

done.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

if(ta.getText().equals("")&&tb.getText().equals("")&&tc.getText().equals("")){

JOptionPane.showMessageDialog(null, "Please Enter the Customer Data


First!!!");

else{

JOptionPane.showMessageDialog(null, "Your Order Had Been Placed Thank u


so much for shopping... Have A nice DAY");
}

});

p4.add(lA);

p4.add(la);

p4.add(ta);

p4.add(lb);

p4.add(tb);

p4.add(lc);

p4.add(tc);

p4.add(ld);

p4.add(done);
//Label for cart

JLabel p5 = new JLabel();

p5.setBackground(Color.gray);

p5.setLayout(new BorderLayout());

ImageIcon p5img = new ImageIcon("F:\\img\\bkgd.jpg");

p5.setIcon(p5img);

JLabel l6 = new JLabel();

l6.setPreferredSize(new Dimension (80,100));

l6.setFont(new Font("Arial",Font.BOLD,25));

l6.setBackground(Color.red);

JLabel l7 = new JLabel();

l7.setPreferredSize(new Dimension (80,50));

l7.setBackground(Color.blue);

JLabel l8 = new JLabel();

l8.setPreferredSize(new Dimension (80,20));

l8.setBackground(Color.yellow);

JLabel l9 = new JLabel();


l9.setPreferredSize(new Dimension (150,100));

l9.setBackground(Color.cyan);

l9.setLayout(new FlowLayout());

NetP=P1+P2+P3+P4+P5+P6+P7+P8+P9+P10+P11+P12+P13+P14+P15;

JLabel L_l9 = new JLabel("TOTAL PRICE : "+NetP);

L_l9.setPreferredSize(new Dimension (150,20));

// JTextField T_l9 = new JTextField();

// T_l9.setPreferredSize(new Dimension (100,20));

l9.add(L_l9);

// l9.add(T_l9);

JLabel l6a = new JLabel("CART");

l6a.setBounds(80,20,70,90);

l6a.setFont(new Font("Arial",Font.BOLD,25));
p5.add(tab1, BorderLayout.CENTER);

p5.add(l6, BorderLayout.NORTH);

p5.add(l7, BorderLayout.WEST);

p5.add(l8, BorderLayout.EAST);

p5.add(l9, BorderLayout.SOUTH);

l6.add(l6a);

f3.add(p5);

f3.add(p4);

f3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

});

} catch (SQLException ex) {

Logger.getLogger(OopProject.class.getName()).log(Level.SEVERE, null, ex);


} catch (ClassNotFoundException ex) {

Logger.getLogger(OopProject.class.getName()).log(Level.SEVERE, null, ex);

}
Code Screenshot:

Data Base Screenshot:

You might also like