Hi Chris,

Indeed the Java code that is generated is similar to the standard C solution. 
The point of the code generator is that the overall pattern for the code for
all the Swing widgets is very similar to each other.  The code generator works
by using the "java::info methods" command running within Jacl to detemine the
methods that each Swing Class uses.  Then it outputs Java code in a standard
format to implement calls to these methods (actually, at present it is a
subset of all the methods).    For each Swing class I provide a Tcl list of
various special features that should be added to the Java code.  Again, based
on the simple lists of variables, methods etc. that are provided Java code is
generated.  Also, the code generator writes the code to create a class that
extends each Swing Class that is used.  These provide additional variables and
methods (as mentioned above) that add Tk specific features. There are several
additional Java Classes that are handwritten.  One processes various arguments
in standard formats.  For example, any method calls that specify colors will
call a static method that parses a string representation of a color and return
a Java Color object.  Others implement various "listener classes" that are
used for bindings. 

There are at least three  advantages of this process.  One, it's much faster
than hand writing all the code for each Swing Class (which since this is more
hobby than job is important for me). Second, improvements to the code (better
error handling etc.) can be made by changing the code generator, thereby
propagating all the changes to the final Java code.  Finally, all the Java
code has a standard format so is hopefully easier to read. I hope this
explanation helps.  I'll post some examples (probably everything) after I get
the release approved.

Chris Avis wrote:
> 
> Bruce,
> 
> could you post a simple Tk Java sample and the java code that you
> generate
> using the Jacl script. I am trying to get a handle on what you are
> describing and an example would be great.
> 
> My initial impression of what a Tk like solution for Java would look
> like
> is similar to the standard C solution except written in Java. I'm not
> quite
> sure I understand why a preprocessor/code generator is required. Could
> you describe what your design criteria were and what the advantages of
> this
> approach are ?
> 
> regards
> Chris
>

----------------------------------------------------------------
The TclJava mailing list is sponsored by WebNet Technologies.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
A list archive is at: http://www.findmail.com/listsaver/tcldallas/

Reply via email to