Birth Year Finder in Java Swing using NetBeans IDE | Java GUI Project for Beginners
Oct 6, 2025
In this video, you’ll learn how to create a Birth Year Finder using Java Swing — a simple yet powerful Java GUI project for beginners. ---------------------------Java Projects source Code--------------- https://www.tutussfunny.com/category/java/ ----------------------------------------------------------------------------------- We’ll walk you through step by step on how to design the interface, add input fields, and calculate the birth year using Java Swing components. Whether you’re a student or a beginner exploring Java Swing tutorial projects, this video will help you understand how to build interactive desktop applications in Java. 🧠 What You’ll Learn: How to create a GUI in Java Swing Designing forms and buttons for user interaction
View Video Transcript
0:00
Let's start the project. So first what
0:02
I'm going to do is I'm going to go to go
0:05
to the file new project select Java with
0:10
Java application. Click next. Here I'm
0:13
going to specify the project name. If it
0:16
is check main class you have to uncheck
0:18
it. Here I'm going to give the name here
0:20
as
0:23
uh H
0:30
uh H just create H programming
0:37
something like
0:41
I just give the name H programming. You
0:43
can give whatever name here my project
0:46
is created successfully. Go to the
0:48
source package default package
0:52
new J frame form here how to calculate
0:56
it here is I'm going to give H
0:59
frame also I'm going to name it as H
1:03
successfully created the frame here what
1:05
you going to is here first I'm going to
1:08
drag the label
1:10
this label I'm going to change your Find
1:13
year file
1:18
birth
1:20
year file birth year file.
1:25
Okay. Now let's
1:28
right click properties.
1:31
Increase the font a little bit bigger
1:32
with bold
1:35
kind of
1:38
increase font a little bit bit like
1:39
this. After
1:42
that I'm going to drag one panel
1:48
this panel also select this one
1:50
properties
1:51
border
1:53
bevel border click okay close it now
1:55
here what I'm going to here I want to
2:00
drag one label this label I'm going to
2:02
name it as
2:05
age you have to enter the age over
2:12
properties
2:15
bold 24
2:21
and drag the text field.
2:27
Right click edit text backspace to
2:29
remove the excess instead. Select again
2:31
properties.
2:35
Select the font with along with bold.
2:38
Click okay.
2:40
Now what I'm going to do is if I enter
2:42
the age
2:44
respective year should be displayed. So
2:46
here I'm going to create here as
2:51
you have to display the label. So label
2:54
here this is a label. I'm going to name
2:55
here this label. This label also I'm
2:57
going to
2:59
name as year birth year.
3:06
I want to this one
3:10
properties
3:13
for with bold.
3:17
Take this size little bit like this
3:32
like that
3:36
to Java birth year file Java birth year
3:40
simple program click on it
3:43
okay after that your design is will be
3:45
over now let's Moving to the coding
3:48
part. Select this frame.
3:53
Uh, select this one. Go to the source
3:55
code. Control F to find option.
3:59
UI. UI. UI. Here. Click. Okay. Keep me.
4:09
Select again the frame properties code.
4:12
Generate center. Close it. Now let's run
4:15
the application. Check it.
4:19
It's coming successfully. Okay, stand
4:21
out. Now I'm going to write the code. So
4:25
I want to put one button here.
4:31
This we have to name it as find.
4:36
Okay. Now right click event action
4:41
action perform. Here you have to write a
4:43
code here as simply you have to uh first
4:46
what I'm going to do is I want to equal
4:48
into the uh button uh the text box into
4:53
the respective text. What is the age you
4:55
are entering? I want to store it the
4:58
variable. So I'm going to click here the
5:02
age we have to write it here as uh how
5:04
to write it here. First you have to look
5:06
at the h. So you have to write int age
5:10
equals integer
5:14
dot pass int. You have to write here txt
5:20
dot there's a property. What is a
5:22
texture? What is things?
5:25
Sorry, we haven't change the name. txt
5:29
this one. This one I haven't changed the
5:32
name. txt
5:34
label. txt birth
5:37
something name we have to give sorry LB
5:40
this is a label so LB this is a label
5:43
okay this is text label lb birth
5:47
then only we can identify text box t get
5:50
text
5:52
for the text you entered here it is
5:54
assigned to this variable now what
5:56
you're going I'm going to test out
5:59
if age
6:02
is less than zero age not be less than
6:06
zero.
6:08
Okay.
6:09
Zero or
6:13
use lower operators.
6:15
Okay. There a pipe symbol.
6:17
Uh uh up up of the enter key. Okay. Top
6:23
of the enter key. You can find out the
6:26
uh order on shift key and find the pipe
6:29
symbol
6:30
age
6:32
greater than 150.
6:36
Oh, is this a condition?
6:39
Okay. If the age is
6:41
less than or age is this is one one of
6:46
at least one of the condition is true
6:48
only we will be able to go here and we
6:51
have write here open and close bracket.
6:53
You have right txt date
6:59
dot
7:03
sorry txt
7:07
lbl birth right this one.
7:12
So
7:15
copy this lbl birth
7:19
dot
7:23
set text.
7:28
Please enter the valid right here.
7:37
Enter the valid
7:41
age.
7:43
Okay. If it does, you can't enter the
7:45
age below zero or up uh above 150. Okay.
7:53
Consider. Okay. So, if it is correct, go
7:56
to the else part.
8:00
Write write it down. Int
8:05
current year
8:07
equal.
8:09
We have a Java as a property called here
8:11
dot.
8:13
Now
8:15
this is the we first we have to write
8:18
this function. After that we implement
8:20
the name space for it. Get 12.
8:27
Okay. Don't worry. Click on it. Click on
8:29
this bul symbol. Import the import Java
8:31
time. This is a library where it is
8:34
resided this year. Okay. This is the
8:37
current year that we'll be getting.
8:40
Okay. After that you have to write the
8:43
in birth
8:47
birth birth year
8:50
equal current year
8:54
minus it
8:56
age HB.
9:00
That's it.
9:02
After that it will be display here
9:06
set text
9:09
your
9:11
credit share you were something you were
9:15
born in
9:34
You were born in
9:44
You were born in
9:51
plus your birth year. This birth
9:55
that use a concatenate operator to it.
9:58
That's it. Let's check on it.
10:04
Now my age is 39.
10:08
Find it. You were born in 86.
10:11
Okay. Now my age is 21. You are born in
10:16
24. My age is 23. You are born in 22.
10:21
Okay. Remember. Okay. Now my age is 24.
10:25
I born in 21. My now age is 26. I born
10:29
in 99. Okay. These are we have easily
10:33
find the things very simple. Okay. Uh I
10:37
hope guys you understood the thing uh
10:39
things so far. Well uh thank you for
10:42
watching. If you have any doubt you can
10:44
ask me. If you love my channel please
10:46
subscribe me, like me. Thank you for
10:47
watching.