This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 18541

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: 4523

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
Similar Threads
Insertion in JTextArea
Cut and Paste, what is the difference with ContentPane and a Panel?
Help about JTextArea in applet!
when should we use static modifier
relayouting after setViewportView for JScrollPane