I have code with null panel:
JPanel thePanel = new JPanel();
thePanel.setLayout(null);
I used setBounds(x, y, width, heigth), for example here:
label2.setBounds(150, 220, 459, 311);
I read that this is not a good practice, can you tell me why?
Is it only because when you want to add something between one component and another you have to set them positions again and again or is it something else?
There are multiple problems with absolute positioning:
There's probably more reasons, but using a layout manager makes sure that content is redistributed when windows are resized, or when content of a container changes, ...
Using absolute positioning is probably the easiest way in the beginning, but it pays to get to know the different layout managers and how they operate. It will save you from a lot of headaches due to, for example, changing requirements.