Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JScrollPane not working  RSS feed

 
Sean Magee
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Code




How come the TextArea just keeps getting bigger instead of a scroll bar appearing? What can I do to fix this?
[ December 08, 2004: Message edited by: Sean Magee ]
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you add a component to a container and then turn around and add the same component to a different container, the component is removed from the first container and added to the second container. You added the JTextArea to a JScrollPane and then added the JTextArea to your JFrame content pane. So you end up with a JTextArea followed by an empty JScrollPane. Try eliminating this statement — c.add(area);.
 
Sean Magee
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, that did it.



Thanks A lot Craig.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!