0% found this document useful (0 votes)
7 views40 pages

Java

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)
7 views40 pages

Java

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/ 40

1

1. INTRODUCTION
The Inventory Management System is a vital component of any business that deals with
maintaining and tracking their inventory. It is responsible for keeping track of the products,
their quantities, and their various attributes. The system ensures that the right products are
available in the right quantities at the right time, helping businesses streamline their
operations and optimize their inventory levels.
Java GUI (Graphical User Interface) refers to the graphical interface components and tools
provided by the Java programming language to create interactive and visually appealing
applications. It enables developers to design user interfaces with buttons, menus, text fields,
checkboxes, and other graphical elements, allowing users to interact with the application
using mouse clicks, keyboard inputs, and other input devices.
Java GUI provides a platform-independent way of creating desktop applications that can run
on different operating systems, such as Windows, macOS, and Linux. It is based on the Java
Foundation Classes (JFC) and includes libraries like Swing and JavaFX, which offer a wide
range of pre-built GUI components and functionalities.
In this project, we will develop an Inventory Management System using Java and a graphical
user interface (GUI). The GUI will provide an intuitive and user-friendly interface for
managing the inventory, allowing users to perform various operations such as adding new
products, updating product information, deleting products, and generating reports.
The key features of our Inventory Management System will include:
1. Product Management: The system will allow users to add new products to the inventory,
update existing product information (such as name, price, quantity, etc.), and delete products
when necessary.
2. Inventory Tracking: The system will keep track of the available stock for each product,
allowing users to view the current quantity, track sales, and identify low stock items.
3. Graphical User Interface (GUI): The GUI will provide an intuitive and visually appealing
interface for users to interact with the system. It will include buttons, menus, text fields, and
other graphical components to facilitate easy data entry and retrievalretrieval.
4. Search and Filtering: The system will provide search and filtering functionalities to help
users quickly find specific products or categories of products. Users can search by product
name, category, price range, or any other relevant criteria.
5. Sales and Order Management: The system can integrate with the sales module

2
2. SYSTEM SPECIFICATIONS

2.1 EXISTING SYSTEM

A traditional inventory management system refers to a manual or non-


digital approach to tracking and managing inventory within a
business. Before the advent of modern technologies and software
systems, businesses relied on manual methods to keep track of their
inventory levels and ensure adequate stock availability.
Disadvantages
1. Manual record-keeping: Inventory data is recorded and maintained
manually using paper-based systems, such as spreadsheets, logbooks,
or ledger books. Each transaction, including purchases, sales, and
adjustments, is recorded by hand.
2. Limited visibility: Since traditional systems lack real-time updates,
inventory information is not readily accessible. It requires physical
counting and manual checks to determine stock levels accurately.
3. Time-consuming stock counting: Periodic physical counts of
inventory are necessary to reconcile the recorded stock levels with the
actual stock on hand. This process can be time-consuming and prone
to errors.
4. Increased risk of errors: Manual data entry and calculations
increase the risk of errors, including incorrect stock counts, misplaced
decimal points, or data entry mistakes. These errors can lead to
discrepancies in inventory records.Certainly! Here are a few more
aspects of traditional inventory management systems:

3
2.2 PROPOSED SYSTEM
Our proposed inventory management system will provide a user-friendly and efficient
solution to streamline your inventory-related processes. It will be developed using Java
programming language and utilize a graphical user interface (GUI) to enhance usability and
productivity. The system will include the following key featuresfeatures:
A Java GUI (Graphical User Interface) based inventory management system offers several
advantages over traditional or non-graphical systems. Here are some key advantages:
1. User-friendly interface: A Java GUI provides a visually appealing and intuitive interface,
making it easier for users to interact with the inventory management system. The use of
buttons, menus, and graphical elements simplifies navigation and enhances the overall user
experience.
2. Improved productivity: The graphical interface streamlines tasks and processes, allowing
users to perform inventory-related activities more efficiently. Actions such as adding items,
updating stock levels, or placing orders can be accomplished with a few clicks, reducing
manual effort and saving time.
3. Real-time updates: A Java GUI based system can integrate with a database or server to
provide real-time updates on inventory levels. Users can instantly view changes in stock
quantities, track sales, and monitor item availability, ensuring accurate and up-to-date
information at all times.
4. Automation and integration: Java GUI frameworks offer robust capabilities for
integration with other systems. Inventory management processes can be automated,
reducing manual data entry and minimizing errors. Integration with accounting, sales, or
purchasing systems allows for seamless data exchange, improving efficiency and reducing
redundant tasks.
5. Scalability and customization: Java GUI frameworks offer flexibility and scalability,
allowing the system to adapt to growing business needs. As the inventory or operations
expand, the system can be easily modified or customized to accommodate new features,
functionalities, or specific business requirements.
6. Cross-platform compatibility: Java is a platform-independent language, meaning Java-
based GUI systems can run on various operating systems, including Windows, macOS, and
Linux. This cross-platform compatibility ensures broader accessibility and flexibility in
choosing hardware and operating environments.
9. Community support and resources: Java is a widely adopted programming language with
a large community of developers and extensive online resources. This means there are ample
libraries, frameworks, and forums available to support the development and maintenance of
Java GUI based inventory management systems.
Overall, a Java GUI based inventory management system offers a modern, user-friendly, and
efficient solution for businesses to effectively manage their inventory processes, improve
productivity, and make data-driven decisions.

