PHW1.5: Hello World GUI App

Now that you’ve run your first Java program, let’s run your first GUI Java program.

Rx: <5 min Av: 5-10 min Sd: 10-15 min DNF: 15+ min

Instructions

  1. Download HelloWorldGUI.zip
  2. Open Eclipse and go to File > Import > General > Existing Projects into Workspace
  3. Select archive file, hit “Browse”, and select the HelloWorldGUI.zip you just downloaded
  4. Double-click the project folder, the src folder, and then the default package. You should now see a class file, HelloWorldGUI.java.
  5. To run the program:
    • Click on the green play button at the top of the screen OR
    • Right-click name.java class and select “Run As > Java Application”
  6. Rename the project so that it is HelloWorldGUI_uLogin by right-clicking on the project and selecting Refactor > Rename
  7. Edit the paintComponent method in the HelloWorldGUI class so that the blue circle forms an even border around the yellow:
  8. Replace “Hello World” with your name and update both circles so your name is centered within them.
  9. Run the program to verify your changes.
  10. Export your program by right-clicking on your project folder, and selecting Export > General > Archive File. Name the file HelloWorldGUI_uLogin.zip.

Demonstration

Once you’ve finished doing the HW a single time, watch me do it:

Standard Practice HW Advice

You’ll learn significantly less from watching me solve the practice HW if you haven’t attempted the HW yourself first.

While it’s an achievement to finish the HW no matter how long it takes, you might experience “diminishing returns” if you work longer than the DNF time. Thus, it might be strategic to stop working at the DNF time and watch my solution.

After watching my solution, I recommend that you repeat the HW if you have not achieved at least Av performance. If so, be sure to:

Feel free to keep trying until you make Rx if that’s of interest to you.