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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JScrollPane visability

Status
Not open for further replies.

Maulkin

Programmer
Apr 8, 2002
19
AU
I have used this line of code but am unable to set the scrollPane to always visible. Can anyone help?

this.getContentPane().add(new JScrollPane(TA));

where TA is the name of the JTextArea.
 
Read this :

JScrollPane
public JScrollPane(Component view,
int vsbPolicy,
int hsbPolicy)
Creates a JScrollPane that displays the view component in a viewport whose view position can be controlled with a pair of scrollbars. The scrollbar policies specify when the scrollbars are displayed, For example, if vsbPolicy is VERTICAL_SCROLLBAR_AS_NEEDED then the vertical scrollbar only appears if the view doesn't fit vertically. The available policy settings are listed at setVerticalScrollBarPolicy(int) and setHorizontalScrollBarPolicy(int).
Parameters:
view - the component to display in the scrollpanes viewport
vsbPolicy - an integer that specifies the vertical scrollbar policy
hsbPolicy - an integer that specifies the horizontal scrollbar policy
See Also:
setViewportView(java.awt.Component)

In your sample try :
this.getContentPane().add(new JScrollPane(TA,
VERTICAL_SCROLLBAR_ALWAYS,
HORIZONTAL_SCROLLBAR_ALWAYS));



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top