Inventory Management System Java Project With Source Code

Inventory Management System Java Project With Source Code

The Inventory Management System Java Project was developed using Java Programming Language, in this Inventory Management System In Java is similar to the stock management system where the user can add and update the product details.

This is a simple Java project built in NetBeans IDE with MySQL as a backend database.

An Inventory Management System Project In Java Netbeans is easy to use and anyone can understand the system.

Here, in this Project In the Java system, you can add and update the product details. Also, you can perform a search to get your product details.

This Mini Project In Java also includes a Downloadable Source Code for free, just find the downloadable source code below and click to start downloading.

To start executing an Inventory Management System Java Project make sure that you have the NeatBeans IDE or any platform of Java installed on your computer.

About The Inventory Management System In Java

Project Name:Inventory Management System
Language/s Used:JAVA
Database:MySQL
Type:Desktop Application
Developer:IT SOURCECODE
Updates:0
Inventory Management System In Java– Project Information

How to run the Inventory Management System Project in Java? A step-by-step Guide with Source Code

Time needed: 5 minutes

These are the steps on how to run an Inventory Management System Java Project With Source Code

  • Step 1: Download the source code.

    First, download the source code given below.
    download source code

  • Step 2: Extract file.

    Second, after you finish downloading the source code, extract the zip file.
    inventory zip file

  • Step 3: Open Netbeans.

    Third, open “Netbeans IDE”.
    inventory open netbeans

  • Step 4: Click open project.

    Fourth, click Open Project and choose your download source code.
    inventory open project

  • Step 5: Run the project.

    fifth, right-click the project folder and click run.
    inventory run project

  • Step 6: The project design

    The actual design of the project.
    inventory output

The Code Given Below Is For Displaying All Items in JTable

 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;

                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) {
            }

This module displays all the items in the table.

The Code Given Below Is For Purchased Module

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;
            }
            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;
                    }
                }

            }

            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("");
        }

This module is for the purchased module.

Downloadable Source Code Below.

Anyway, if you want to level up your programming knowledge, especially Java, try this new article I’ve made for you Best Java Projects With Source Code For Beginners Free Download.

Summary

The Java Project With Source Code is built fully in Java and MySQL Database. It has a full-featured Graphical User Interface (GUI) with all the functionalities.

This Article is a way to enhance and develop our skills and logic ideas which is important in practicing the Java programming language which is the most well-known and most usable programming language in many companies.

Inquiries

If you have any questions or suggestions about the Inventory Management System Java Project With Source Code, please feel free to leave a comment below.

7 thoughts on “Inventory Management System Java Project With Source Code”

Leave a Comment