Transcript Lab 2

Lab 2: Picture
Picture Applet
• The goal of this lab is to become more
familiar with using methods on objects
using Java code. In order to do so, you
will create a:
– Picture applet that has and uses several method
calls to draw a picture.
– Your picture should have at least 12 shapes (be
Created by Emily Hill
Picture Applet
• Read Section 2.7 in the Java Software
Solutions by Lewis & Loftus
• Create a new Java project named
“Lab2_netid” (where you replace netid
with your NetID), or edit the Java project found in Canvas (Course
Materials), renaming it.
Created by Emily Hill
Picture Applet
• Create a Picture class as described above (or
modify the Picture class in the Picture project).
– You will put the computer instructions to draw your
picture in the draw method (see the reference cited
above in item 1)
– You will include a screen capture of your picture with
your online submission (see saving and submitting your
work below)
• Update the Square and Circle classes with
constructors that have a parameter for each field.
– Call these constructors at least once from your Picture
Created by Emily Hill
Picture Applet
• Submit an archive and an image of your
Picture project
• FOR EXTRA CREDIT: Upload the class
file (.class) that is compiled in your bin
directory (./bin/) to a webpage (you can
use your msuweb web space that all
students have) and create a webpage
that displays your applet.
Created by Emily Hill
Picture Applet
• Saving and Submitting Your Work
– Always save and backup your work
– Create an archive file (often called a zip
file) directly from Eclipse by going to File
→Export and then selecting General
Archive (be sure that you checked what should be
– Upload as a secondary file a JPG or PNG
picture/image of your Picture class when it
is drawn (to create this file, see next slide)
Created by Emily Hill
Picture Applet
• Catching your Work Picture
• For Windows:
– Select the window that has the drawing in it then press
the ALT and Print Screen buttons at the same time. This
puts a copy of the active window in memory. You can
open Microsoft Paint or any image editor and paste the
image in and save it as a JPG or PNG file in the directory
of your project. Upload that saved file.
• For Mac:
– Press Command Shift –4, followed by the spacebar, and
then select the desired application window. This puts an
image file on your desktop, which you can then upload.
Created by Emily Hill
Picture Applet
• Your submission
– When submitting online be sure all files are
uploaded. These files include: an archive file
[e.g. zip] and an image file [e.g. PNG]. Once
these files are uploaded to the Canvas
assignments submission page, press the
“Submit” button. You may submit as many
times as necessary, but your last submission
is the only one that will be evaluated -so it
must have ALL the necessary file
Created by Emily Hill