Pinned Update #1

The Darc Library (C++) is now updated as of March, 2012. Click ▷here too browse the entire solution.

Friday, September 23, 2011

Multi Jar

Here is how to implement a java application/applet which works as a standalone version (without a browser) as well as web deployed (using an HTML launcher). This demo opens the main panel in a new window so that multiple launcher buttons can be placed on the same website.

Create Java Application
First of all, you need to create a standard java application. The class (e.g., mypackage.MyApp) must extend JApplet and implement ActionListener. This will be the entry point for the applet version.

Create Launcher Button
Create a JButton in the init() method of JApplet and add MyApp as its action listener.

Create User Interface
Clicking the button will open the user interface (UI). Usually this can be a simple JFrame object (e.g., mypackage.MyGUI). The class provides its own main() method which will be the entry point for the standalone version. Note, that the main() method is irrelevant for the applet version. It is only called if the jar file is clicked without a web launcher.

Create Web Launcher
If started from inside a browser, the jar requires a web launcher. The applet tag will place the launcher button in the HTML document. This will instantiate the main panel of the UI. Note that the applet dimension should match the size of the launcher button as defined in the applet code.

:: CODE BLOCK ::
<applet code="mypackage.MyApp.class"
   archive="dist/MyApp.jar" 
   width="200" height="30" />
Web Launcher

A demonstration project (NetBeans IDE 7.1.1) can be downloaded ▷here. It countains the source code, the HTML launcher and the jar file.

Y-101

This is the result of one of my last student projects, i.e., coming up with a concept of an innovative hockey stick. Of course, my part was the product visualization.

Darc Library

The Darc Library is a slightly modified wrapper of the former Protox project. It now contains Protox as well as a bunch of other modules filled with more or less useful stuff that has accumulated over the years. It currently consists of the following modules.

Darc
Global definitions, typedefs, enumerations and helper functions.

Geometry
Basic geometry types like vectors, matrices, triangles, segments, planes etc.

Math
Strictly mathematical stuff, usually generalized classes for the Geometry module.

Protox
Windows and DirectX stuff.

The whole thing can be explored ▷here, nicely formatted with doxygen.