Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom Swing Text Component?  RSS feed

Tom West
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe someone can help me with this problem. I need a text component in Java that resizes itself dynamically. For example, it starts off at initial size (1 char wide and high), surrounded by a black rectangle. As I type, this rectangle will grow horizontally, and can grow vertically up until 5 lines.
Also, this component will be wrapped inside of another class that handles clicking on the object and moving it around a drawing area (a JComponent), in this case. So it's positioning is dynamic as well, based on where the user drags and drops the component.
This is probably confusing and vague, but if you have any insight into a good way to do this, or something in Java to help, please email me.
At this point I've tried extending JTextComponent, but get a null pointer exception that I've had little to no luck tracing.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!