Automatically update jLabel from values in jTextfield in java

How to have a jLabel update its values automatically from the values in a jTextField.This article will describe how to update the jLabel from the jTextfield values automatically along with example source code.

Assume that you have a jLabel called jLabel3 and a jTextfield called jTextField1

Here is the source code to be used.The keyReleased event of the jTextField will be used.


private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) {

jLabel3.setText(jTextField1.getText());

}



That is all.

If you liked this article please do leave a reply and share it with friends.

Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.