Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamically setting TextArea size

 
Chandhrasekar Saravanan
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am having an AWT window with a TextArea and few buttons. i wanted to view text files in my TextArea box. as i dont know the file size before how can i set the size of the TextArea. is there an way that we can dynamically set the size of TextArea.
Thanks
Regards
Chandhrasekar Saravanan
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't matter... if the TextArea is too small for the amount of text being displayed it has a scrollbar to allow the user to scroll through the text.
 
Chandhrasekar Saravanan
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think i havent mentioned the problem clearly. I do have a scrollbars in my Textarea. the problem is i need to mention an initial size. if my file is too large, even though i have scrollbars, i am not able to display the files when it exceeds the Textarea size. how to overcome this problem
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, sounds like a layout problem. What kind of layout does the component you are adding the text area to have? BorderLayout would make the most sense. Add the text area to the center and it takes up all available space not taken up by other components in the other sections of the layout.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic