Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help! Can't get JTextArea in JTree to expand  RSS feed

Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a custom class that extends JTree. It uses it's own custom editor and renderer.
A node (DefaultMutableTreeNode) contains a JPanel. The JPanel contains a class (MyTextArea) that extends JTextArea. It's a multiline text area that wraps after 80 characters and starts with 3 lines visible.
I can't get MyTextArea to add lines while the user is typing. If the amount of text being typed goes past three lines, MyTextArea won't resize to keep all the text visible. If you stop typing and close and open the node then MyTextArea is properly resized.
I need this done on the fly. I've tried triggering repaints/revalidates of the JPanel, MyTextArea, the tree, and nothing seems to work. Does anyone have any ideas?
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!