Forums Register Login

Custom Swing Text Component?

+Pie Number of slices to send: Send
Hi,
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.
Cheers!
Tom
PI day is 3.14 (march 14th) and is also einstein's birthday. And this is merely a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 644 times.
Similar Threads
Tree and drawing within the same panel
Need to draw spiral within dynamically changing rectangle....
Swing Gurus!!! Plz help me
transparent fillRect possible?
custom paint component
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:58:58.