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

problems with JScrollPane and scrollbars

Status
Not open for further replies.

frag

Programmer
Dec 7, 2000
321
GB
Hi!

I have a JTextArea in a JScrollPane:

Code:
private JTextArea taStatus = new JTextArea(20, 100);
private JScrollPane scrollPane = new JScrollPane(taStatus);
.
.
.
this.getContentPane().add(scrollPane, new GridBagConstraints(0,8,9,1,1.0,0.0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(0,20,30,0),1,1));
scrollPane.setVisible(true);

If the text gets longer than the defined number of colums and/or rows the scrollpane displays the scrollbars correctly. But I want the scrollbars to be there the whole time, even if they are not needed. Is that possible? How? I can't find anything in the API that sounds like what I am looking for...

Cheers

frag

patrick.metz@epost.de
 
Look at the API harder next time,

new JScrollPane(VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_ALWAYS)

that will always show your scrollbars, there's also properties you can set on the JScrollPane to do this if you use another constructor.
 
Uuups... can't belive that I have not seen that. Not my day... sorry.

patrick.metz@epost.de
 
*nods* it is sometimes difficult to parse through that much information, especially if you don't know where to look in for the class, it needs a search engine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top