aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Real Quick, whats wrong with my JScrollPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Real Quick, whats wrong with my JScrollPane" Watch "Real Quick, whats wrong with my JScrollPane" New topic
Author

Real Quick, whats wrong with my JScrollPane

matt gimbl
Greenhorn

Joined: Feb 15, 2004
Posts: 5
Okay ... In my main GUI file .. I have declared this ...
tab.add(new EditArea("TextAreaName"), "TabName"); // Not showing my TextArea
and
tab.add(new JScrollPane(new TextArea("TextAreaName")), "TabName"); // Does show my text area
where tab is a JTabbedPane, TextArea is a class that extends JEditorPane, and Edit Area is a class that extends JScrollPane.
This is the code for my EditArea():
public class EditArea extends JScrollPane {
public EditArea(String nameOfTextArea) {
add(new TextArea(nameOfTextArea));
}
}
I dont see any logical differences in the code .. but the first tab shows just a big container with nothing in it, but the second tab shows the correct JEditorPane window. What am I doing wrong?
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

JScrollPane is one of the only components that the normal "add()" method doesn't do what you think it should. The method that you have to use instead is "setViewPortView()".


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
 
subject: Real Quick, whats wrong with my JScrollPane