Solved

How to handle cut/copy/paste events on TextField

Posted on 2004-10-13
6
469 Views
Last Modified: 2008-03-04
Hello All,

How to handle cut/copy/paste events on TextField or JTextField??

Regards
Sudhakar
0
Comment
Question by:sudhakar_koundinya
  • 3
  • 2
6 Comments
 
LVL 37

Assisted Solution

by:zzynx
zzynx earned 100 total points
ID: 12297294
add a DocumentListener to the document of the JTextField.
0
 
LVL 37

Accepted Solution

by:
zzynx earned 100 total points
ID: 12297314
yourTextField.getDocument().addDocumentListener( ... );

and your listener has:

- void changedUpdate(DocumentEvent e) : Gives notification that an attribute or set of attributes changed          (=replaced)
- void insertUpdate(DocumentEvent e) : Gives notification that there was an insert into the document                (=paste or simple typing)
- void removeUpdate(DocumentEvent e) : Gives notification that a portion of the document has been removed   (=Cut)



0
 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 12298065
Okay,
I will look into them.

How to work with Textfield??
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 4

Assisted Solution

by:JK2429
JK2429 earned 25 total points
ID: 12298416
0
 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 12298598
Ok I get idea to work with TextField. I need to use TextListener

0
 
LVL 37

Expert Comment

by:zzynx
ID: 12299364
Thanks
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java JRE greater than 1.6 5 62
split string containing \r\n in Java 46 43
Spring Framework HTTPSession management 1 33
java jdbc batch example 8 32
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

776 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