My first Java GUI application, learning by experimenting, and discovering the effort behind building software.
It started with a college assignment.
Unlike the usual assignments where we write programs, execute them and note down their outputs, this one was a little different. Our Java lecturer asked us to build an actual application using Java.
There were a few conditions, though.
No AI-generated code. We had to sit down, understand what we were doing and build the application ourselves.
And she made one thing very clear: she didn't want a huge application with fancy designs, countless buttons or an impressive user interface. She just wanted something simple, original and functional, with a Java GUI and the concept of layout managers implemented.
Honestly, I thought it would be fairly simple.
I was about to find out otherwise.
Starting from scratch
We had already been introduced to Java basics in class, but building an application was something I hadn't really explored before.
So, I started by setting up Java on my PC. Once I had everything installed, I began researching Java GUI development and exploring Java Swing.
I did take some help from ChatGPT during my research, mainly to understand individual concepts and clear my doubts. But I wasn't asking it to generate the application for me. I wanted to understand the components and experiment with them myself.
My first goal was pretty basic: create a window.
I started with a JFrame, then moved on to creating panels, adding labels and text fields, and eventually experimenting with buttons.
Seeing an actual window appear on my screen was exciting. It was a small thing, but it felt different from writing a program in a console and looking at its output.
For the first time, I was actually putting together something that looked like an application.
From a Student Login Portal to a Lost & Found Portal
Initially, I thought of building a Student Login Portal.
I wasn't entirely sure whether that idea would be enough for the assignment, so I started thinking about something else I could build without making it unnecessarily complicated.
That's when I came up with the Campus Lost & Found Portal.
The idea was simple.
Students could report belongings they had lost or items they had found somewhere on campus.
The application would collect a few basic details:
- Student Name
- Item Name
- Report Type (Lost or Found)
- Location
- Description
There would be a Submit Report button and a Clear button.
Nothing too complicated. Just a simple interface that could demonstrate the concepts we were asked to implement.
And that became my first application.
The part that actually took time
This was where things started getting interesting.
Understanding what Java Swing components were was one thing. Figuring out how to use them together was another.
I experimented with different components, including:
-
JFrame– to create the main application window. -
JPanel– to organise different sections of the interface. -
JLabel– to display text. -
JTextField– to collect user input. -
JTextArea– to accept longer descriptions. -
JRadioButton– to select whether an item was lost or found. -
JButton– to perform actions.
I also used ButtonGroup to make sure that users could select either Lost or Found, rather than both.
One thing I particularly remember struggling with was positioning everything.
I had labels, text fields, radio buttons and buttons, but getting them to appear where I wanted them to was a different challenge altogether.
And that's when layout managers came into the picture.
Understanding Layout Managers
Three layout managers were part of my assignment:
1. BorderLayout
I used BorderLayout for the main panel. It divided the application into different sections: North, Center and South.
This allowed me to place the heading at the top, the form in the centre and the buttons at the bottom.
panel.setLayout(new BorderLayout()); panel.add(headingPanel, BorderLayout.NORTH); panel.add(formPanel, BorderLayout.CENTER); panel.add(buttonPanel, BorderLayout.SOUTH); 2. GridLayout
I used GridLayout to arrange the different form sections vertically.
formPanel.setLayout(new GridLayout(0, 1)); formPanel.add(studentPanel); formPanel.add(itemPanel); formPanel.add(typePanel); formPanel.add(locationPanel); formPanel.add(descriptionPanel); 3. FlowLayout
I used FlowLayout inside individual panels to arrange labels and their corresponding input fields.
studentPanel.setLayout(new FlowLayout()); studentPanel.add(student); studentPanel.add(name); Initially, these concepts seemed like just another part of the Java syllabus. But when I actually started using them, I understood why they mattered.
I wasn't just adding components to a window anymore. I was learning how to organise them and structure an interface.
And honestly, getting everything positioned properly took more experimenting than I expected.
Making the application actually work
Once the interface was ready, I moved on to the functionality.
I wanted the Submit Report button to collect the information entered by the user and display it in a confirmation message.
For that, I used ActionListener.
Here's a small part of the code:
submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String studentName = name.getText(); String itemName = itemname.getText(); String itemLocation = place.getText(); String itemDescription = details.getText(); // Validate the submitted details } }); I also added basic validation so that users couldn't submit an incomplete report.
If any required field was empty, the application would display a message asking them to fill in all the details.
For successful submissions, I used JOptionPane.showMessageDialog() to display the entered information.
I added a Clear button too, which resets all the input fields and radio button selections.
There was also a small additional touch: I experimented with changing the background colour temporarily when a report was submitted or when required details were missing.
It wasn't necessary for the basic functionality, but it was fun experimenting with it.
A small application, a much bigger realisation
By this point, I had spent quite some time working on something that, at first glance, looked extremely simple.
And that's when I started thinking about something.
If creating a basic GUI prototype with a handful of input fields and buttons required this much time, patience and experimentation, imagine what it takes to build an actual application.
Think about applications we use every day. The interfaces, the functionality, the databases, the backend systems, the error handling and everything else working together.
There's so much happening behind a screen that we usually don't even think about.
Of course, my application was only a prototype. It didn't have a database or backend to store reports permanently. It simply demonstrated the interface and the submission process.
But even building that prototype gave me a completely different appreciation for software development.
I started understanding that building software isn't just about writing lines of code. It's about figuring things out, making decisions, experimenting, fixing mistakes and getting different pieces to work together.
The little achievement that meant a lot
The next day, I submitted my application.
My lecturer awarded me full marks, which was obviously a nice bonus!
But what made me happier was something else.
I had started with very little experience in Java GUI development, spent time researching concepts, experimented with components and layout managers, and eventually managed to put together an application entirely on my own.
I was genuinely excited when I saw everything working. I was also a little surprised that I had managed to build it without relying on AI-generated code.
And that feeling was probably the best part of the entire assignment.
What I'm taking away from this experience
This assignment might not have resulted in some groundbreaking application. It wasn't particularly complex, and it definitely wasn't something that would impress an experienced developer.
But it was my first application-based assignment since joining CSE, and it made me realise how different learning something in theory is from actually implementing it.
I also learnt that you don't necessarily need to start with a huge idea. Sometimes, building something small is enough to understand the process and gain confidence.
I'm still a beginner, and there's obviously a lot more to learn about Java and software development.
But this experience made me genuinely excited to build more things.
And perhaps that's what matters most.
My first application wasn't perfect, but it was mine. And I'm pretty happy with that. ❤️