4
2.3 SYSTEM REQUIREMENTS

2.3.1 SOFTWARE REQUIREMENTS:

 Java Development Kit (JDK) 8 or later


 Integrated Development Environment (IDE) such as Eclipse, NetBeans, or
IntelliJ IDEA
 Apache Maven build tool (optional but recommended)
 Git version control system (optional but recommended)

2.3.2 HARDWARE REQUIREMENTS:

 Processor: Intel Core i5 or equivalent


 RAM: 8 GB or more
 Hard disk: 50 GB or more
 Operating system: Windows, Mac OS X, or Linux

3. JAVA INTRODUCTION

Java is a powerful programming language that has become a staple in the software
development industry. It is an object-oriented language that is designed to be simple,
reliable, and secure. Java has a vast library of pre-built classes and APIs, which makes it an
ideal language for developing complex applications. In this article, we will explore some
of the key features of Java and why it is such a popular language.

Platform Independence

One of the most significant features of Java is its platform independence. Java
programs are compiled into bytecode, which is then interpreted by the Java Virtual
Machine (JVM). The JVM is available for a wide range of operating systems, including
Windows, Linux, and macOS. This means that a Java program can be written on one
operating system and then run on any other operating system that has a JVM installed.

5
This feature makes Java an ideal choice for developing applications that need to be
deployed on multiple platforms. It also allows developers to write applications that can be
used on a wide range of devices, from desktop computers to mobile phones and embedded
systems.

Memory Management

Another essential feature of Java is its automatic memory management. Java uses a
garbage collector to manage the memory used by a program. The garbage collector
periodically scans the program’s memory for objects that are no longer being used and
frees up that memory for reuse.

This feature makes Java a safer language to use since it eliminates the possibility of
memory leaks and buffer overflows. It also reduces the amount of time and effort that
developers need to spend managing memory, which makes it easier to write complex
applications.

Object-Oriented Programming

Java is an object-oriented language, which means that it is based on the concept of


objects. An object is an instance of a class, which contains both data and behavior. This
feature allows developers to write reusable code that can be easily modified and adapted to
different situations.

In Java, all data types are objects, which means that they have methods and
properties that can be used to manipulate them. This makes it easier to work with complex
data types, such as arrays and collections.

Robustness and Security

Java is designed to be a robust and secure language. It includes features such as


exception handling and type checking, which help to prevent errors and ensure that code
runs smoothly. Java also includes security features, such as a security manager and a
sandbox, which help to prevent malicious code from being executed.

These features make Java an ideal language for developing secure applications that
need to handle sensitive data. Java is commonly used in the development of financial
applications, healthcare systems, and other applications that require a high level of
security.

6
Libraries and Frameworks

Java has a vast library of pre-built classes and APIs, which makes it easier to write
complex applications. The Java Standard Library includes classes for networking, file
input/output, and user interface development. There are also many third-party libraries and
frameworks available, which can be easily integrated into Java applications.

One of the most popular frameworks for Java is Spring. Spring provides a
comprehensive set of tools and libraries for building web applications. It includes features
such as dependency injection, aspect-oriented programming, and transaction management,
which make it easier to write complex applications.

Another popular framework for Java is Hibernate. Hibernate provides a powerful


object-relational mapping (ORM) tool for working with databases. It allows developers to
write database queries using Java code, which makes it easier to work with databases and
reduces the amount of SQL code that needs to be written.

Community and Support

Java has a large and active community of developers, which means that there is a
wealth of knowledge and resources available for developers. There are many online
forums, blogs, and tutorials available, which can help developers to learn new skills and
solve problems.

Java also has a wide range of development tools available, such as the Eclipse
Integrated Development Environment (IDE)

Java is a widely used programming language that was developed by Sun


Microsystems in 1995. It is an object-oriented language that is designed to be simple,
reliable, and secure. Java is used to develop a wide range of applications, including web
applications, mobile applications, and enterprise software.

In this article, we will introduce you to the basics of Java programming, including
its syntax, data types, and control structures.

7
Java Syntax

Java code is written in plain text files with the extension .java. Java programs are
organized into classes, which are the basic building blocks of Java applications. Each class
contains methods, which are blocks of code that perform specific tasks.

A basic Java program consists of a class definition and a main method. The class
definition contains the name of the class, and the main method is the entry point for the
program. Here is an example of a basic Java program;

