CSE 341, Java Major Assignment
Due Wednesday, December 10, 1:30 pm.
COOL JAVA ASSIGNMENT
Write a cool java applet or stand alone application.
- This is still under constructions - I'm going to be adding some stuff
to this in the next week or so.
- Due 1:30 pm, Wednesday, December 10. (Last day of class).
- A project proposal is due Friday, November 21. Send by email
to hinshaw@cs and anderson@cs.
- Your project must be written in Java. You may use any system you
wish, although the Alphas will be the officially supported platform.
- Your project must take advantages of the special facilities provided
by Java, it may either be a stand alone application, or an applet.
- You should use "good, object-oriented" style in program. This will
be considered when your project is evaluated.
- You may do your projects individually, or in groups of two.
- The code should be primarily your own. If you base your code on
existing code (there are tons of applets out there . . .), make sure you
document this in a README file.
Project Ideas
- A WWW site navigator. This would display the links and allow navigation.
(Last quarter a student implemented this with an interface similar to
windows explorer.)
- Game applets - for example, Chinese Chess or German Bridge or
Asteroids or Connect-Four or Pin Ball.
- A multiplayer game, allowing internet play.
- A really cool project from last quarter was a Logo interpreter applet.
- Another cool application from last quarter was a 3d maze exploration
game.
- An algorithm animation applet - maybe one which brings your favorite
CSE326 data structures to life.
Default Project
If you don't want to think up your own project, here is a default project:
- Write a very minimal WWW browser. Maybe just something that can
parse HTML, display formatted text, and allow the user to follow links.
This doesn't need to be Internet Explorer. Here are a base set of
facilities (given in order of implementation):
- Read text in from a file, breaking lines appropriately.
- Add scroll bars to the window, and reformat the lines is the
window width is changed.
- Parse the input file for HTML tags. The first tag to implment
is <P>.
- Implement some basic font handling - maybe just bold and
italic.
- Allow mouse selection of words (this is just to get ready for
selecting the links on the page).
- Add the <a href=URL> tags.
- Now add selecting and opening URLs - first just absolute addresses.
- Add relative addresses.
This is the basic browser - any number of things could be added -
images, more fonts, colors, lists, tables, sounds, smells, . . .
Here are a few hints, based on my experience of writing a truly minimal
browser. As you can see, it doesn't give the folks at netscape much
to worry about. My code is just under one thousand lines.
- You can view my minimal browser from the java subdirectory of
cse341. Just run the WebViewer class.
- I used the StreamTokenizer class for IO, but it did take some work
to get it running. You need to be careful about what you declare to
be ordinary and special characters.
- If you use scroll bars, start with an example from Java documents.
(I based my on the Java Class Libraries example, but there is also code
in the Java tutorial.)
- Use a simple algorithm for breaking text into lines - and parameterize
by the width so it is easy to handle resizing the window.
- I started by reading text from a file, instead of from a URL. The
most difficult part was getting to the point of displaying scrollable
text.
- Following links requires being able to determine what is being pointed
to (you will need to keep track of coordinates somehow), and then opening
URLs. Many web pages have relative URLs - however the URL class makes it
fairly easy to handle them. (You need to distinguish between relative and
absolute URLs - I just assumed it was absolute, and if it gave an exception,
tried it as relative).
- I implemented a back button (easy with a stack) - this was useful,
just because many pages are dead ends.