File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes 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 "JScrollPane" Watch "JScrollPane" New topic


Felipe Walker
Ranch Hand

Joined: Sep 23, 2003
Posts: 41
Why won't the JScrollPane work. I know I am missing something but just keep overlooking it.

[ October 02, 2003: Message edited by: Cindy Glass ]
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Moved to the Swing Forum.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

c.add(scroller, BorderLayout.CENTER);
c.add(display_area, BorderLayout.CENTER);

First you add the JScrollPane containing the JTextArea to the window (correct) and then you add the bare JTextArea itself in the same position, effectively removing the JScrollPane from the window (wrong.) Just delete the second line above.

[Jess in Action][AskingGoodQuestions]
Felipe Walker
Ranch Hand

Joined: Sep 23, 2003
Posts: 41
Thanks, It works
I agree. Here's the link:
subject: JScrollPane
It's not a secret anymore!