O'Reilly logo

Java Programming for Beginners by Mark Lassoff

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding functionality to our button

To let users click on our button field and perform some coded action, we're going to assign an event handler to our actionPerformed event. If we click on this field, we get an option already. Our GUI designer is suggesting we add a handler, namely jButton1ActionPerformed. That's an awful name for a method that's going to sit in our code; jBbutton1 is pretty nondescript. However, it has been chosen because it is the variable name assigned to jButton when it's created in the actual Java code:

// Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JPasswordField ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required