Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Real Quick, whats wrong with my JScrollPane

 
matt gimbl
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic