?
Solved

Copy, Cut, Paste, Select All

Posted on 2004-10-03
3
Medium Priority
?
167 Views
Last Modified: 2010-03-31
I have a text editor that uses a JTextArea that I've created.  I have a menu bar and a toolbar.  What do I need to call to use the copy/cut/page/select all features?

Obviously I can press CTRL+A to select all the text, but I cannot press my toolbar button and simulate that.

Any help will be appreciated!

Thanks
0
Comment
Question by:jcbergman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Accepted Solution

by:
Javatm earned 500 total points
ID: 12214656
Hi;

Its quite easy you just have to call cut(), copy(), paste(), selectAll(); methods its already built-in in Java.
You may also wanna see my donated codes for an example :

http://java.ittoolbox.com/code/d.asp?d=2922&a=s

Hope that helps . . .
Javatm

0
 
LVL 92

Expert Comment

by:objects
ID: 12215173
Use the text areas getActions() method to get the actions defined for it (such as cut,copy,paste) and add them to your toolbar:

Action[] actions = textarea.getActions();
for (int i=0; i<actions.length; i++)
{
    toolbar.add(actions[i]);
}
0
 
LVL 4

Expert Comment

by:JK2429
ID: 12216606
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question