Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to expand JTextArea as main panel is resized  RSS feed

 
Maysam Sorkhabi
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello masters,

I'm wondering if it is possible for a JTextArea that is inside ScrollBars to adjust its size automatically as the main window is resized i.e. as the user expands the main window the JTextArea also expand to fill the extra space. I'm quite new to java gui.

Thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
place the scrollpane in the center position of a BorderLayout

something like this

 
Maysam Sorkhabi
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks...although this only makes the text area expand horizontally but not vertically....any ideas?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works fine for me.

Which panels change if you drag the frame to make it taller?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!