Anyway, now that we have the visuals more or less done, we should work on functionality. First off, we want to get out of the design tab, and move into the code tab, like so:
Once there, we want to scroll to the bottom of the code, to where the variables are declared. Note that stuff with a grey background when not highlighted is automatically generated code that cannot be changed! Everything else so far is automatically generated, too, but you can tinker with it. Let's change that. First, from the first incarnation of our program, we know we need 2 strings to hold different messages, and one more to hold the current message, if you want. I'll be doing this without, just because I can.
TL;DR: Add variables to end of file. You can't touch grey background normally.
Also, I have my own update method, since its easier to type update than jLabel1.setText. Note that you can change variable names on the design panel with the right click menu.
Now that we have this, we'll probably need to change the label to use the variable instead of the "Hello!" string we have. Right click the label in the design tab, hit customize code. Now, this part it grey background, but there's a drop down menu which allows you to customize the code. Replace the string with a variable.
TL;DR: Right click label, hit customize code, look at picture below
Okay, that's sorted. We have one more step, and that's making our button functional! Double click it in design, and Netbeans should take you right to the code. If not, right click and go to Events, then Action. Its in here that you can specify different events, like mouse hover, or key presses.
This gets confusing without a set message, so fuck that! And I'm not going back to fix the screen caps, let this be a test of the attention you're paying! In our variables, add "String message = hi;", and change the custom label code to use "message". So yeah NOW we can pretty much paste the functionality right from the first program.
I'll personally use this method more often, unless I'm pressed to compress. The code. It's just easier to think about, more intuitive. Anyway, here's our end result:
Ta-da! Potential issues include: You can re-size the window, but that'll re-size the button itself. Perhaps an issue with anchoring.
Anyway, that's over with, tomorrow we can get back to following the book, if there's no major questions. Which are totally welcome. Also, any specific (small-time) programs you want me to get working on ahead of time? Practice is good, you know!
Comment, follow, subscribe, share etc, and see you tomorrow!
And as part of a shameless plug for a friend, if you're interested in classic movies/books/music, visit his site here (fixed), and feel free to throw loads of criticism at us.