wood burning stoves
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with JScrollPane" Watch "Problem with JScrollPane" New topic

Problem with JScrollPane


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

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: 15302

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
I agree. Here's the link: http://aspose.com/file-tools
subject: Problem with JScrollPane
It's not a secret anymore!