Manning's Countdown to 2014
. Use discount code crdotd14 all month for 50% off every deal.
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!
It is sorta covered in the
JavaRanch Style Guide
subject: How to give scrollbars to JTextArea when lines are greater than 3??
JTextArea on JScrollPane
how to add image to a scrollbar
Tricky JTextArea problem
JScrollPane & JPanel dynamic changes
Problem in adding Scroll Bar to JPanel.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013