Reputation: 3154
I'm using Java 6, and I have a Dialog that uses Group layout with two panels side by side each with their own jTextArea. And each jTextArea is set within a jScrollPane.
The image below shows the two panels side by side. In a certain situation I want to hide the right panel, and have the left panel and its text area fill up the width of the screen.
So I used the setPreferredSize method on both the left panel and text area, and it resizes the Panel fine but it doesn't resize the JTextArea, it only updates the width of the scroll pane, and you see a scroll bar appear.
I saw another post that says to remove the JTextArea from the ScrollPane and resizing should work, but is there a way to keep them associated and still resize the JTextArea?
Upvotes: 0
Views: 177
Reputation: 21
use setPreferredSize method on jscrollpane instead of textfield
Upvotes: 1