Solved

How to handle cut/copy/paste events on TextField

Posted on 2004-10-13
6
467 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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 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 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 how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

708 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

12 Experts available now in Live!

Get 1:1 Help Now