Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JTextArea is Problematic

Status
Not open for further replies.

niritbakshi

Programmer
Oct 16, 2000
9
IL
Hello.
I have a very weird problem using JTextArea class.
Whenever i put large amount of text in it,
it is getting hugh and controls on my screen.
in TextArea class, it gets an automatic scrollbar.
How to I make the same thing in JTextArea?
please help me...
 
> TextArea class, it gets an automatic scrollbar.
How to I
> make the same thing in JTextArea?

Place the JTextArea inside a JScrollPane.

-pete
 
Can you give me a working example?
I tried
JScrollPane scroll = new JScrollPane();
scroll.setViewportView(ta);
ta is the JTextArea.
Can you tell me what's wrong?
 
i think theres also a JTextPane which provides better functionality than a JTextArea. It is for some more whizzy word processing stuff but it may be better if your text is really huge have a look at for more details.
Also with you JScrollPane above i've always found this way better
JScrollPane scroll = new JScrollPane(textArea1);
It just seems to work for me I could never get the view port to work but thats probably just me being impatient.

Chris Packham
kriz@i4free.co.nz

A thousand mokeys at a thousand machines, it happened, it got called the internet.
 
Well,
my text may be very hugh, because it is source-code of websites.
Anyway, I searched the API and couldn't find what can I do with this JTextPane.
I'll try later today your tip about JScrollPane.
Wow....
Swing is driving me crazy!!! :)
 
It doesn't work...
I'll just use TextArea instead of JTextArea.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top