what I wanted to achieve was a resizeable JTextField of width equal to a frame width. Successfully I did it, but I have some doubts about the another solution which unfortunately doesn't work.
I attached a print screen showing my code in two different versions and results.
I would be grateful for explanation.
Thanks in advance.
JPanel() - Creates a new JPanel with a double buffer and a flow layout.
JPanel(LayoutManager layout) - Create a new buffered JPanel with the specified layout manager
edit: My question is: Why in the first example the goal is achieved and in the second one a JTextField is squeezed in the middle?