Lab 2 Assignment
In this lab, you will learn enough about Java to give you the
foundation you'll need to create your UI prototypes. You will need to
learn more on your own.
- Here is a Java applet. It has two lists, one
pre-populated with the digits 1 through 8, and two buttons. One takes
a number from the left and moves it to the right, and one takes a
number from the right, and moves it to the left.
You need to
write a program that replicates this functionality. You can start
with this template. Your completed applet needs to match the behavior
of this applet very closely, including (but not limited to) the
following behaviors:
- Does not crash or output Java errors or exceptions.
- If I click on 3 and push the "add" button, and I
immediately press the "remove" button with no other clicks,
the 3 will return to the left.
- Demo your completed applet for your TA.
For help with Java, there are any number of good resources. Here are some
you will very useful:
- On Java's Official Site, you can
get find any number of useful resources, including
the Java SDK
documentation homepage, which has everything you need to know to
create your UI prototype. You'll want to figure out how to read these
pages and learn where to look at the API for the objects.
- There are also a few other Java samples prepared for you to look
at.
ActionExample (source) is a simple
demonstration of create event handlers in Java.
The CircleSquare demo (applet,
source) demonstrates handling clicks,
and drawing on the canvas.
The ProducerConsumer demo (applet,
source) demonstrates multithreading
and a bit more UI stuff.
- Getting Started with Java
- GUI Components - looks like a good place for basic examples of the various
widgets you can use.