Lab 2
Part 1 (55 min)
Fall 2015: Handout
Preflight Checklist
- Sign up for Piazza
- (info) For lab machines:
- Set Eclipse Preferences (Menu->Window->Preferences)
- Set Android SDK : /software/android-sdk-latest-el6-i686 then hit "Apply".
- Set up two subversion areas:
- Fall 2015: https://subversion.ews.illinois.edu/svn/fa15-cs125/_shared (Later you can checkout "Lectures" as a project)
- Fall 2015: https://subversion.ews.illinois.edu/svn/fa15-cs125/YourNetId (YourNetId is your net id!)
Eclipse basic knowledge Checklist
- A perspective is just a set of views. SVN repository, Debug, and Java perspectives are very useful!
- (info) Window->Reset persective are useful if you need to reset the views (e.g. if you've closed them or moved them to a crazy position).
- (info) In the Java view you'll use the package view, the problems view, and the Java editor the most.
- (info) Subversion files live on the server; you can view but you can't edit them.
Part 2:
Challenge 1 - Computer graphics
In Eclipse, check out 'CS125Lab2' from Subversion:
- In the subversion view (Window->Open Perspective->Other->Subversion Exploring), expand the shared repository.
- Right click on CS125Lab2 and select "Checkout".
- Go back to the Java perspective to run the examples.
Play with the examples. Right click in the Package view, or on the file's contents, and select "Run As Java Application". Run each application separately to see what they do. Look at the code for each. Try to modify them and see if you can make them behave differently. Or, use one as the start of your own idea. We will not be using these files any other times in our course, so if you break them, it's OK! Have fun with these and experiment. It's the best and the most fun way to learn!
Note that you can't commit your changes back to the common shared area in subversion. However, if you wish, you can Team-> _disconnnect your project from subversion, then Team->Share it to your own subversion area. After that, you can commit it to send the changes to subversion.
If you can't access subversion:
- If you registered <24 hours then this is normal.
- Otherwise, check if your AD account is locked and/or reset your AD password (link).
For this lab only, you can get the project here CS125Lab2.zip; the assistants will show you how to import it. Future labs will require you to have subversion access.
Challenge 2 (time permitting)
Create a breakpoint in Example5BouncingBall on this line:
velocityY = -Math.abs(0.9 * velocityY);
Hint:
- Open the file. Right click on the left hand margin of the text editor and select "Toggle Breakpoint".
- Choose Debug As->Java Application.
- Choose "Yes" when Eclipse asks if you want to switch to the Debugger perspective.
- Use the 'speed controls' to single-step through the code. You should be able to see the variable values changing as you step through the code.
Today's lab points (10 points)
During the lab, the assistants will walk around and quiz you and help you! For today's section points, you should be able to demonstrate and/or explain:
- How to switch perspectives in Eclipse and reset a perspective.
- How to turn a breakpoint on or off.
- How to run a Java program.
- Which Zen Graphics examples you ran and your thoughts on how the code works.
- How to single-step through the code using a debugger (if you get that far).