A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Swing / AWT / SWT
How to give scrollbars to JTextArea when lines are greater than 3??
Joined: Mar 24, 2008
Jan 29, 2009 04:11:56
I have added one
which is finally inside
Now based on text/lines inside
I want that scrollbars must come only if lines are greater than 3
if lines are less than 3 then it should not show scroll bars
I tried textArea.getLineCount() method but in every case it is returning only 1 as output even if lines are more than 1
In short my problem is that I want to know number of lines a textarea by using which I will set preffered size to
on which I am putting
Joined: Jul 26, 2007
Jan 29, 2009 04:15:42
has a constructor where you can define the row and column count.
What have you set for setLineWrap and setWrapStyleWord? These booleans will affect the getLineCount
How to ask questions
Donate a pint, save a life!
Onff-turn it on!
I agree. Here's the link:
subject: How to give scrollbars to JTextArea when lines are greater than 3??
Tricky JTextArea problem
how to add image to a scrollbar
JTextArea on JScrollPane
Problem in adding Scroll Bar to JPanel.
JScrollPane & JPanel dynamic changes
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015