Solved

Copy, Cut, Paste, Select All

Posted on 2004-10-03
3
158 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
Comment Utility
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
Comment Utility
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
Comment Utility
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to implement Singleton Design Pattern in Java.

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now