Graphics – Part 5

Graphics: Part 5 – OPTIONAL: Computer Science 30S

NOTE: you can find another copy of this example on the GitHub branch here

  • Continue to build on a large example for this course that will help you learn the content and have a reference for you when you complete assessments
  • So start by opening the previous example and adding to it
  • Add a Graphics3.java class to the project by right clicking on ComputerScience30S and selecting New – JFrame Form…

Capturxvzve(40)

Capture1gdsgds4(1)

  • Call it Graphics3.java and use the editor palette and properties window to edit the design to look like this:

Capture(fdhdfh43)

  • Now access the source code by clicking here:

Capture2(dgsg28)

  • Add these properties:

Capturefhdh1(14)

  • Now modify the constructor method:

Capture2(dgsg30)

  • Now add this method…

Capturfsae3(21)

  • Now right click the components to get to the appropriate Events:

Capture4(dsgsg19)

  • And continue to add the actions to the components…

Captudsgre5(10)

  • And continue to add the actions to the components…

Capture6dsgsg(10)

  • Now add these methods…

Capturdge7(7)

  • Now add these methods…

Capturesdvs8(6)

  • Now add this method…

Capture9(4sfaf)

  • Now add these methods…

Capture10(dsgg3)

  • Now add this method…

Capture11gds(1)

  • Now add this method…

Capturedgsgs12(1)

  • Now go back to the ComputerScience30S.java file and add to the learnGraohics() method:

Capture1dsg3(1)

  • Run the application to make sure you have no errors!