Frankie's Applet Forum: JAVA Applets




Source Code Chat

Mastermind.java
Fireworks.java
Neko.java
DeckOfCards.java
TTT.java
Race.java
Smiley.java
CoinToss.java
SlotM.java
Glitzer.java
CarLoan.java
EstimatePi.java
Sim3.java
Pent.java
NumberJump.java
Liner.java

Frankie's Applet Forum Site Map



Fireworks.java
by David O'Brien

This is David O'Brien's classic Fireworks applet. Probably THE BEST fireworks applet available. It was plucked off the CodeBrain site. (see References)

The Fireworks are presented in a "new window" created with JavaScript. (Frankie's Applet Forum is also an HTML and script learning site.)

[JAVA Applets]

Mastermind.java
by Karl Hornell

Mastermind (the peg game) is reproduced as a Java applet. I found it just recently on Karl Hornell's site: J*va on the Brain.(see References)

The game is a little jewel: colorful interface and impeccable logic. Source code is available from the original site.

[JAVA Applets]
Neko.java
by Conrad

Neko is an animation applet donated by Conrad whose only comment was " - the applet uses the Applet and MediaTracker classes and makes use of frame-based animation."

[JAVA Applets]
DeckOfCards.java
by Robert Hovey

The Poker Game was written by a novice programmer from Germany. The game is displayed on a panel and controlled by buttons to shuffle, deal, and buy cards. The player begins with a $100 bankroll.

Robert writes: "The Poker applet was actually an exercise in the Deitel textbook about evaluating strings... I am an absolute novice and teaching myself...The suits are just simple "gif" files I made with Paint Shop Pro."

[JAVA Applets]
TTT.java
by Frankie

TicTacToe was assigned in CIT130 at CCAC. The focus of the exercise is the implementation of the MouseListener interface with method mousePressed.

The exercise did not require the computer opponent to choose the best move. In my version, the computer selects the first available move. Hence, you can always win. The challenge is for you to lose!

The game grid is a simple applet graphic drawn in the paint method. The logic of the game is held in a two dimensional array which keeps track of the moves and checks for a winner.

[JAVA Applets]
Race.java
by Frankie

The Race was written as one phase of a final group project at DU. The group's topic was multi-threading... this I knew from nothing.

Grandiose and important uses of threads aside, they are extremely useful in animation. While a "thread sleeps", the action is slowed down so it can be viewed with the human eye.

The Great Race puts the rabbit and turtle into separate synchronized threads, each responding to random moves according to their nature as noted in the specification.

The GUI consists of simple TextFields to view and call the race and a Button to start.

[JAVA Applets]
Smiley.java
by Frankie

The original Smiley was a simple straight-forward applet utilizing the Graphics object in the applet's paint method;it included methods: setColor, setFont, fillOval, drawArc, and drawString.

The new Smiley applet is not a graphics object at all. It features the Image class to display gif files and a thread to control blinking. Animation.java is a general animation applet that will alter the background color, and display up to 15 images with a time delay of the user's choice, controlled by parameters passed to the applet.

The applet is wrapped with an HTML file that includes JavaScript rollovers of various "ascii" smileys. All the happy face gifs are "homemade".

[JAVA Applets]
CoinToss.java
by Frankie

CoinToss was a simple applet assigned to CCAC class as a lab. Only the logic was required, with the user inter-acting with the applet via the ordinary text querry. I eventually added the GUI and a graphic of a coin being tossed upward to study animation.

I was trying to achieve the illusion of the coin "flipping"...getting thinner as it moved upward and the "landing" with the correct randomly generated face (heads or tails) as dictated by the logic of the code. I was successful, but this simple little program actually lead to a series of problems which are still unsolved. (See SlotM.java.)

There are actually two applets here. The coin strip is an applet graphic.

[JAVA Applets]

SlotM.java
by Frankie

The Slot Machine is obviously a study into animation. Its main predecessor was CoinToss and suffers from the same unsolved problem.

Originally, the graphics were drawn on an inner class canvas and the GUI contained Radio Buttons and TextFields. The compiled inner class filename contained the "$" symbol which AOL Hometown, my first web server, would not accept. When re-written as a sub-class, certain vars were "unknown" to the canvas class. I could not manage the needed parameters...object parameters? ...and settled for a less ambitious GUI with text on the applet. Help needed here. The noisy casino backgroud sound is in the applet, not the HTML.

Inner class file name SOLVED! As of 01/30/02. But it's my secret. The newest addition to the Forum, Pentomino Puzzles, contains an inner class: PentominoSolver$MousePressListener.class. But I haven't revisited the parameters problems.

[JAVA Applets]
CarLoan.java
by Frankie

The car loan appears in Gittleman(4.23)as an application program to practice looping and text formatting. Changing it to an applet makes a more interesting GUI,e.g.the ScrollPane.

Problem:The data entry fields would not accept decimal numbers, no matter what I tried. So I resorted to integer data...which is why I prompt for rounding to the nearest whole...

The HTML file presenting the applet was one of the earliest written for this web site. Subsequent HTML pages show more sophistication as I learn more tags and techniques.

[JAVA Applets]
Glitzer.java
by Eigelb

Frankie's Applet Forum is pleased to present a guest applet: Glitzer, courtesy of www.eigelb.at.

This applet was simply plucked off the internet because I thought it was pretty. I have no idea how it was accomplished since the source code was not available.

[JAVA Applets]
EstimatePi.java
by Frankie

Calculating pi by throwing darts appears in Gittleman(4.27) as an application exercise to practice looping. The visual makes it cool.

It's a bit tricky to translate the points from cartesian coordinates to the applet's coordinates. Also the circle's equation in the text is incorrect:

(x - 0.5)2 + (y - 0.5)2 < 1, should be:

(x - 0.5)2 + (y - 0.5)2 < 0.25

The HTML page is one of the most recent. The gifs and background are made from scratch...getting better, heh?

[JAVA Applets]
Sim3.java
by Frankie

Simpletron was the first "significant" applet that I wrote. It was my first GUI with several actionListeners and a layout manager. The logic of the machine is straightforward, just a bit long and tedious. The GUI underwent several transformations. The original Simpletron was a Swing applet which could not run under most browsers without a "plug-in". The current Sim3 inherits from applet.Applet via AWT. It uses two Panels in a BorderLayout, nine Lables, nine TextFields, two TextAreas, two Buttons, Color, and Sound.

[JAVA Applets]
Pent.java
by Art Gittleman
adapted by Frankie

A complete discussion of Pentominoes appears in Polyominoes by Solomon W. Golomb, Charles Scribner's Sons,1965.(Tetrominoes provide the shapes for the game of Tetris which was very popular several years ago; and everybody knows the game of dominoes!) The code for Pentominoes is Gittleman's TangramSolver.java which is discussed in detail in chapter 10. Only the shapes are changed and the background grids are added. I also included the reflection capability which appeared as a student exercise.

[JAVA Applets]
NumberJump.java
by Eric Harshbargar

The Number Jump is a cute little game downloaded from The Applet Depot. (see References) Parameters provide for customization of the size and number of game tiles, the background gif, the background and foreground colors, and sound. The numbers on the grid are randomly generated so a solution is not guaranteed.

[JAVA Applets]
Liner.java
by Dr. M.L.Noone

Liner is an early effort by, Dr. Mohan Leslie Noone, a self-described amateur programmer from a little town in Kerala, S.India.(see References)

Liner utilizes drawLine and drawArc with clever values and color settings to draw with the mouse.

[JAVA Applets]