?
Solved

Copy, Cut, Paste, Select All

Posted on 2004-10-03
3
Medium Priority
?
166 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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 This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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:
Suggested Courses
Course of the Month14 days, 4 hours left to enroll

801 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