Courier Management System In Java

by | Mar 10, 2023 | Basic Coding, Coding, Java

Introduction of the Project

Looking to streamline your courier operations? Building a Courier Management System in Java can help! This powerful tool can help you track packages, manage deliveries, and optimize your logistics processes.

To get started, you’ll need to create a Java application that can handle user input and interact with a backend database. For example, we have used SQL database for the same. Then You’ll want to design the GUI of your courier system with scalability in mind so that it can handle a large volume of data and users.

Once you have the basic architecture in place, you can start adding features to your system. Some key functionalities to consider include package tracking, delivery scheduling, route optimization, and real-time notifications.



1. To store information regarding the name of the person sending the courier, the location to deliver, and the type & status of the package.

2. To create a user interface that makes this system easy to manage.

3. To implement the tables that contain the courier order information and have the functionality of adding & updating the status of orders.


1. knowledge of Java programming language: You should have a good understanding of Java programming language and its libraries, as you will be using Java to build the system.

2. Understanding of Object-Oriented Programming (OOP): You should have a good grasp of OOP concepts such as encapsulation, inheritance, and polymorphism, as you will be using these concepts to design and implement the system.

3. Familiarity with Database Management Systems: You should have a basic understanding of database management systems, as you will be using a database to store and manage the data related to your courier management system.

4. Development Environment: You should have a development environment installed on your computer, such as Eclipse or IntelliJ idea, to develop and test the system.

5. User interface: You need to design a user-friendly interface that allows users to input, view, and manage courier-related data. We have used the Swing module for GUI.

Source Code

public class Main {
public static void main(String[] args) {
new Courier();
import com.toedter.calendar.JDateChooser;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.sql.*;
import java.text.DateFormat;
import java.util.Vector;
public class Courier {
private JTextField nameData;
private JTextField addressData;
private JTable table1;
private JButton ADDRECORDButton;
private JButton UPDATERECORDButton;
private JPanel clinicPanel;
private JComboBox status;
private JPanel datePanel;
private JLabel total;
private JComboBox type;
private JTextField cost;
private JComboBox litres;
JFrame clinicF = new JFrame();
JDateChooser dateChooser = new JDateChooser();
public Courier(){
ADDRECORDButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(nameData.getText().equals("")|| addressData.getText().equals("")|| status.getSelectedItem()==null){
JOptionPane.showMessageDialog(null,"Please Fill All Fields to add Record.");
try {
String sql = "insert into courier"+"(SENDER_NAME,SHIPPING_ADDRESS,ESTIMATED_DELIVERY,TYPE,COST,STATUS)"+"values (?,?,?,?,?,?)";
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/intern","root","root");
PreparedStatement statement = connection.prepareStatement(sql);
String date= DateFormat.getDateInstance().format(dateChooser.getDate());
statement.setString(2, addressData.getText());
statement.setString(3, date);
JOptionPane.showMessageDialog(null,"DETAILS ADDED SUCCESSFULLY");
}catch (Exception ex){
UPDATERECORDButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String sql = "UPDATE courier " +
"SET STATUS = '"+ status.getSelectedItem()+"'"+
" WHERE SENDER_NAME= '"+nameData.getText()+"' AND SHIPPING_ADDRESS= '"+addressData.getText()+"'";
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/intern","root","root");
PreparedStatement statement = connection.prepareStatement(sql);
JOptionPane.showMessageDialog(null,"Updated successfully");
}catch (Exception e2){
table1.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
DefaultTableModel dm = (DefaultTableModel)table1.getModel();
int selectedRow = table1.getSelectedRow();
public void tableData() {
String a= "Select* from courier";
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/intern","root","root");
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(a);
}catch (Exception ex1){
public static DefaultTableModel buildTableModel(ResultSet rs)
throws SQLException {
ResultSetMetaData metaData = rs.getMetaData();
// names of columns
Vector<String> columnNames = new Vector<String>();
int columnCount = metaData.getColumnCount();
for (int column = 1; column <= columnCount; column++) {
// data of the table
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
while ( {
Vector<Object> vector = new Vector<Object>();
for (int columnIndex = 1; columnIndex <= columnCount; columnIndex++) {
return new DefaultTableModel(data, columnNames);
public int count(){
int total = 0;
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/intern","root","root");
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("Select COST from courier");
while ({
total= total+rs.getInt(1);
}catch (Exception e){
return total;

Explanation of the Code

To better understand the implementation of the source code, we have divided it into 2 parts. One involves developing the GUI, and the other is the retrieval of user information from the SQL database for performing the courier services.

Let us look at the GUI first:

1. Our main screen consists of 2 buttons for adding & updating the database.

2. The user interface consists of 4 text fields & 2 Combo Boxes that require information about the customer sending a courier.

3. We have also used a Jlabel “Total Amount” and beside it, there is a Jlabel with the total sum of costs in the database entries.

4. We have also included a Jtable that displays the stored information in the database.

Moving to the retrieval, we will have applied the following

1. The first thing we did was to build a connection with the SQL database using the Connection object.

2. Then we Inject the query that stores table data in ResultSet and send the data to Jtable.

3. Next step is adding & updating functionalities so that it gets updated in the database as well as in the interface.

4. Finally, we are adding a function to retrieve the total cost from all entries in the database and then setting the Jlabel “cost” to that result.


Main Interface

Courier Management System In Java


We have successfully built a Java project that helps to manage customer information & help to update the status of couriers. This Java program uses the Swing module for the GUi and is a very efficient & easy way to maintain the data regarding courier orders.

To make your Courier Management System even more effective, you can integrate it with other systems, such as GPS tracking or warehouse management software. This will give you a complete view of your logistics operations, allowing you to make data-driven decisions and optimize your resources.

So if you’re looking to take your courier operations to the next level, consider building a Courier Management System in Java. With the right design and functionality, this tool can help you improve efficiency, reduce costs, and enhance customer satisfaction.


More Java Projects>>>

You May Also Like To Create…

Mini Radar With Arduino

Mini Radar With Arduino

Introduction of the Project Are you fascinated by radar technology and want to build your own...


Submit a Comment

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