This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Forcing JTextArea to respect its size Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Forcing JTextArea to respect its size" Watch "Forcing JTextArea to respect its size" New topic
Author

Forcing JTextArea to respect its size

Rusty Shackleford
Ranch Hand

Joined: Jan 03, 2006
Posts: 490
If I put a JTextArea in a JPanel with BoxLayout, it will not display in its given size. It will take up all the panel if no other components exist. I tried to put an empty border in the JPanel and it even ignores that.

How do I force it to accept the preferred height and width?
[ July 13, 2006: Message edited by: Rusty Shackleford ]

"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
Nick Meverden
Ranch Hand

Joined: Jul 03, 2006
Posts: 59
Rusty Shackleford
Ranch Hand

Joined: Jan 03, 2006
Posts: 490
Thanks, at first it didn't work, then applied to JScrollPane it did. Except for some reason the height of it.
[ July 13, 2006: Message edited by: Rusty Shackleford ]
 
Don't get me started about those stupid light bulbs.
 
subject: Forcing JTextArea to respect its size
 
Similar Threads
Swing: Unable to bring down the size of JPanel
Set size for JOptionPane?
Problem with scrollbar
loading text area into a panel
Box Layout doubts