I see that you are using NetBeans GUI builder. You need to edit
the gaps to the left and top of the two components.

There need to be those strings on all the four sides.

When you click on the shaded area, a window pops up. There you
can edit the type of the gap you have. By default, the gaps to the
left and top are not resizable. So click on the resizable check
button.
I recommend you to start learning Swing without using the GUI Builder.
In my opinion, it is the best way to learn Swing. Later, when you
already know something, you can start using the NetBeans GUI Builder.
Here are two Swing tutorials (The second one was created by yours truly):
Oracle Swing tutorial
ZetCode Swing tutorial