Java
Java
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
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
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
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.
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.
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)
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;
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
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:
- `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.
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 Display_Purchase() {
initComponents();
@SuppressWarnings("unchecked")
11
jTextField5 = new javax.swing.JTextField();
12
jLabel5 = new javax.swing.JLabel();
jButton1.setText("jButton1");
jLabel4.setText("jLabel4");
jToggleButton1.setText("jToggleButton1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Display_Add/Dlete_Update_Purchase");
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.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 [] {
){
};
});
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.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() {
jButton2ActionPerformed(evt);
});
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.setTabPlacement(javax.swing.JTabbedPane.LEFT);
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.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.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.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() {
14
jTextField3ActionPerformed(evt);
});
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() {
jTextField4ActionPerformed(evt);
});
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() {
jTextField5ActionPerformed(evt);
});
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() {
jButton5ActionPerformed(evt);
});
jButton6.setText("Delete");
15
jButton6.addActionListener(new java.awt.event.ActionListener() {
jButton6ActionPerformed(evt);
});
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() {
jButton7ActionPerformed(evt);
});
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() {
jTextField14ActionPerformed(evt);
});
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()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jTextField14)
.addComponent(jButton6)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel2)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel3)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createSequentialGroup()
17
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 56,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel1)
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.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))
.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))
.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))
.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))
);
jTabbedPane1.addTab("Add/Delete", jPanel2);
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)));
jTable2.setModel(new javax.swing.table.DefaultTableModel(
new String [] {
){
};
};
19
}
});
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.addActionListener(new java.awt.event.ActionListener() {
jTextField10ActionPerformed(evt);
});
jTextField11.setEditable(false);
jButton14.setText("Total Price");
20
jButton15.setText("Change");
jTextField12.setEditable(false);
jTextField12.addActionListener(new java.awt.event.ActionListener() {
jTextField12ActionPerformed(evt);
});
jTextField13.setEditable(false);
jButton16.setText("Pay");
jButton16.addActionListener(new java.awt.event.ActionListener() {
jButton16ActionPerformed(evt);
});
jButton17.setText("Clear");
jButton17.addActionListener(new java.awt.event.ActionListener() {
jButton17ActionPerformed(evt);
});
21
jButton3.setFont(new java.awt.Font("Vani", 1, 10)); // NOI18N
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.setText("Qty.");
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.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() {
jTextField2ActionPerformed(evt);
});
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() {
jButton18ActionPerformed(evt);
});
jLabel6.setText("Item(s) Purchased");
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()
.addComponent(jButton16)
.addComponent(jButton17))
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton12))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
23
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jButton14)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jButton3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel4Layout.createSequentialGroup()
.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)
.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)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
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))
.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))
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton16)
.addComponent(jButton17))
);
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() {
jTextField6ActionPerformed(evt);
});
26
jButton9.setText("Change Item Name");
jButton10.setText("Qty.");
jButton11.setText("Price");
jTextField7.addActionListener(new java.awt.event.ActionListener() {
jTextField7ActionPerformed(evt);
});
jTextField8.addActionListener(new java.awt.event.ActionListener() {
jTextField8ActionPerformed(evt);
});
jTextField9.addActionListener(new java.awt.event.ActionListener() {
jTextField9ActionPerformed(evt);
});
jLabel5.setText("Item");
jButton8.setText("Save Changes");
jButton8.addActionListener(new java.awt.event.ActionListener() {
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()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.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()
.addGap(0, 0, Short.MAX_VALUE)))))
.addContainerGap(108, Short.MAX_VALUE))
.addGroup(jPanel5Layout.createSequentialGroup()
28
.addGap(152, 152, 152)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.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))
.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))
.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))
.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))
.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()
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0,
Short.MAX_VALUE)
.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()
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
30
);
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>
// Display Button
try {
jTable1.setValueAt(null, r, c);
String[] temp;
31
int x = 0; //read item
temp = item[x].split("\t");
x++;
rdfile.close();
} catch (IOException e) {
//Purchase Button
try {
String str;
itemline[x] = str;
32
rdfile.close();
int r = Row.getRow();
if (idx == i) {
found = true;
qty = Integer.parseInt(jTextField2.getText());
qty_prv = Integer.parseInt(temp[1]);
if (qty_prv == 0) {
jTable2.setValueAt(qty, r, 0);
jTable2.setValueAt(temp[0], r, 1);
jTable2.setValueAt(Double.parseDouble(temp[2]), r, 2);
price = Double.parseDouble(temp[2]);
jTable2.setValueAt(total, r, 3);
r++;
edited = true;
33
if (!found) {
if (edited) {
wrfile.println(itemline[i]);
jButton16.setEnabled(true);
wrfile.close();
Row.setRow();
jTextField1.setText("");
jTextField2.setText("");
} catch (IOException e) {
} catch (NumberFormatException e) {
jTextField1.setText("");
jTextField2.setText("");
jButton18ActionPerformed(evt);
//Clear Button(Purchase)
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() {
new Display_Purchase().setVisible(true);
});
35
private javax.swing.JButton jButton5;
36
private javax.swing.JTextField jTextField8;
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