I am adding a JTextArea
to my JPanel
and setting it to a specific place but for some reason it does not move at all.
I have used both setBounds()
and setLocation()
, but to no avail. Here is what I stopped on:
JTextArea name_field=new JTextArea(1,10);
name_field.setBackground(color);
name_field.setBounds(100,100,600,420);
name_field.setLineWrap(true);
add(name_field);
It keeps creating the text field at the same spot: at the top of the screen in the middle. The only thing I managed to do is change it's width by adding name_field.setLineWrap(true)
which only confused me even further. If this for some reason isn't supposed to work, is there another way of moving and possible resizing my JTextArea
?