Public class HelloWorld {

Public static void main(String[] args) {

System.out.println(“Hello, World!”);

This program defines a class called `HelloWorld` and a main method that prints the
text “Hello, World!” to the console.

Data Types

Java has several built-in data types, including:

- `int`: used for storing integer values.


- `double`: used for storing floating-point values.

- `boolean`: used for storing true/false values.

- `char`: used for storing single characters.

- `String`: used for storing text strings.

Variables in Java must be declared before they can be used. Here is an example of
declaring and initializing a variable:

Control Structures

Java has several control structures that allow you to control the flow of a program.

8
These include:

- `if`: used for executing code if a condition is true.

- `else`: used for executing code if a condition is false.

- `for`: used for iterating over a range of values.

- `while`: used for executing code while a condition is true.

- `do-while`: used for executing code at least once and then repeatedly while a condition is
true.

4. SYSTEM DESIGN
Inventory is the goods or materials a business intends to sell to customers for profit.
Inventory management, a critical element of the supply chain, is the tracking of inventory
from manufacturers to warehouses and from these facilities to a point of sale. The goal of
inventory management is to have the right products in the right place at the right time. This
requires inventory visibility — knowing when to order, how much to order and where to store
stock.

The basic steps of inventory management include:

1. Purchasing inventory: Ready-to-sell goods are purchased and delivered to the


warehouse or directly to the point of sale.

2. Storing inventory: Inventory is stored until needed. Goods or materials are transferred
across your fulfillment network until ready for shipment.

3. Profiting from inventory: The amount of product for sale is controlled. Finished goods
are pulled to fulfill orders. Products are shipped to customers.

9
In this Inventory management system, we are not proving any database connection we
are created one .txt by reading that .txt file we are retrieving data in the tabular format in the
GUI interface and also doing some operation on that .txt file like adding the data, removing
the data, and updating the data.

When the user open GUI application the interface consists of Search button, Display
button and Exit button. When the user clicks on Search button the user interface consists of
item text box and search button. If you want to search any item you should enter item name
in text box and click on search button it will display about the item in tabular format.

When the user clicks on display button the interface consists of add/delete button,
purchase button, update button and display button. When the user clicks on display button it
displays all the items present in the .txt file in tabular format. If the user clicks on add/delete
button you will get one interface which contains item, quantity, and price field. When you fill
all the details after click on add button it will be add into the .txt file. If you want to clear the
entered text you should click on the clear button. In that same interface it contains delete
button. If you want to delete any item it you should enter your item name and click on delete
button it will delete entire record from the .txt file.

If you want to purchase any item from the given listed items you should click on the
purchase button and it open one interface which contains index number and quantity you

10
should enter those fields and then you should go with payment process in that enter price and
then click on pay button after that click on purchase it will reduce the items from the .txt file.

When you click on update button it will open one interface which contains item field
in that field you should enter the item name and then you should enter some fields in that
fields you should enter item change name, quantity, price and click on update button it will
change the entire record in the .txt file. When the user click exit button it will closes the
application.

5. IMPLEMENTATION
import java.io.*;

import java.util.ArrayList;

import java.util.List;

import javax.swing.*;

public class Display_Purchase extends javax.swing.JFrame {

public Display_Purchase() {

initComponents();

@SuppressWarnings("unchecked")

private void initComponents() {

jButton1 = new javax.swing.JButton();

jLabel4 = new javax.swing.JLabel();

jToggleButton1 = new javax.swing.JToggleButton();

jPanel1 = new javax.swing.JPanel();

jScrollPane1 = new javax.swing.JScrollPane();

jTable1 = new javax.swing.JTable();

jButton2 = new javax.swing.JButton();

jTabbedPane1 = new javax.swing.JTabbedPane();

jPanel2 = new javax.swing.JPanel();

jLabel1 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

jTextField3 = new javax.swing.JTextField();

jTextField4 = new javax.swing.JTextField();

11
jTextField5 = new javax.swing.JTextField();

jButton5 = new javax.swing.JButton();

jButton6 = new javax.swing.JButton();

jButton7 = new javax.swing.JButton();

jTextField14 = new javax.swing.JTextField();

jLabel7 = new javax.swing.JLabel();

jPanel4 = new javax.swing.JPanel();

jScrollPane2 = new javax.swing.JScrollPane();

jTable2 = new javax.swing.JTable();

jButton12 = new javax.swing.JButton();

jButton13 = new javax.swing.JButton();

jTextField10 = new javax.swing.JTextField();

jTextField11 = new javax.swing.JTextField();

jButton14 = new javax.swing.JButton();

jButton15 = new javax.swing.JButton();

jTextField12 = new javax.swing.JTextField();

jTextField13 = new javax.swing.JTextField();

jButton16 = new javax.swing.JButton();

jButton17 = new javax.swing.JButton();

jButton3 = new javax.swing.JButton();

jButton4 = new javax.swing.JButton();

jTextField1 = new javax.swing.JTextField();

jTextField2 = new javax.swing.JTextField();

jButton18 = new javax.swing.JButton();

jLabel6 = new javax.swing.JLabel();

jPanel5 = new javax.swing.JPanel();

jTextField6 = new javax.swing.JTextField();

jButton9 = new javax.swing.JButton();

jButton10 = new javax.swing.JButton();

jButton11 = new javax.swing.JButton();

jTextField7 = new javax.swing.JTextField();

jTextField8 = new javax.swing.JTextField();

jTextField9 = new javax.swing.JTextField();

12
jLabel5 = new javax.swing.JLabel();

jButton8 = new javax.swing.JButton();

jButton1.setText("jButton1");

jLabel4.setText("jLabel4");

jToggleButton1.setText("jToggleButton1");

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setTitle("Display_Add/Dlete_Update_Purchase");

jPanel1.setBackground(new java.awt.Color(51, 51, 51));

jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED,
new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 255)))

jTable1.setBackground(new java.awt.Color(204, 204, 204));

jTable1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED,
new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 204)));

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

