I'm trying to learn java.
Now I want to test the buttons, but I don't understand the part of the layout.
Can't I just write button1.setLocation(50,50);
or someting like that ???

Thanks in advance.

Yes, it's possible to set the exact pixel position and size of every component in your GUI, but that's not a recommended solution.
Java has a choice of layout managers to help you position and size your components so that they still look right even if the system font changes, or you move from Windows to Linux, or the user simply re-sizes the window. Here's where to start: