

Some students report seeing a common error message when running jGRASP on their Mac, particularly when using the DrawingPanel. To tell jGRASP to number the lines of your program, press Ctrl-L or click View, Line Numbers. Line numbers are useful so that you can find the line where a compiler error occurs. To change this and make the files open in larger windows, click the third button on the bottom left of the jGRASP window. JGRASP has as annoying default setting that causes newly opened files to appear in small box windows. The bracket, along with its matching partner, will highlight in gray. To see which bracket matches a particular bracket in your program, hold the Ctrl key and hover your mouse over that bracket. jGRASP has a useful feature that matches pairs of brackets to help you track down these kinds of bugs. Students will have too many, too few, or just have them in the wrong places. As you step through the code, if a variable's value changes, it will turn red on the left. If you're running a program that uses variables, all of the variables' values will be shown on the left as well. The result is the following:Īny output that results from the code as it is being run will appear in the bottom console pane. For example, we'll Step In to the call of drawEgg from our previous example. The most useful of these buttons is Step In, so if you only learn to use one of them, make it that one. Auto Step: When you turn on this button and then press Step Over/In/Out, it will repeatedly perform that action.Resume: Tells the program to continue executing until it is finished, or until another breakpoint is encountered.Run to Cursor: Executes lines until reaching the line where your keyboard cursor is sitting.(If you click this while in your main method, it runs the rest of your entire program.)

Step Out: Executes all remaining lines of the method you are currently in, and returns to the place from which it was called.If the current line is a method call, jumps inside that method and pauses at its first line of code. If the current line is a method call, runs that entire method call. From left to right, their behavior is the following: These buttons control the execution of the debugger. Notice that near the top-left corner of jGRASP, there is a new set of buttons. The next line to execute will be highlighted. The program will run until it hits the line of your breakpoint. Once you have set the breakpoint, compile your program (if you haven't already) and then press the ladybug icon to run it in debugging mode. (One good place to set a breakpoint is on the first line inside your main method, so that you can step through the entire program's execution.) To set a breakpoint, move your mouse cursor to the left margin of your file's editor window until the cursor becomes a stop sign, and press the left mouse button. To use it, first you must tell jGRASP where to pause the execution this is called a breakpoint. From there, you can run each line one at a time and see the results. To provide you with support outside the course, you will find a pool of additional notes and exercises that you can try at home.The debugger lets you run your program partially and then stop it.

No matter your level, you will be able to apply the skills obtained from this course in real-life programming exercises. If you already have GUI programming experience using JavaFX, this is an opportunity to refresh your skills by going back to basics. If you are a beginner and this is your first course in Java GUI programming you will benefit from writing a program from a blank sheet to a fully functioning program. By creating this project, you will master the concepts of using labels, text fields, password text field, grid pane, buttons, and a button event in Java programming with the JavaFX framework.

Using jGRASP development environment, you will create a program that accepts as input your name and age, and upon clicking a button, display your name and your age. This project provides a step-by-step approach to instruction to equip you with fundamental concepts in Graphical User Interface (GUI) programming using JavaFX, from the ground up.