new String [] {

"Index No.", "Item", "Qty.", "Unit Price"

){

boolean[] canEdit = new boolean [] {

false, false, false, false

};

public boolean isCellEditable(int rowIndex, int columnIndex) {

return canEdit [columnIndex];

});

jTable1.getTableHeader().setReorderingAllowed(false);

jScrollPane1.setViewportView(jTable1);

if (jTable1.getColumnModel().getColumnCount() > 0) {

jTable1.getColumnModel().getColumn(0).setPreferredWidth(10);

jTable1.getColumnModel().getColumn(1).setPreferredWidth(150);

jTable1.getColumnModel().getColumn(2).setResizable(false);

jTable1.getColumnModel().getColumn(2).setPreferredWidth(10);

jTable1.getColumnModel().getColumn(3).setPreferredWidth(10);

13
jButton2.setBackground(new java.awt.Color(51, 51, 51));

jButton2.setFont(new java.awt.Font("Vani", 1, 24)); // NOI18N

jButton2.setText("Display");

jButton2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED
, null, new java.awt.Color(0, 0, 0), new java.awt.Color(51, 153, 255), null));

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

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

jButton2ActionPerformed(evt);

});

jTabbedPane1.setBackground(new java.awt.Color(51, 153, 255));

jTabbedPane1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RA
ISED, new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 153)));

jTabbedPane1.setForeground(new java.awt.Color(255, 51, 102));

jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.LEFT);

jPanel2.setBackground(new java.awt.Color(204, 204, 204));

jLabel1.setBackground(new java.awt.Color(51, 51, 51));

jLabel1.setFont(new java.awt.Font("Vani", 1, 14)); // NOI18N

jLabel1.setText("Item");

jLabel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED,
new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 153)));

jLabel2.setBackground(new java.awt.Color(51, 51, 51));

jLabel2.setFont(new java.awt.Font("Vani", 1, 14)); // NOI18N

jLabel2.setText("Qty.");

jLabel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED,
new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 153)));

jLabel3.setBackground(new java.awt.Color(51, 51, 51));

jLabel3.setFont(new java.awt.Font("Vani", 1, 14)); // NOI18N

jLabel3.setText("Price");
jLabel3.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED,
new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 204)));

jTextField3.setBackground(new java.awt.Color(51, 51, 51));

jTextField3.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAIS
ED, new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 153)));

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

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

14
jTextField3ActionPerformed(evt);

});

jTextField4.setBackground(new java.awt.Color(51, 51, 51));

jTextField4.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAIS
ED, new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 153)));

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

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

jTextField4ActionPerformed(evt);

});

jTextField5.setBackground(new java.awt.Color(51, 51, 51));

jTextField5.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAIS
ED, new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 153)));

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

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

jTextField5ActionPerformed(evt);

});

jButton5.setBackground(new java.awt.Color(51, 51, 51));

jButton5.setFont(new java.awt.Font("Vani", 1, 14)); // NOI18N

jButton5.setText("Add");

jButton5.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED
, new java.awt.Color(0, 0, 0), new java.awt.Color(51, 153, 255)));

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

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

jButton5ActionPerformed(evt);

});

jButton6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton6.setText("Delete");

15
jButton6.addActionListener(new java.awt.event.ActionListener() {

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

jButton6ActionPerformed(evt);

});

jButton7.setBackground(new java.awt.Color(51, 51, 51));

jButton7.setFont(new java.awt.Font("Vani", 1, 14)); // NOI18N

jButton7.setText("Clear");

jButton7.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED
, new java.awt.Color(0, 0, 0), new java.awt.Color(51, 153, 255)));

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

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

jButton7ActionPerformed(evt);

});

