- Jan 7 - Read:
What is Java all about? and
The "Hello World" Application and
The "Hello World" Applet and
The Nuts and Bolts of the Java Language and
the Applet tag for HTML.
Programming assignment:
The purpose of this assignment is to introduce you to beginning
Java programming concepts and to get you to
learn how to edit, compile, and print Java source
code files,
how to run Java applications, how to run Java applets,
and to learn how to print the output
of your Java applications and applets.
Write a Java application, using the class style, similar to the
HelloWorldApp.java in the tutorial
that will print your name and three lines listing different palindromes.
For the hierarchy for your
application you can put
Object - YourApplicationClassName
Write a Java applet, using the class style, similar to the
HelloWorld.java applet in the tutorial
that will print your name and three lines
listing different palindromes
on one of
your web pages.
For the hierarchy for your applet you can put
Object - Component - Container - Panel - Applet - YerAppletClassName
Hand in:
- Hardcopy of the application and its output
- Hardcopy of the applet and its output
- email me the URL of your applet
- Jan 14 - Read:
The Life Cycle of an Object and
Creating Classes.
Programming assignment:
- (Due Friday Jan. 18)
The purpose of this program is to give you a chance to look at other people's
Java code, and see how they organize their classes and use the API,
and also to give you some ideas
about possible projects you might want to do for the class.
- On the web, find source code for a cool applet. (If you choose an applet
written in Java 1.0, 1.1, or 1.2, you may get a "deprecated method"
warning when you
compile it. Just ignore the warning for this assignment.)
- Format it according to my style specifications
- Modify it in some way.
- Put it on a web page.
- Be sure your class hierarchy includes all the classes defined in the applet
- Be sure you give the original author credit
- on the web page
- in your program header
- On the hardcopy of your applet code:
- highlight the changes (not the style changes) you made in the code (or mark
them in some other way)
- underline all the class names
- circle the instance variable declarations
- put a rectangle around the method definitions
- put a * next to all the class variables and class methods defined or used.
Hand in:
the annotated
hardcopy of your applet code with the URL of the original applet
and the URL of your modified applet.
- (Due Friday Jan. 25)
The purpose of this program is to give you an opportunity to practice loops and branching statements.
Write both an applet and an application that simulates a candy machine.
The candy machine must print out a random number of candy names chosen
randomly from a list of at least 8 candies. Candies must be displayed in
a random order and no candy can be displayed more than once. The prices
of all the candies are the same, however, it is also random. You must also
print
- the price of the candy in cents (e.g., 73 cents)
- how many candies the user could get for $5
- the change the user would get if the number of candies in 2 were purchaced.
Print the change in terms of the number of each type of coin the
machine would return (e.g., 2 dimes and 1 penny). (The machine must return the minimum number of coins.)
(You can tell if you wrote this correctly if, each time you run the program,
a different number of candies
is listed, the order of the candies is different, the price is different,
the number of candies that can be purchased for $5 makes sense, the
change is correct, and the change uses the minimum number of coins.)
Hand in:
Hardcopy of both the applet and the application.
Hardcopy of 3 runs of your application.
- Jan 21 - Martin Luther King, Jr. Day No class
- Jan 28 - Read:
Object Oriented Concepts and
Classes and Inheritance and
Using Graphics Primitives
and
the Graphics class
Programming assignment:(Due Fri. Feb. 8)
The purpose of this program is to give you an opportunity to practice
using inheritance, polymorphism, abstraction, and encapsulation; and
graphics.
- Write a Java robot program using
Robocode.
(There will be 100 extra credit points for this assignment - they will be
divided among the top 10 robots based on how well they perform in battle.)
- Write an applet that draws a side view of your robot. It must fit in
a bounding box 300 by 300 pixels. Your robot must stand on the bottom
of the bounding box. It must be facing to your right.
Hand in on Fri. Feb. 8:
- Hardcopy of your applet.
- Hardcopy of your Robocode robot source code.
- email me your Robocode robot source code. (Don't make it an attachment;
put it in the body of your email. One way to do this is to type
mail bartlett@eecs.umich.edu < YerRobot.java
at the unix prompt.)
- Feb 4 - Read:
Handling Errors Using Exceptions
Example applet Exception
More Examples
Programming assignment:
work on your Robot code
Hand in on Friday:
- Feb 11 - Read:
Applets and
Life Cycle of an Applet and
Methods for Milestones and
Applet security and
the Applet class ,
the Applet tag for HTML
and
Comparing Swing and AWT applets
Applet life cycle from the browser's point of view
Assignment:
The purpose of the first part of this assignment is to help you get a feel
for how applets run in
a browser and to help you understand the purpose for each of the
applet methods. Do the first part by yourself - no partner.
The purpose of the second part is to have you develop the
first draft of your project design. If you are going to have a partner,
you must do it together. (Hand in one copy with both names on it.)
The form handed out in class contains
a list of different things you can do to an applet while it is running, e.g.,
move to a different page, scroll the page, etc. On the form mark which methods
are called for each thing you do. You must make up the last 5 yourself.
The ones you make up must be different from the ones I put on the form. Use the
ExtendedSimple
applet to find out which methods are called. (You can find the version of the
browser in the Help menu.)
Decide on a project to work on for the rest of the class. You will write
both an AWT applet and a Swing application. It can do
anything you want, but it must
- use the following classes/interfaces: Color, Font, Image or ImageIcon,
AudioClip
- have a Graphical User Interface (GUI) and handle events
- have animation
- have help for the user as part of the program
- be implemented using the Model-View-Controller paradigm.
If you want to work in a group on the project, you may choose 1 partner.
Prepare a program header for your
project and a rough drawing of the graphical
user interface (GUI).
Hand in:
The form describing the
things you tried while running the ExtendedSimple applet and
which methods were called for each.(do this yourself)
The program header describing your project and the GUI drawing.(do this
with your partner, if you have one)
- Feb 18 -
- Feb 25 - Spring break No class
- Mar 4 - Read:
Creating a GUI with the AWT,
Creating a GUI with JFC/Swing ,
Sun Swing Shortcourse,
Swing Component Gallery and
Swing applets vs AWT applets
How to use AWT components
How to use Swing components
Programming assignment: Students!
Start your projects!
For this assignment, add at least one of the components you will need.
The components must show up, but they don't have to do anything. They also don't
have to be in the proper place.
Hand in:
Hardcopy of your project. (Applets must run on the web and applications
must be in your Public directory, so I can run them.)
- Mar 11 - Read:
Laying Out Components in Swing ,
Laying Out Components using the AWT, and
a Layout tour
Programming assignment:
Continue working on your GUI.
Use the proper layout managers and containers so your GUI is
formatted the way you want it.
Hand in:
Hardcopy of your project. (Applets must run on the web and applications
must be in your Public directory, so I can run them.)
- Mar 18 - Read:
Writing Event Listeners,
old event handling (so you know what not to do in this class) and
event handling.
(In class slides)
Programming assignment:
Add event handling to your project. Make "help" for your project one of
the events that works properly.
Hand in:
Hardcopy of your project. (Applets must run on the web and applications
must be in your Public directory, so I can run them.)
- Mar 25 - Read:
Using Images,
Playing Sounds,
Animation using AWT,
Animation using Swing
and the associated class descriptions.
Images and animation
Sound in Java 1.3,
How to use the sound API,
Download the sound demo (with source)
Programming assignment:
Add sound, images, colors, and fonts to your project.
Hand in:
- Apr 1 - Read:
Threads of Control and
Threads and Swing and
Before You Ship That Applet
and the associated class descriptions.
Threads
Programming assignment:
Add animation to your project.
Hand in on Friday:NOTHING
- Apr 8 - Project demos - B507 and B521 in the basement of the
North Campus Commons (Pierpont Commons)
Hand in before you leave:
Final hard copy of your code and critiques of at least 3 other project. (Applets must run on the web and applications
must be in your Public directory, so I can run them.)
- Apr 15 -