Once you have ensured that ale.jar is in your CLASSPATH, you are ready to start using ALE to create your interfaces.
To use ALE:
The interface contains one method with signature:
public Component mapToComponent(Field f)
throws Exception;
(Component is java.awt.Component, Field is java.lang.reflect.Field)
You should implement that interface exactly like this:
public Component mapToComponent(Field f) throws Exception { return((Component)f.get(this)); }
ALE.brew( "SampleInterface.ale", "main", this, this );
We pass this twice because this is both:
The only items that should appear in the ALE file are sections and the
component, grid, or flow definitions they contain. This file is used
only to define the sizes and locations of your components. The
instantiation of your components and the handling of their events occurs
in your Java code, not in the ALE file.
The creation and structure of the ALE file is included in this help.
It may be a good idea if the ALE file has the same root name as the class
you have defined in your .java file (e.g., public class SampleFile... means your ALE file can be called
SampleFile.ale), though ALE
does not enforce this convention.
You can either:
Compiling normally
If you want to view changes to the interface without recompiling your
application every time you make a change, or if you want to ship your ALE
file as a separate file with your compiled application, simply compile your
application as you normally would leaving the interface definition as a
separate, external file.
If you have set up ALE according to the installation instructions, then
compiling your code is simple:
so that a bytecode file is created. Then run it to view your interface:
How to compile with ALE
javac yourfile.java
java yourfile
Then make sure that the ALE interface file is delivered with your application.
Compiling the ALE file into your application
If you want to include the ALE file in your application bytecode file (presumably so inquisitive or mischievous users won't edit the interface), you can:
..\tools\make_array your_file.ale (PC)or
../tools/make_array your_file.ale (Unix)The array is written to standard output, so be sure to capture the results to a file.