jTextField14.setBackground(new java.awt.Color(51, 51, 51));

jTextField14.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAI
SED, new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 153)));

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

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

jTextField14ActionPerformed(evt);

});

jLabel7.setBackground(new java.awt.Color(51, 51, 51));

jLabel7.setFont(new java.awt.Font("Vani", 1, 14)); // NOI18N

jLabel7.setText("Item");

jLabel7.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED,
new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 153)));

16
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);

jPanel2.setLayout(jPanel2Layout);

jPanel2Layout.setHorizontalGroup(

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

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

.addGap(26, 26, 26)

.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 56,


javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(jPanel2Layout.createSequentialGroup()

.addComponent(jTextField14)

.addGap(34, 34, 34)

.addComponent(jButton6)

.addGap(37, 37, 37))

.addGroup(jPanel2Layout.createSequentialGroup()

.addComponent(jLabel2)

.addGap(18, 18, 18)

.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 116,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(237, 237, 237))

.addGroup(jPanel2Layout.createSequentialGroup()

.addComponent(jLabel3)

.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel2Layout.createSequentialGroup()

.addGap(18, 18, 18)

.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 115,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(jPanel2Layout.createSequentialGroup()

.addGap(37, 37, 37)

.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 55,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(57, 57, 57)

17
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 56,
javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGap(113, 113, 113))

.addGroup(jPanel2Layout.createSequentialGroup()

.addComponent(jLabel1)

.addGap(18, 18, 18)

.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 270,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(83, 83, 83))))

);

jPanel2Layout.setVerticalGroup(

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

.addGroup(jPanel2Layout.createSequentialGroup()

.addGap(74, 74, 74)

.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

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

.addComponent(jLabel1))

.addGap(40, 40, 40)

.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

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

.addComponent(jLabel2))

.addGap(42, 42, 42)

.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

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

.addComponent(jLabel3))

.addGap(38, 38, 38)

.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton5)

.addComponent(jButton7))

.addContainerGap(166, Short.MAX_VALUE))

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

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

.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel7)

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

.addComponent(jButton6))

.addGap(86, 86, 86))

);

jTabbedPane1.addTab("Add/Delete", jPanel2);

jPanel4.setBackground(new java.awt.Color(204, 204, 204));

jPanel4.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED,
new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 102)));

jPanel4.setForeground(new java.awt.Color(255, 255, 255));

jTable2.setBackground(new java.awt.Color(204, 204, 204));

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

new String [] {

"Index No.", "Item", "Qty.", "Unit Price"

){

Class[] types = new Class [] {

java.lang.Integer.class, java.lang.String.class, java.lang.Double.class, java.lang.Double.class

};

boolean[] canEdit = new boolean [] {

false, false, false, false

};

public Class getColumnClass(int columnIndex) {

return types [columnIndex];

19
}

public boolean isCellEditable(int rowIndex, int columnIndex) {

return canEdit [columnIndex];

});

jTable2.getTableHeader().setReorderingAllowed(false);

jScrollPane2.setViewportView(jTable2);

if (jTable2.getColumnModel().getColumnCount() > 0) {

jTable2.getColumnModel().getColumn(0).setPreferredWidth(10);

jTable2.getColumnModel().getColumn(1).setPreferredWidth(150);

jTable2.getColumnModel().getColumn(2).setPreferredWidth(10);

jTable2.getColumnModel().getColumn(3).setPreferredWidth(10);

jButton12.setText("No. of items");

jButton13.setText("Cash");

jTextField10.setEditable(false);

jTextField10.setBackground(new java.awt.Color(51, 51, 51));

jTextField10.setForeground(new java.awt.Color(255, 255, 255));

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

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

jTextField10ActionPerformed(evt);

});

jTextField11.setEditable(false);

jTextField11.setBackground(new java.awt.Color(51, 51, 51));

jTextField11.setForeground(new java.awt.Color(255, 255, 255));

jButton14.setText("Total Price");

20
jButton15.setText("Change");

jTextField12.setEditable(false);

jTextField12.setBackground(new java.awt.Color(51, 51, 51));

jTextField12.setForeground(new java.awt.Color(255, 255, 255));

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

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

jTextField12ActionPerformed(evt);

});

jTextField13.setEditable(false);

jTextField13.setBackground(new java.awt.Color(51, 51, 51));

jTextField13.setForeground(new java.awt.Color(255, 255, 255));

jButton16.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jButton16.setText("Pay");

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

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

jButton16ActionPerformed(evt);

});

jButton17.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jButton17.setText("Clear");

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

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

jButton17ActionPerformed(evt);

});

jButton3.setBackground(new java.awt.Color(51, 153, 255));

21
jButton3.setFont(new java.awt.Font("Vani", 1, 10)); // NOI18N

jButton3.setForeground(new java.awt.Color(255, 51, 153));

jButton3.setText("Index No.");

