Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTextArea and its cut/copy/paste Actions

JosAHNov 15 2006 — edited Sep 13 2007
Greetings,

one of my customers wants a text editor implemented in one of my
applications. I couldn't convince him that many many text editors exist
already and that he doesn't need a new one. To no avail (sigh). He doesn't
want a separate process to handle the job so now I'm implementing a
brand new text editor (sigh again). I've decided to give him more than
he wanted for (I'm being payed by the hour for this ;-)

There's loading/saving, there's regular expression search and a whole
lot of other hulla baloo already. I stumbled upon a little inconvenience
though: through its key bindings a JTextArea implements the cut/copy/paste
features.
I want to activate those features/Actions through toolbar buttons too.

Here's my question: I got lost in the documentation. What I've found now
is this:
JTextArea ta= new JTextArea();
Action[] actions= ta.getUI().getEditorKit(ta).getActions();
This can't be true: I don't believe that I have to carouse this array and
look for a nested DefaultEditorToolkit.CopyAction object ... I must be
missing something here. Any ideas anyone?

Thanks in advance for putting me on track w.r.t. that documention again.

kind regards,

Jos
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 11 2007
Added on Nov 15 2006
18 comments
1,446 views