File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes JTextArea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JTextArea" Watch "JTextArea" New topic


Noboru Wataya

Joined: May 27, 2011
Posts: 1
Hi, I am trying to create an application that has several JTextAreas. It also has a JMenuBar with Cut/Copy/Paste options. The problem is I do not know how to tell the paste menu action listener which JTextArea has the cursor so that it knows which JTextArea to paste the clipboard contents into. Can anybody help with this? Thanks in advance.

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

When you say "has the cursor", the Java term for that is "the focus". So you might benefit from reading How to Use the Focus Subsystem and How to Write a Focus Listener.
Darryl Burke

Joined: May 03, 2008
Posts: 5115

Cross posted and answered before this was even posted here:

Noboru, please Be Forthright When Cross Posting To Other Sites.

luck, db
There are no new questions, but there may be new answers.
I agree. Here's the link:
subject: JTextArea
It's not a secret anymore!