jButton3.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED
, new java.awt.Color(0, 0, 0), new java.awt.Color(51, 153, 255)));

jButton4.setBackground(new java.awt.Color(51, 153, 255));

jButton4.setFont(new java.awt.Font("Vani", 1, 12)); // NOI18N

jButton4.setForeground(new java.awt.Color(255, 51, 153));

jButton4.setText("Qty.");

jTextField1.setBackground(new java.awt.Color(51, 51, 51));

jTextField1.setForeground(new java.awt.Color(255, 255, 255));

jTextField1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAIS
ED, new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 153)));

jTextField2.setBackground(new java.awt.Color(51, 51, 51));

jTextField2.setForeground(new java.awt.Color(255, 255, 255));

jTextField2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAIS
ED, new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 153)));

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

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

jTextField2ActionPerformed(evt);

});

jButton18.setBackground(new java.awt.Color(51, 153, 255));

jButton18.setFont(new java.awt.Font("Vani", 1, 24)); // NOI18N

jButton18.setForeground(new java.awt.Color(255, 51, 153));

jButton18.setText("Purchase");

jButton18.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISE
D, new java.awt.Color(0, 0, 0), new java.awt.Color(51, 153, 255)));

22
jButton18.addActionListener(new java.awt.event.ActionListener() {

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

jButton18ActionPerformed(evt);

});

jLabel6.setFont(new java.awt.Font("Vani", 1, 24)); // NOI18N

jLabel6.setText("Item(s) Purchased");

javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);

jPanel4.setLayout(jPanel4Layout);

jPanel4Layout.setHorizontalGroup(

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

.addGroup(jPanel4Layout.createSequentialGroup()

.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel4Layout.createSequentialGroup()

.addGap(94, 94, 94)

.addComponent(jButton16)

.addGap(119, 119, 119)

.addComponent(jButton17))

.addGroup(jPanel4Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(jButton13, javax.swing.GroupLayout.PREFERRED_SIZE, 91,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jButton12))

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

.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, 73,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, 73,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(39, 39, 39)

23
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel4Layout.createSequentialGroup()

.addComponent(jButton14)

.addGap(18, 18, 18)

.addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, 94,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(jPanel4Layout.createSequentialGroup()

.addComponent(jButton15, javax.swing.GroupLayout.PREFERRED_SIZE, 83,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(18, 18, 18)

.addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, 94,


javax.swing.GroupLayout.PREFERRED_SIZE))))

.addGroup(jPanel4Layout.createSequentialGroup()

.addGap(46, 46, 46)

.addComponent(jButton3)

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

.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 81,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(35, 35, 35)

.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 81,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(29, 29, 29)

.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 81,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(jPanel4Layout.createSequentialGroup()

.addGap(178, 178, 178)

.addComponent(jButton18, javax.swing.GroupLayout.PREFERRED_SIZE, 142,


javax.swing.GroupLayout.PREFERRED_SIZE)))

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

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

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

.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

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

24
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 255,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(118, 118, 118))

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

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

.addContainerGap())))

);

jPanel4Layout.setVerticalGroup(

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

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

.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel4Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton3)

.addComponent(jButton4))

.addComponent(jTextField1, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

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

.addComponent(jButton18, javax.swing.GroupLayout.PREFERRED_SIZE, 40,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(jPanel4Layout.createSequentialGroup()

.addGap(21, 21, 21)

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

.addGap(18, 18, 18)

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

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

.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 171,


javax.swing.GroupLayout.PREFERRED_SIZE)

25
.addGap(18, 18, 18)

.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

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

.addComponent(jButton12)

.addComponent(jButton14)

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

.addGap(18, 18, 18)

.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton13)

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

.addComponent(jButton15)

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

.addGap(18, 18, 18)

.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton16)

.addComponent(jButton17))

.addGap(43, 43, 43))

);

jTabbedPane1.addTab(" Purchase", jPanel4);

jPanel5.setBackground(new java.awt.Color(204, 204, 204));

jPanel5.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED,
new java.awt.Color(0, 0, 0), new java.awt.Color(255, 51, 153)));

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

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

jTextField6ActionPerformed(evt);

});

26
jButton9.setText("Change Item Name");

jButton10.setText("Qty.");

jButton11.setText("Price");

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

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

jTextField7ActionPerformed(evt);

});

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

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

jTextField8ActionPerformed(evt);

});

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

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

jTextField9ActionPerformed(evt);

});

jLabel5.setText("Item");

jButton8.setText("Save Changes");

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

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

jButton8ActionPerformed(evt);

});

27
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);

jPanel5.setLayout(jPanel5Layout);

