Adding a button
The source code for this GUI is so far completely autogenerated. We haven't touched it at all yet; it's just reflecting the design decisions we've made here. Before we can start writing backend code to do username and password validation, our user is going to need a way to tell us that they've put in a username and password and they'd like it to be validated. This seems like an apt job for the all-powerful button. So let's add a button to our GUI from the Swing Controls menu. We'll change its text to Submit in the Properties option, and the user will need to click on this button to submit their information. Now, when the button is clicked, we'd like it to perform some programming logic. We want to check the username and password ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access