Ed's Scroller Applets Contents ======== 1. A brief introduction 2. The Classes 2.1. WebBase.class 2.2. Scroller.class 2.3. NewsScroller.class 2.4. NewsMessage.class 3. Files 4. Usage 1. A brief introduction ======================= This is a "collection" of two text-scrolling applets: one is the typical horizontal scoller, the other a vertical scroller with a couple of unique features. These applets, as well as all the code included, is copyrighted 1999 under the GNU Public License, aka the GPL. You can read the text of the GPL on-line at http://www.gnu.org, as well as at my website http://www.io.com/~crackers. 2. The Classes ============== There are four Java classes used here: 2.1. WebBase.class ================== One of the other interesting features is that both applets actually are derived from another class -- one that handles the basic animation threading and common parameter inputs. This allowed me to concentrate on what the actual animation EFFECTS were going to be, instead of worrying about the animation itself. Originally, this project was an almost straight clone, written in my own way, of the classic demos and tutorials for doing this kind of animation, with the effects and animation in the same class. However, once I realized saw how they could be separated and use the animation as a basis for other, similar applications. Then, because I was abstracting the animation, I also included some more methods to read applet s in a more meaningful manner, making it more practical as an extensible object. As an "artistic" touch, I added capabilities for a border (inset or raised) and an image (.gif or .jpeg) for the background. 2.2. Scroller.class =================== This was left over after separating out the animation part. Basically your typical side-scrolling text, with a couple of nice additions: you can pick your font and style (the size is calculated automatically) and you can have a "drop-shadow" displayed behind the text. Typically, it also allows you to specify a URL and make the applet "clickable." 2.3. NewsScroller.class ======================= On the surface, this applet is quite simple: display various "news" items in a vertical scrolling format. The twist is I decided to use a property I had not seen in other, similar applets: the ability to read a file from the server. I really was astonished that the others (that I was evaluating for a work-related project) didn't do this. I didn't want to have to re-write the HTML every time I needed to freshen the "news" -- just fix the data! Once I had decided to write the applet myself, I started cutting and pasting the animation code from my first horizontal scroller. This is when the idea of abstracting it occured, and the separate classes were born. At first, I tried various linked-list schemes to thread the news items properly. Some even worked, but they ate up a large amount of code. So I ditched elegance and went for brute-force, which seems to work quite well. (I wouldn't press my luck with a huge data file, though.) 2.4. NewsMessage.class ====================== As long as I was putting functionality where it would do the most good, why have all the code for a news item packed up into the NewsScroller? Make the news items "intelligent" enough to know their own position and to draw themselves? The code for this class was originally in the NewsScroller.java file so I could "coordinate" methods between the two classes. I also made each news item "clickable," thus giving the user a large degree of freedom in directing visitors to the website to items of interest. 3. Files ======== This is a list of files that you should have received: README (this file) scroller.jar (compiled and archived classes) news.txt (sample data file) crackers/Scroller/WebBase.java crackers/Scroller/Scroller.java crackers/Scroller/NewsMessage.java crackers/Scroller/NewsScroller.java Please note that I didn't list the javadoc files: they can easily be re-created from the source file. 4. Usage ======== Here is the basic HTML tag for using either applet: where [CLASS] is either Scroller or NewsScroller and the JAR file is in the same directory as the HTML page. I strongly suggest the user have a fairly good knowledge of HTML and using applets, as I do not have the time (or inclination) to answer those types of questions. Being the lazy slob that I am (plus being stuck home with the flu at the time), you can find all the additional documentation for using these applets at my home pages: http://www.io.com/~crackers This also makes the demos work better, as the links are live.