jPanel5Layout.setHorizontalGroup(

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

.addGroup(jPanel5Layout.createSequentialGroup()

.addGap(39, 39, 39)

.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(jPanel5Layout.createSequentialGroup()

.addGap(0, 0, Short.MAX_VALUE)

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


javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 259,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(jPanel5Layout.createSequentialGroup()

.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

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

.addComponent(jButton10, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)

.addComponent(jButton9, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))

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

.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jTextField8)

.addComponent(jTextField9)

.addGroup(jPanel5Layout.createSequentialGroup()

.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 208,


javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addContainerGap(108, Short.MAX_VALUE))

.addGroup(jPanel5Layout.createSequentialGroup()

28
.addGap(152, 152, 152)

.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 154,


javax.swing.GroupLayout.PREFERRED_SIZE)

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

);

jPanel5Layout.setVerticalGroup(

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

.addGroup(jPanel5Layout.createSequentialGroup()

.addGap(26, 26, 26)

.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

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

.addComponent(jLabel5))

.addGap(58, 58, 58)

.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton9)

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

.addGap(40, 40, 40)

.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton10)

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

.addGap(41, 41, 41)

.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton11)

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

.addGap(54, 54, 54)

.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 71,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap(93, Short.MAX_VALUE))

);

jTabbedPane1.addTab("Update", jPanel5);

29
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);

jPanel1.setLayout(jPanel1Layout);

jPanel1Layout.setHorizontalGroup(

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

.addGroup(jPanel1Layout.createSequentialGroup()

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

.addGroup(jPanel1Layout.createSequentialGroup()

.addGap(135, 135, 135)

.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 141,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(18, 203, Short.MAX_VALUE))

.addGroup(jPanel1Layout.createSequentialGroup()

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0,
Short.MAX_VALUE)

.addGap(52, 52, 52)))

.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 569,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap())

);

jPanel1Layout.setVerticalGroup(

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

.addGroup(jPanel1Layout.createSequentialGroup()

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

.addGroup(jPanel1Layout.createSequentialGroup()

.addContainerGap()

.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 485,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(jPanel1Layout.createSequentialGroup()

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 287,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(18, 18, 18)

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


javax.swing.GroupLayout.PREFERRED_SIZE)))

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

30
);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

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

.addGroup(layout.createSequentialGroup()

.addContainerGap()

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

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

);

layout.setVerticalGroup(

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

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

);

pack();

}// </editor-fold>

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

// Display Button

try {

for (int r = 0; r < 100; r++) { //initializing row

for (int c = 0; c < 4; c++) { //initializing column

jTable1.setValueAt(null, r, c);

BufferedReader rdfile = new BufferedReader(new FileReader("items.txt"));

String[] item = new String[100];

String[] temp;

31
int x = 0; //read item

while ((item[x] = rdfile.readLine()) != null) {

temp = item[x].split("\t");

jTable1.setValueAt((1000 + x + 1), x, 0);

for (int j = 1; j < 4; j++) {

jTable1.setValueAt(temp[j - 1], x, j);

x++;

rdfile.close();

} catch (IOException e) {

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

//Purchase Button

try {

BufferedReader rdfile = new BufferedReader(new FileReader("items.txt"));

String[] itemline = new String[100];

String str;

double price, total;

int qty = 0, qty_prv = 0, qty_new = 0;

boolean found = false, edited = false;

int idx = (Integer.parseInt(jTextField1.getText())) - 1001;

for (int x = 0; (str = rdfile.readLine()) != null; x++) {

itemline[x] = str;

32
rdfile.close();

int r = Row.getRow();

for (int i = 0; itemline[i] != null; i++) {

if (idx == i) {

found = true;

String[] temp = itemline[i].split("\t");

qty = Integer.parseInt(jTextField2.getText());

qty_prv = Integer.parseInt(temp[1]);

if ((qty > qty_prv) && (qty_prv != 0)) {

JOptionPane.showMessageDialog(null, "Item Shortage!", "Oops!",


JOptionPane.WARNING_MESSAGE);

if (qty_prv == 0) {

JOptionPane.showMessageDialog(null, "Out of Stock!", "Oops!",


JOptionPane.WARNING_MESSAGE);

if ((qty <= qty_prv) && (qty_prv != 0)) {

qty_new = qty_prv - qty;

itemline[i] = temp[0] + "\t" + qty_new + "\t" + temp[2];

jTable2.setValueAt(qty, r, 0);

jTable2.setValueAt(temp[0], r, 1);

jTable2.setValueAt(Double.parseDouble(temp[2]), r, 2);

price = Double.parseDouble(temp[2]);

total = qty * price;

jTable2.setValueAt(total, r, 3);

r++;

edited = true;

33
if (!found) {

JOptionPane.showMessageDialog(null, jTextField1.getText() + ": Item Not Available!", "Oops!",


JOptionPane.ERROR_MESSAGE);

if (edited) {

PrintWriter wrfile = new PrintWriter(new FileWriter("items.txt"));

for (int i = 0; itemline[i] != null; i++) {

wrfile.println(itemline[i]);

jButton16.setEnabled(true);

wrfile.close();

Row.setRow();

jTextField1.setText("");

jTextField2.setText("");

} catch (IOException e) {

} catch (NumberFormatException e) {

JOptionPane.showMessageDialog(null, "Some input may be invalid!", "Oops!",


JOptionPane.ERROR_MESSAGE);

jTextField1.setText("");

jTextField2.setText("");

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

jButton18ActionPerformed(evt);

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

//Clear Button(Purchase)

for (int r = 0; r < 100; r++) //initializing row

34
for (int c = 0; c < 4; c++) //initializing column

jTable2.setValueAt(null, r, c);

jButton16.setEnabled(true);

jTextField10.setText("");

jTextField11.setText("");

jTextField12.setText("");

jTextField13.setText("");

Row.setRow(0);

jButton18.setEnabled(true);

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

public void run() {

new Display_Purchase().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JButton jButton1;

private javax.swing.JButton jButton10;

private javax.swing.JButton jButton11;

private javax.swing.JButton jButton12;

private javax.swing.JButton jButton13;

private javax.swing.JButton jButton14;

private javax.swing.JButton jButton15;

private javax.swing.JButton jButton16;

private javax.swing.JButton jButton17;

private javax.swing.JButton jButton18;

private javax.swing.JButton jButton2;

private javax.swing.JButton jButton3;

private javax.swing.JButton jButton4;

35
private javax.swing.JButton jButton5;

private javax.swing.JButton jButton6;

private javax.swing.JButton jButton7;

private javax.swing.JButton jButton8;

private javax.swing.JButton jButton9;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5;

private javax.swing.JLabel jLabel6;

private javax.swing.JLabel jLabel7;

private javax.swing.JPanel jPanel1;

private javax.swing.JPanel jPanel2;

private javax.swing.JPanel jPanel4;

private javax.swing.JPanel jPanel5;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JScrollPane jScrollPane2;

private javax.swing.JTabbedPane jTabbedPane1;

private javax.swing.JTable jTable1;

private javax.swing.JTable jTable2;

private javax.swing.JTextField jTextField1;

private javax.swing.JTextField jTextField10;

private javax.swing.JTextField jTextField11;

private javax.swing.JTextField jTextField12;

private javax.swing.JTextField jTextField13;

private javax.swing.JTextField jTextField14;

private javax.swing.JTextField jTextField2;

private javax.swing.JTextField jTextField3;

private javax.swing.JTextField jTextField4;

private javax.swing.JTextField jTextField5;

private javax.swing.JTextField jTextField6;

private javax.swing.JTextField jTextField7;

36
private javax.swing.JTextField jTextField8;

private javax.swing.JTextField jTextField9;

private javax.swing.JToggleButton jToggleButton1;

// End of variables declaration

6. OUTPUT
Whenever the user opens the inventory application it will seems like the below figure
shown.

[fig-1]
When the user clicks on search button it will open interface like this. In this you should enter
item name and click on search button.

[fig-2]

37
After click on search button, it will display item details what you enter in item field.

[fig-3]

When the click on display button in fig-1. It will open interface like this. In this interface
consists of add/delete button, purchase button and update button. When you click on
add/delete button it will open like this which is shown in right side. If you enter the below
fields after click on add button it will add the item if you click on delete button it delete the
item.

[fig-4]

38
After click on purchase button, it will open the interface like this. If you want to purchase
any item you should enter item id and quantity and click on purchase it will display the item
name and item price. After that it will reduce the quantity in the file that means the data is
changing in the file

[fig-5]

After click on update button, it will open the interface like this. If you want to update any
item you should enter item name and enter updated item details. After click on save changes
button it will change the data automatically in the file.

[fig-6]

39
CONCLUSION
In conclusion, the Java GUI-based inventory management system project has successfully
addressed the need for efficient inventory management within an organization. The project
utilized Java's robust graphical user interface (GUI) capabilities to create an intuitive and
user-friendly interface for managing inventory-related tasks.
The system allows users to perform various inventory management operations such as
adding, updating, and deleting products, tracking stock levelsIt provides a streamlined
workflow that enhances productivity and reduces human error by automating manual tasks.
Throughout the development process, emphasis was placed on ensuring data integrity and
security. Proper validation mechanisms were implemented to prevent data inconsistencies
and unauthorized access. Additionally, the system incorporated database integration to store
and retrieve inventory information efficiently.
The project has successfully achieved its objectives, providing a reliable and efficient
inventory management solution. However, there is still room for further enhancements and
additional features, such as, implementing real-time inventory updates and decision-making.
Overall, the Java GUI-based inventory management system project serves as a solid
foundation for organizations seeking to streamline their inventory management processes,
improve operational efficiency, and optimize inventory control. It demonstrates the power
of Java and GUI technologies in developing practical and user-friendly business
applications.

40

You might also like