GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes Dynamically setting TextArea size Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Dynamically setting TextArea size" Watch "Dynamically setting TextArea size" New topic
Author

Dynamically setting TextArea size

Chandhrasekar Saravanan
Ranch Hand

Joined: Jun 16, 2002
Posts: 57
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

Joined: Oct 18, 2000
Posts: 4121

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.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Chandhrasekar Saravanan
Ranch Hand

Joined: Jun 16, 2002
Posts: 57
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

Joined: Oct 18, 2000
Posts: 4121

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamically setting TextArea size