I am trying to create a JFrame having a label and JTextArea. The problem is I want to restrict the size of JTextArea to say 3 rows and 20 columns, even if my JFrame is stretched to various sizes. The setSize method doesnt seem to be working in this case. Can anything be done so that JTextArea's size be restricted whatever the size of frame?
posted 5 years ago
put the JTextArea/JScrollPane into a JPanel (with suitable layoutManager).
give the scrollPane a preferredSize, then add the panel to the frame.
the panel will take up any additional space from resizing