wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Problem with JScrollPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with JScrollPane" Watch "Problem with JScrollPane" New topic
Author

Problem with JScrollPane

bravo9
Greenhorn

Joined: Sep 18, 2001
Posts: 2
Hi folks,
I am using GridBagLayout as my layout manager. I have added a JTextArea named display and have then added the GridBagLayout to the ContentPane container. Now I would like to add a JScrollpane to the JTextArea and the code I am using for that is :
////////////////////////////////////////
container.add(new JScrollPane(display);
////////////////////////////////////////
but the JScrollPane is not coming up. What am I doing wrong? Please advise??
anu mani
Greenhorn

Joined: Feb 27, 2001
Posts: 6
The addition needs to happen in the reverse way. That is the JTextArea should be added to the JScrollPane.
Hope this helps.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Can you not see the TextArea or are you not seeing the Scroll Bars of the ScrollPane? If the latter is true, by default, they will only appear if needed. You can change that by setting the ScrollBarPolicy to Always On.

------------------
Happy Coding,
Gregg Bolinger


GenRocket - Experts at Building Test Data
 
 
subject: Problem with JScrollPane
 
Similar Threads
How to give scrollbars to JTextArea when lines are greater than 3??
JTextArea doesnot scroll automatically...
Tabbing in a JScrollPane
Using JScrollPane
JScrollPane won't resize to JPanel height as intended