Giter VIP home page Giter VIP logo

lottery-applet's Introduction

Lottery Applet

An animated Java applet to randomly pick 6 lottery numbers between 1 and 49. I wrote the applet itself back in 2001, but I have recently wrapped it in a Maven project.

Lottery applet screenshot

Lottery applet screenshot 2

Building

Uses Apache Maven (http://maven.apache.org/). To compile and build a distro in zip format, use:

mvn clean assembly:assembly 

Running the applet

Having built a distro, you can unpack the subsequent zip file to a local directory. There you will see a new subdirectory called something like "lottery-applet-1.0-SNAPSHOT". Inside this directory you will find a jar file, some GIF files (49 in total - 1 for each lottery ball), and an HTML file. You can run the applet locally using the JDK's appletviewer tool:

appletviewer lottery-applet.html

Alternatively, you could open lottery-applet.html in a java-enabled browser. As with all Java applets, your particular browser and JRE combination may be different from those on which I have tested this method of running the applet, and that difference may cause some form of fail. But hey - that's applets for you. I did write this back in 2001, so YMMV. There's a reason applets died out, right?

You could also drop the 3 files into the same directory of a web server and serve the applet up over HTTP, if you fancy. I've done that on my personal website at http://www.michaelfitzmaurice.com/LotteryApplet2.html

Running the applet in an IDE

Everything the applet needs at runtime is in the same directory when you build and unpack the distro. However, this is not the case when launching the applet inside your IDE. The lottery ball image files are in a different directory from the applet's runtime codebase, so we need a way to tell the applet where to find them. For this reason, I added an applet parameter ("image-path"). You should use a relative path for this parameter; in Eclipse, I configured it thus (note the trailing slash character):

../../src/main/resources/images/

Lottery applet image-path param

I also set the width to 400 pixels and the height to 300. Note that the minimum workable width is 300 pixels (each ball image is 50 pixels and there are six).

lottery-applet's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.