Java Application

Java is one of the popular high-level programming languages, created in 1995 by Sun Microsystems. Java can be used to develop mobile apps, web apps, games and much more. Java is more commonly used in our day to day life on popular platforms like LinkedIn, Google, etc.

Being platform independent and with multiplatform support, Java can be used on multiple softwares like NetBeans, Eclipse, Xcode 6, etc. We often use Java to create real-time applications like Hospital Management System, Employee Management System, Data Visualization Software, Products Management System, etc.

Let’s see the Product Management System that I have designed which helps companies to manage their products. We will need different interfaces to create a whole application like Welcome Page, Login Page, Create Account Page, Home Page, Insert Page, Main Page and many more.

Database

All the information about the products and users are saved in the database in their respective tables. These databases are further accessible by the interfaces to maintain, insert, update, search or delete a record.

Product Table

Account Table

We can perform different operations on these tables. For these we need to design different interfaces by choosing swing controls, swing containers, etc from the palette. After designing your pages we move forward to the coding part to allow the interfaces to carry out their particular tasks.

The home page displays the menu for the available pages on my application. One can also use the shortcut keys to move to a particular page.

Using the insert page we can insert the information of new products. We just need to fill the information in the text field.

The search page is used to search for a particular product in the database. We can search a particular product using product id, price or quantity. We can also use more than one search option at a time.

The Main Page is used for various operations including showing all records, removing a record, updating a record, clearing the text field and returning to the Home Page.

By clicking on Show Records, all the records in the product table in the database will be displayed.

We can remove a record from the database by simply clicking on the specific record you wish to delete from the database and then by clicking on the remove button. When you click on any of the displayed records the information gets automatically filled in the text field. Here the record of product Brush is being deleted.

For updating a record simply click on the specific record, the information will be automatically filled in the text field. One just needs to make the required changes in the text field and click the update button. Here the information of product Stapler has been updated.

The clear button helps to clear the text field and the home button directs us back to the home page.

Welcome Page

Welcome Screen provides you the option to either Login or Sign in if you are a new user. Here is the main logic behind the code:

Code:

  private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
     setVisible(false);
     new Login().setVisible(true);
  }                                        

  private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
     setVisible(false);
     new CreateAccount().setVisible(true);
  }   
 
  
  Output:
                  

Login Page

The login page gives you access to the application if you enter the correct username and password or else it gives you the message stating the error. Here is the main logic behind the code:

Code:

  private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
     String user = textField2.getText();
     String password = jPasswordField1.getText();
     if(user.trim().equals("admin")&&(password.trim().equals("12345"))) {
        JOptionPane.showMessageDialog(null,"Valid User");
        setVisible(false);
        new Home().setVisible(true);
     }
     else if(user.trim().equals("user")&&(password.trim().equals("12345"))) {
        JOptionPane.showMessageDialog(null,"Valid User");
        setVisible(false);
        new Home().setVisible(true);
     }
     else {
        JOptionPane.showMessageDialog(null,"Invalid User");
     }        
  }                                        

  private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
     System.exit(0);
  }  

  
  Output:
                  

 

 

Sign- In Page:

A new user can create an account by filling in details in the sign-in page. In this if the confirm password and password is matched it successfully creates an account or else throws an error. The records will be further stored in the database we created. Here is the main logic behind the code:

Code:

  private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    try{
       String fname1 = textField1.getText();
       String lname1 = textField5.getText();
       String email1 = textField2.getText();
       String pass1 = textField6.getText();
       String conpass = textField4.getText();
        
       if((conpass.trim().equals(pass1))) {
          JOptionPane.showMessageDialog(null,"Account Created Successfully");
          setVisible(false);
       }
       else {
          JOptionPane.showMessageDialog(null,"Invalid Password");
       }
       pst.setString(1,fname1);
       pst.setString(2,lname1);
       pst.setString(3,email1);
       pst.setString(4,pass1);
       pst.setString(5,conpass);
       int res=pst.executeUpdate();
       if(res>=1) {
          JOptionPane.showMessageDialog(null,"Data Inserted Successfully");
          setVisible(false);
          Home h=new Home();
          h.setVisible(true);
       }
       else {
          JOptionPane.showMessageDialog(null,"Error Occurred");
       }
    }
    catch (Exception e) {
       JOptionPane.showMessageDialog(null,e.getMessage());
    }
  }                                        

  private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
    System.exit(0);
  }  

  
  Output:
                  

 

If you wish to see the whole code for the Product Management System, visit my github repository.

Mansi Bende

Executive Committee Member at IEEE CIS SBC - GHRCE(62361B)

6 Comments

Khushi Sonkusre Reply

Amazing write-up! Keep up the good work.

Mansi Bende Reply

Thank you!

Pragati Wagh Reply

Thank you so much for sharing all this wonderful project!

Mansi Bende Reply

Thank you that was really of sweet you.

Dhanashree Borgaonkar Reply

More information about the project could have been shared, yet it is a good work.

Mansi Bende Reply

Thanks for sharing your feedback, will surely try to improve my work.

Leave a Reply

Your email address will not be published. Required fields are marked *