Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JTextField String drop notification



Yeah, but those notifications (insert in particular) get called whenever the user types a character and whenever JTextField.setText() is called. I'm really looking for a way to nail down that a drop happened, or at least that a "bulk insert" happened.

jeff


On Jan 11, 2006, at 1:16 PM, Scott Palmer wrote:


On 11-Jan-06, at 2:09 PM, Jeff Martin wrote:

So both Apple (with 1.4) and Sun (with 1.5) have now added automatic String drop support to all JTextFields. Unfortunately, I can't figure out a way to get notification that a string has been dropped on a text field. There is no support for a ChangeListener,

No, JTextFields are backed by a document. You should be able to get what you want with a DocumentListener.


someTextField.getDocument().addDocumentListener( new DocumentListener() {
public void removeUpdate(DocumentEvent e) { }
public void insertUpdate(DocumentEvent e) { }
public void changedUpdate(DocumentEvent e) { }
} );



Scott

_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >JTextField String drop notification (From: Jeff Martin <email@hidden>)
 >Re: JTextField String drop notification (From: Scott Palmer <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.