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.

A Inventory Management System Project In Java Netbeans is easy to use and anyone can understand the system. Here, in this Project In Java system, you can add and update the product details. Also, you can perform the 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 a Inventory Management System Java Project, makes sure that you have  NeatBeans IDE or any platform of Java installed in your computer.

Inventory Management System Java Project With Source Code steps on how to run the project

Time needed: 5 minutes.

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

  • Step 1: Download source code.

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

  • Step 2: Extract file.

    Second, after you finished download 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) {
            }

In this module which is displaying all the items to the jtable.

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

In this module which is for the purchased module.

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

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 2021.

Summary

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

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

Inquiries

If you have any questions or suggestions about 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