DOC PREVIEW
STEVENS CS 115 - CS 115 Browser Project

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS115 Browser Project Fall 2008 (November 7, 2008)For this homework assignment you will develop a simple browser, in several stages. Plentyof hints and example code will be provided, but unlike the Random Mozart project, wewon’t provide step-by-step instructions for you. You’ll need to think about what classesand methods are needed. Develop them by stepwise refinement and test individual parts—the way to succeed at a big job is to break it into managable pieces and then managethem well. Also, you cannot expect help from TA or instructor unless you can show usat least a partial design.• Version 0 is due Nov 17 – may be done in groups of 1 or 2• Version 1 is due Nov 24 – will probably be assigned as individual work• Version 2 is due Dec 7 – will probably be assigned as individual workEach one counts as 200 homework points. Plan to spend serious time on it, starting now.This is the best way to do well on the remaining tests and quizzes.This document is a preliminary version of the requirements, which are subject tochange pending our discussions in class and on the email list.Your program must conform to these requirements, to facilitate grading. If you wantto add features, or improve on the user interface, you are welcome to do so — but then youmust provide a radio button that lets the user switch between “normal” and “improved”behavior. Normal behavior must conform to the requirements in this document. (See PLlesson page 17-2, footnote on radio buttons.)Requirements for Version 0The browser maintains a current URL. The program can open and display the page foundat that URL, if there is one. It also maintains a favorites list which is a list of URLs. Itis stored in a file and the user can add entries.The user interface consists of two windows:• a page window in which the current page is displayed; its URL is displayed nearthe top of the window.• a control window which contains the following elements:– a current URL text field, in which the user can enter a URL. This field alsogets set by the program, as described in the following items.Near this field there should be a label that says “Current URL:”.– A button labeled “open”. When the user clicks this button, the programattempts to open the current URL and display it in the page window. If therewas already a page on display in the page window, it gets replaced (or a newpage window is created and the old one deleted).The may be an error, either because it is not a well-formed URL or becausethat URL isn’t accessible on the network. In case of error, the page windowshould display an error message.1– The favorites list. This is a non-empty list of URLs, one of which is markedas the current selection.When the user selects an item in the list, the current URL is changed to bethat one.– A button labeled “add to favorites”. When the user clicks this button, theprogram adds the current URL to the favorites list unless it is already there.– A button labeled “Save favorites”. When the user clicks this button, thecurrent list of favorites is written to the file cs115faves.txt in the currentdirectory. (Which replaces its previous contents.)When the program starts, the favorites list should be read from the file cs115faves.txtin the current directory. If that file do es not exist, or is empty, the program should haltand print an error message on the console. Each line of the file becomes one entry in thefavorites list. The file should contain well-formed URLs like http://www.stevens.edu/.When the program starts, the first entry in the favorites list should be used as thecurrent URL.The main class must be called Browser115v0 and have a main me thod. Each classshould be in a separate file and all should be commented and formatted in the style ofthe Gries&Gries textbook.If something is not clear in the requirements, try reading again carefully. If it’s stillnot clear, or see ms wrong, please let me know ASAP.SuggestionsMake two classes, PageWindow and ControlWindow, that extend JFrame. The sampleprograms ListenDemo and ListenDemoWithField show basic use of JFrame, buttons,and text fields.For the page window, use a JLabel to display the URL of the page. The page itselfshould be displayed in a JEditorPane object which takes care of formatting. For useof JEditorPane, see my sample program DemoJEditorPane.java. Don’t expec t this towork perfectly for all web pages. Your program is not responsible for formatting thepage, or formatting errors.For the favorites list, use a JList. See sample program ListListenerDemoDN for useof JLists, including a listener for when the selection is changed.For working with files, see my sample program FileIOdemo.java (also used in lab onNov 10).The requirements do not specify the visual layout for the GUI components. So youare welcome to make it as simple or fancy as you like, as long as it at least does what isdescribed in the requirements.The requirements do not specify details of the error messages. Several kinds of excep-tions will be possible (see my example programs). You are welcome to provide detailedmessages, or just something simple. But the program should not crash just because theuser entered a mal-formed URL like “htptp://whatever”, or because the page or local filedoes not


View Full Document

STEVENS CS 115 - CS 115 Browser Project

Download CS 115 Browser Project
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CS 115 Browser Project and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CS 115 Browser Project 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?