Solved

Copy, Cut, Paste, Select All

Posted on 2004-10-03
3
162 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
3 Comments
 
LVL 15

Accepted Solution

by:
Javatm earned 125 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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

809 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