Part 1 (55 min)
Fall 2017: Handout
- Sign up for the course forum
- (info) If you don't have a laptop and need to use lab machines:
- Set Eclipse Preferences (Menu->Window->Preferences)
- In Eclipse, set up two subversion areas (you may have already done this last week):
right-click in the left-hand panel; select NEW->Repository Location; make sure you have both URLs setup below...
- Fall 2017: https://subversion.ews.illinois.edu/svn/fa17-cs125/_shared (Later you can checkout "Lectures" as a project)
- Fall 2017: https://subversion.ews.illinois.edu/svn/fa17-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.
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. If you don't have a _shared repository, set it up now (see above for the URL)
- Right click on CS125Lab2 and select "Checkout".
Browse the contents of your subversion repositories:
- Open a web browser and browse the 'shared' repository:
What kind of things are in there?
If you find a folder with CS125Lab2, look at the .java files and try to guess what each one will do.
- Again, in your web browser, have a look at the contents of your personal subversion repository:
What kinds of things are in there?
When you 'commit' projects to subversion, the version you committed will show up in here.
Run the Lab 2 java examples:
- In Eclipse, 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", or click the green Run button in the top menu. Run each application separately to see what they do. Look at the code for each. Modify each of them and see if you can make them behave differently and try to understand why they behave how they do. Or, use one as the start of your own idea. Be prepared to demonstrate what you changed for each example to a Doyen for your lab achievement points this week.
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 or google will show you how to import it. (Hint: File->Import->General...) 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);
- 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).