Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Sunday, October 10, 2010

Listen when the text is changed on a JTextField (Java 6 Swing)

I wanted to listen and execute some actions every time the text was changed on a JTextField. I found a very useful post on this link.

http://www.velocityreviews.com/forums/t136479-jtextfield-cant-listen-when-the-text-is-changed.html

Here is the code I'm using, thanks a lot Mark McMillan.

You want to listen for changes on the Document that is associated
with the TextField. If you don't explicitly create a Document the
TextField does it for you. To setup a listener:

// Listen for changes in the text
myTextField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
// text was changed
}
public void removeUpdate(DocumentEvent e) {
// text was deleted
}
public void insertUpdate(DocumentEvent e) {
// text was inserted
}
});

Note this works no matter how the text gets changed; via a
clipboard cut/paste, progamatic "setText()" on the TextField,
or the user typing into the field on the UI.

Thursday, October 04, 2007

Adobe Thermo


I really like this way to create RIA.

Saturday, November 18, 2006

James Gosling's Letter to the Java Community

Dear Java Community,

As you can see, we're making progress with our plans to open source Sun's implementations of the Java platform. I'm happy to see Java technology embarking on a new journey with this official open-source licensing announcement.

Java technology has been a cornerstone of software development for more than a decade now -- the community is ready for the next chapter, and the timing is right. As we stated at the JavaOne conference last May, the most crucial part of this decision was that we realized developers want to preserve compatibility, interoperability, and reliability. We intend to take steps to help make sure Java technology remains compatible, interoperable, and reliable. And we know the Java community feels the same way.

We will continue to do an immense amount of testing with the Java platform. Everything we do will get checked, rechecked, and we will debug rigorously. We expect that people who care about reliability and compatibility with the Java specification will continue to use and enhance Java technology.

One reason Java technology remains so popular is that it's remarkably successful at spanning a lot of different domains. You can write software for application servers, cell phones, scientific programming, desktop applications, games, embedded software -- the list is endless. We're intend to maintain the support of this broad span of domains.

Sun continues to embrace open source, and I invite you to join us. There are all kinds of contributions you can make. If there's a bug that you really care about, you can go work out a fix. (That's one area where developers have made tens of thousands of contributions over the years.) I also invite you to help us add new features. If there's new functionality that you really want in Java technology, the process is there to help you to add that to the platform as well.

Sincerely,

James Gosling