Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Swing / AWT / SWT and the fly likes How to add Vertical ScrollBar whenever text is exceded visible TextArea? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to add Vertical ScrollBar whenever text is exceded visible TextArea?" Watch "How to add Vertical ScrollBar whenever text is exceded visible TextArea?" New topic
Author

How to add Vertical ScrollBar whenever text is exceded visible TextArea?

Pradeep Kumar Raju
Greenhorn

Joined: Mar 10, 2013
Posts: 20
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 41601
    
  31
Scrolling? That should be easy enough: look at this Java Tutorials page.
Pradeep Kumar Raju
Greenhorn

Joined: Mar 10, 2013
Posts: 20
I got it but i want only vertical scrollbar & also it should be activated only if text is exceeded visible TextArea.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 41601
    
  31
I thought you could specify which way those scroll panes scroll.
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2763
    
    9

The JScrollPane API has setHorizontalScrollBarPolicy and setVeriticalScrollBarPolicy methods to do just that. The default is both horizontal and vertical "as needed"


K. Tsang JavaRanch SCJP5 SCJD OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2281
    
    8
First of all use "meaningful" variable names. Two character names are not meaningful.

i want only vertical scrollbar & also it should be activated only if text is exceeded visible TextArea.


That is the default behaviour when you add a JTextArea to a scrollpane.

I got it but


Post the code you used.
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: How to add Vertical ScrollBar whenever text is exceded visible TextArea?