Professional Documents
Culture Documents
Java Gui Final
Java Gui Final
[Document subtitle]
Abstract
[Draw your reader in with an engaging abstract. It is typically a short summary of the document.
When you’re ready to add your content, just click here and start typing.]
Contents
1.0 Assumptions.........................................................................................................................1
1.1 Implementation of the GUI:...................................................................................................1
1.2 User authentication:...............................................................................................................1
1.3 Staff Management:.................................................................................................................1
1.4 Drink Management:...............................................................................................................1
1.5 Order processing:...................................................................................................................1
1.6 Continuous Operation:...........................................................................................................1
1.7 ext File IO:.............................................................................................................................2
1.8 Reports Generation:...............................................................................................................2
1.9 Validation of Input:................................................................................................................2
2.0 Exception Handling:..............................................................................................................2
2.1 Extra Functionality:...............................................................................................................2
2.2 Technical Implementation:....................................................................................................2
2.3 User Manual – screenshots + discussions:.................................................................................3
2.4 Main Screen :.........................................................................................................................3
Explaination :...........................................................................................................................3
2.5 Staff Login :...........................................................................................................................4
Explaination :...........................................................................................................................5
2.6 Staff Panel :............................................................................................................................6
Explaination :...........................................................................................................................6
2.7 Add Staff :..............................................................................................................................7
Explaination :...........................................................................................................................7
2.8 Modify Staff :.........................................................................................................................8
Explaination :...........................................................................................................................8
2.9 Add Drink :............................................................................................................................8
Explaination :...........................................................................................................................9
3.0 Modify Drinks :.....................................................................................................................9
Explaination :...........................................................................................................................9
3.1 View All Drinks :.................................................................................................................10
Explaination:..........................................................................................................................10
3.2 View All Order:....................................................................................................................10
1|Page
Explaination:..........................................................................................................................11
3.3 Generate Report :.................................................................................................................11
Explaination:..........................................................................................................................11
3.4 Customer Panel :..................................................................................................................12
Explaination:..........................................................................................................................12
3.5 Order :..................................................................................................................................13
Explaination:..........................................................................................................................13
3.6 Generate Receipt :................................................................................................................15
Explaination:..........................................................................................................................15
3.7 Flow Chart :.............................................................................................................................16
3.8 OOPs Concepts :......................................................................................................................16
3.9 Abstraction:..........................................................................................................................16
4.0 Modularity:..........................................................................................................................17
4.1 Encapsulation:......................................................................................................................18
4.2 Inheritance:..........................................................................................................................19
4.3 Additional features :.................................................................................................................20
4.4 References :.............................................................................................................................22
2|Page
1.0 Assumptions
3|Page
1.7 ext File IO:
All data will be kept in text files utilizing the proper text file IO procedures
for reading and writing data, including staff accounts, drink specifications, and client orders. As a
result, data persistence and retrievability between sessions will be guaranteed.
4|Page
2.3 User Manual – screenshots + discussions:
Explaination :
Three buttons are important components of the user interface. Each button has a
special function that enables users to efficiently engage with the system:
Staff Login Button: Staff personnel can access the management features of the system by
clicking the "Staff Login" button. The program leads a staff member to the Staff Login
Panel when they click this button. The employee is then prompted to log in by providing
their username and password. The staff member has access to the Staff Panel after
successfully authenticating, where they may carry out a variety of duties like adding and
changing drinks, viewing orders, and creating reports.
5|Page
Customer Button:The Customer Panel can be accessed by clicking the "Customer"
button. Customers who click on this button are taken to the Customer Panel, where they
can order drinks and examine the list of available drinks. Customers can choose the types
of drinks they want to purchase and set the quantities for each drink by using the panel,
which displays the drink selections with their associated pricing. Customers can place
their order and get a receipt after making their selections.
Exit Button: By clicking the "Exit" button, users can close an application and end a
program. The program politely ends and dismisses the application window when users
click this button. The program may save any unfinished work or modifications to the text
files before quitting, preserving data.
The "Drink Ordering System's" entire functionality depends heavily on these buttons. They cater
to the demands of both staff members and clients by providing simple navigation and access to
various application parts. Users can easily switch between panels and complete a number of
tasks while the program is running until they decide to close it. The implementation of proper
input validation also guarantees safe and error-free user interactions with these buttons,
improving the overall user experience.
6|Page
Explaination :
By entering their username and password, employees can log into the system. The application
compares the information in the "staff.txt" text file to the login credentials. The program opens
the Staff Panel, where staff employees can control the drink ordering system, if the submitted
credentials match those for an existing staff member's account.
Text fields for the user's username and password, as well as "Login" and "Back" buttons,
make up the GUI.
Text File IO: To carry out authentication, the application reads the staff members'
usernames and passwords from the "staff.txt" text file.
When a staff member selects the "Login" button, the application verifies that the
credentials they have provided are valid. The Staff Panel (staffscreen) will open if the
credentials match.
Back Button: The "Back" button enables users to leave the Staff Login Panel and return
to the Main Panel (goToMain method).
Overall, the software offers staff members a safe and convenient approach to use the
management features of the system.
7|Page
2.6 Staff Panel :
Explaination :
It is a representation of a drink ordering system's staff panel, where employees can carry out
several management duties. The staff panel has a number of buttons for using various features,
such as viewing all beverages, viewing all orders, adding new staff, updating staff information,
adding new drinks, updating drink data, creating reports, and logging out.
A staff panel with buttons for different administration activities and a "Log Out" button
to return to the Staff Login panel make up the GUI.
8|Page
Functionality Buttons: Each button gives users access to a particular functionality, such
as seeing all orders or drinks, adding new employees, changing staff profiles, adding new
beverages, changing drink specifics, or creating reports.
Linked Panels: When a button is hit, the application links to additional panels (AddItem,
ModifyItem, ViewItem, AddStaff, ModifyStaff, ViewOrder, GenerateReports) that
display the relevant functionality.
The "Log Out" button, when clicked, enables the staff member to travel back to the Staff
Login panel (goToLogin method).
Overall, by giving a variety of features and assuring secure access through the Staff Login panel,
the StaffPannel software gives staff members an interface to efficiently handle the drink ordering
system.
Explaination :
A staff member can add additional users to the staff panel of a drink ordering
system using the "AddStaff" program, a Java GUI application. It requests a login and password
from the staff, logs the data in a text file, and indicates success or failure with appropriate
notifications.
9|Page
2.8 Modify Staff :
Explaination :
The "ModifyStaff" program is a Java GUI application that allows staff members
to modify the password of existing staff members in a drink ordering system. It prompts the user
to enter a username and a new password, then checks if the username exists in the "staff.txt" file.
If found, it modifies the password for that user and updates the file. If the username is not found,
it displays an error message.
10 | P a g e
Explaination :
A Java GUI application called "AddItem" enables staff members to add new
drinks to the drink ordering system. It has fields where the drink's name, price, and quantity can
be entered. The "Add" button causes the software to save the drink details in append mode to a
file called "data.txt" when it is clicked. A success message is shown if the data is successfully
stored. It displays an error message if there is a problem saving the data.
Explaination :
A Java GUI application called "ModifyItem" enables staff members to change
already-existing drink details in the drink ordering system. It offers fields for the drink's name,
the new cost, and the new number of servings. The application reads information from the file
"data.txt" when the "Modify" button is selected in order to determine the specified drink's name.
If the item is located, it modifies the drink information by updating the price and quantity details
for that item and writing the modified data back to the file. If the item cannot be located, a
message stating that it does not exist is displayed. The necessary error messages are presented in
the event that any errors occur while reading from or writing to the file.
11 | P a g e
3.1 View All Drinks :
Explaination:
The program develops a Java Swing GUI program with a frame called
"ViewItem." There is a "Display" button that displays text from a file called "data.txt" in a
JTextArea. Additionally, there is a "Back" button to return to the "StaffPannel" frame.
12 | P a g e
Explaination:
The program's source code is for a Java Swing GUI program called "ViewOrder."
When the "Display" button is pressed, the text from "order.txt" is displayed in a JTextArea. The
user is returned to the "StaffPannel" frame by using the "Back" button.
Explaination:
The code is a Java Swing GUI application called "GenerateReports." It reads data
from a file named "order.txt" and generates a report based on the content. The report shows the
total number of drinks sold, the stock availability of each drink, and the most popular drink. The
generated report is displayed in a JTextArea when the "Generate" button is clicked. There is also
a "Back" button that takes the user back to another frame called "StaffPannel."
13 | P a g e
3.4 Customer Panel :
Explaination:
A graphical user interface (GUI) window for a software application's customer
section is represented by the "CustomerPannel" class. Customers can take advantage of the GUI
to order things and view receipts, among other things. Let's break down this class using its parts
and functions:
Title: The window's large, bold title "Customer Pannel" at the top clearly identifies it as the
customer-specific user interface.
Buttons: The three vertically aligned buttons that make up the majority of the GUI each have a
distinct function are as follows:
Order Button: The customer can place an order by clicking on this button. The
"AddOrder" frame, where the customer can add goods to their order, is revealed when it
is clicked, hiding the "CustomerPannel" window.
14 | P a g e
The button labeled "Generate Receipt" creates a receipt for the user. The customer can
examine their prior orders' receipts by clicking the link, which opens the
"GenerateReceipt" frame and conceals the "CustomerPannel" frame.
Back Button: This button enables users to return to the application's main interface.
When clicked, it reveals the "Main" frame, which most likely contains additional
application sections, and hides the "CustomerPannel" frame.
3.5 Order :
Explaination:
In a software program, the "Order" class depicts a graphical user interface (GUI)
window where clients can order drinks. Customers can view their cart, add drinks to their order,
and place their final order using this feature.
Key characteristics:
15 | P a g e
When the "Display" button is hit, the GUI shows a list of the available drinks that is read
from a file called "data.txt" in a JTextArea.
Add to Cart: Customers can add drinks to their cart by entering the drink's name and the
number of servings in two text fields and clicking the "Add" button.
The additional beverages are kept in a StringBuilder called "cart," and a summary of the
cart is shown in the JTextArea.
Order: The application calculates the order's total cost when the "Order" button is
selected, and it saves the order's details, including the order ID, drinks, and total cost, to a
file called "order.txt."
Navigation: Customers can use the "Back" and "Order" buttons on the GUI to go back to
the main customer panel and submit their final order, respectively.
Retrieve the price of a drink from the "data.txt" file using the utility methods provided by
the class.
16 | P a g e
3.6 Generate Receipt :
Explaination:
It asks for the user's order ID, reads information from the "order.txt" file, and then
creates the associated receipt.
Key characteristics:
Enter Order ID: To create the receipt for a specific order, a user must enter the order ID
in a text field.
The application reads the "order.txt" file and looks for the supplied order ID when the
"Generate Receipt" button is selected. In the event that the order ID is located, the receipt
for that order is generated and shown in a JTextArea.
Receipt Formatting: The application formats the receipt with the heading "Bill" and
changes several labels, such as "Order ID" and "Total Amount," to "Total Bill Amount"
and "Receipt ID," respectively, for better presentation.
17 | P a g e
Error Handling: If the order ID cannot be located or there is a problem reading the
"order.txt" file, the application offers error handling.
Navigation: The "Back" button on the GUI enables users to go back to the primary
customer panel.
3.9 Abstraction:
The technique of hiding an object's implementation specifics and only exposing
its core functionality to the outside world is known as abstraction. Abstraction is demonstrated in
this code by the classes Main and CustomerPannel. They conceal the underlying complexity
while encapsulating the user interface and behavior of its individual components. For instance,
18 | P a g e
the Main class conceals the specifics of how the customer and staff login panels are shown and
controlled.
// Main class demonstrating abstraction
public class Main extends javax.swing.JFrame {
// ...
public Main() {
initComponents();
staffLoginPanel = new StaffLogin();
staffLoginPanel.setVisible(false);
CPannel = new CustomerPannel();
CPannel.setVisible(false);
}
// ...
}
public CustomerPannel() {
initComponents();
AddOrder = new Order();
AddOrder.setVisible(false);
generatereciept = new GenerateReciept();
generatereciept.setVisible(false);
}
// ...
}
4.0 Modularity:
The partitioning of a system into more manageable, separate modules or
components is referred to as modularity. Each module manages a certain function or task.
Modularity is demonstrated in this code by the use of multiple classes like StaffLogin,
CustomerPannel, Order, and GenerateReceipt. Each class stands for a certain capability and can
be independently reused or changed.
19 | P a g e
// StaffLogin class (not provided in the code) - Demonstrating modularity
public class StaffLogin extends javax.swing.JFrame {
// ...
}
4.1 Encapsulation:
Encapsulation is the grouping of information and the operations that use it
into a single entity (a class). Internal information is concealed, and mechanisms allow for
regulated access to the data. The user interface components and logic for the Main and
CustomerPannel classes are separate from one another. For example, the button actions are
contained within their own classes, and method access governs how users can access these
actions.
// Main class encapsulating the user interface elements and logic
public class Main extends javax.swing.JFrame {
// ...
// ...
}
20 | P a g e
private GenerateReciept generatereciept;
// ...
}
4.2 Inheritance:
One class can acquire the traits and behaviors of another class through the
method of inheritance. It encourages the reuse of code and creates a hierarchy between classes.
It's likely that some of the classes (StaffLogin, Order, GenerateReceipt, etc.) might inherit from
parent classes or interfaces not specified here even though the code you provided doesn't
explicitly demonstrate inheritance.
public class AdminStaffLogin extends StaffLogin {
private AdminPannel adminPannel;
public AdminStaffLogin() {
super();
adminPannel = new AdminPannel();
adminPannel.setVisible(false);
}
@Override
protected boolean checkCredentials(String username, String password) {
// Override the checkCredentials method to add admin-specific logic
// For example, we can check if the user is an admin in a separate file
or database.
// This is just a simple example, and in practice, you should use a more
secure approach.
if (username.equals("admin") && password.equals("admin")) {
return true;
}
return super.checkCredentials(username, password);
}
21 | P a g e
4.3 Additional features :
Certainly! Here are some more extra features to improve the program's usability and
functionality:
Implement a feature that logs all staff activity in a separate log file, such as adding or changing
drinks, generating reports, etc. With the help of this record, employee actions can be monitored
for auditing and accountability purposes.
Customer Registration: - Enable users to sign up and create accounts using their contact, name,
and email details. Customers who have registered get access to customised deals, promotions,
or loyalty programs.
Implement a loyalty points program in which customers receive points for each purchase. After
earning a specific amount of points, customers can exchange these for deals or free drinks.
Implement a loyalty points program in which customers receive points for each purchase. After
earning a specific amount of points, customers can exchange these for deals or free drinks.
Create a feature that enables registered consumers to check their previous orders and instantly
reorder their preferred drinks.
Drink Categories and Filters: - Group drinks into categories (such as hot drinks, cold drinks,
alcoholic drinks, and non-alcoholic drinks) and offer filter choices in the GUI to make it easier for
customers and staff to identify particular types of drinks.
Add support for a variety of payment options, including cash, credit/debit cards, mobile wallets,
and online payment portals.
Real-time Stock Management: Implement a system to track and update the amount of each
drink that is currently in stock. When a drink is running low or out of stock, staff members
should be informed.
22 | P a g e
Allowing clients to plan their orders for a specified time and day is very helpful for crowded
cafes and restaurants.
Internationalization (i18n) and Localization (l10n): - Increase application's ability to serve a wider
audience by adding support for numerous languages and currencies.
Data backup and restoration 10. To prevent data loss in the event of system failures, put in place
an automated backup system that regularly stores data. Give users the choice to recover data
from backups if necessary.
Interactive Reporting: - Improve the report creation feature so that reports are displayed in an
interactive and aesthetically pleasing manner, such as with graphs and charts.
Automated Email Notifications: - Send clients automated emails for order confirmations, order
status updates, and exclusive incentives.
Social Media Integration: - Permit customers to post about their purchases or special offers on
social media sites, which promotes user interaction and raises brand awareness.
Mobile App Compatibility: Create a mobile application version of the program to accommodate
clients who favor placing orders on their cellphones.
Although including these extra features can improve the application, it's important to give
usability, security, and code maintainability top priority. To guarantee a seamless and bug-free
user experience, each feature should be carefully tested.
23 | P a g e
4.4 References :
Barnes, David J. Object-Oriented Programming with Java: An Introduction.
Prentice-Hall, 2000. From
https://kar.kent.ac.uk/22059
Eckstein, Robert, Marc Loy, and Dave Wood. Java swing. O'Reilly & Associates,
Inc., 1998.From
https://dl.acm.org/doi/abs/10.5555/291162
Wong, Chun Chuan, and Chai Wen Chuah. "Online Food Ordering
System." Applied Information Technology And Computer Science 2, no. 2
(2021): 199-218.From
https://publisher.uthm.edu.my/periodicals/index.php/aitcs/article/view/
2369
24 | P a g e
Bhargave, Ashutosh, Niranjan Jadhav, Apurva Joshi, Prachi Oke, and S. R. Lahane.
"Digital ordering system for restaurant using Android." International
journal of scientific and research publications 3, no. 4 (2013): 1-7.From
https://citeseerx.ist.psu.edu/document?
repid=rep1&type=pdf&doi=6f53f8488ad22d8d8424d595bd56630a230a96f
a
Gosling, James, David Colin Holmes, and Ken Arnold. "The Java programming
language." (2005).From
https://www.acs.ase.ro/Media/Default/documents/java/ClaudiuVinte/boo
ks/ArnoldGoslingHolmes06.pdf
25 | P a g e
Zukowski, John. "Swing Overview." The Definitive Guide to Java Swing (2005): 1-
15.From
https://link.springer.com/chapter/10.1007/978-1-4302-0033-8_1
26 | P a g e