Your instructor will assign one or more of the following problems. Submit all appropriate files for grading, including code files, screen captures, supplemental files (e.g., image files), and text files.
Take an animated or interactive Processing application of your choice from the first part of this course, encapsulate it in a Java-based JFrame controller and add suitable GUI control widgets to control elements of the application. You must include both default and explicit-value constructors for your encapsulated Processing class. Note the following:
If you choose an application that loaded an image file, we suggest that you replace the image with a simple ellipse or rectangle. We will discuss loading images in Java in a later chapter.
Implement an HSB color chooser such as the one shown here.
You should start by building a simple Processing application that sets its background to the HSB values (you will probably want to read this discussion of HSB color ). You should then encapsulate your Processing application inside of a Java GUI application. Your application should use exceptions to handle illegal values for each of hue, saturation and brightness and print an appropriate error message at the bottom of the screen as necessary. The class that encapsulates the processing sketch should use exceptions to maintain an invariant that the values for hue, saturation and brightness are each between 0 and 255 (inclusive).
Extend the Expanding figure example in the text to include the simple button-based controller shown here.
When pressed, the “Restart” button should start automatically start the default circle growing in the middle of the screen. The “Clear” button should clear the output panel with a white background.
Modify the ParticleController application from lab to add particle velocity, size and count controls. Your user should be able to press the “Stop” button, modify the three simulation parameters and then press “Restart” to restart the simulation with the new parameters. The simulator to the right shows a simulation with 100 particles of diameter 25 pixels traveling at up to 10 pixels per frame. You will need to add controls to Extra Credit: Include exception handling for invalid parameter values such as negative velocities and diameters along with an output text box in which to display information about the error. |
Submit all appropriate files for grading, including code files, screen captures, supplemental files (e.g., image files), and text files. We will grade this exercise according to the following criteria:
If you work in teams for this homework assignment, be sure to submit all team members’ names in the code documentation.