• Post Reply Bookmark Topic Watch Topic
  • New Topic

JScrollPane & JTextArea in Javabean  RSS feed

 
Anthony Kwok
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am developing a Javabean which extended from JTextArea. I want to limit the size so that a scroll bar can be displayed when the content is overflow. I can easily do that if I extend this bean from JScrollPane and add a JTextArea inside. But I need all the property and method provided from the JTextArea such as the document listener, etc. So how can I create this JTextArea bean with scrolling property?
Thanks
Anthony
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anthony,
I think the only solution you can do is create another class which contains your extended JTextArea along with a scrollPane.

Regards,
Manfred.
 
Anthony Kwok
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Manfred Leonhardt:
[B]Hi Anthony,
I think the only solution you can do is create another class which contains your extended JTextArea along with a scrollPane.

Regards,
Manfred.[/B]

Yes, I can do that just like I extended directly from the JScrollpane. The problem is I need to create a layer to access all the methods from a JTextArea such as getDocument() to this class. I just wondered if there is any better solution.
Anthony
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!