From: Timothy J. H. <tim...@ma...> - 2004-02-05 03:28:18
|
Hi David and Ken, On Tuesday, February 3, 2004, at 02:43 PM, Ken Anderson wrote: > At 11:14 AM 2/3/2004 -0800, david wrote: >> Thanks >> It eventually came back to me.. >> I just downloaded and installed the jetty based tutorial. >> I may include this by in the linux distro I am working on. >> If it's okay with you. > > Best to check with Tim. Its OK with me, but I'm putting together a better version soon so you might want to wait. (See below...) When do you want your next linux distro release to be? > >> I am thinking Jscheme and Mozilla/XUL make a pretty good combination. >> Is Anybody doing anything with this ? It think it might be a good combination and no one that I know of is working on it.... > > First i've heard about XUL. I looked into it. Its sort of a JLIB-like approach to GUI building but using XML rather than Scheme expressions. http://xul.sourceforge.net/ There are several versions in Java (basically XML parsers for this particular XML language) For example, http://thinlet.sourceforge.net/calculator.html Gives an example of a calculator applet where the GUI is given in XUL by <panel gap="4" top="4" left="4"> <textfield name="number1" columns="4" /> <label text="+" /> <textfield name="number2" columns="4" /> <button text="=" action="calculate(number1.text, number2.text, result)" /> <textfield name="result" editable="false" /> </panel> The Java source that uses this XUL file is package thinlet.demo; import thinlet.*; public class Calculator extends Thinlet { public Calculator() throws Exception { add(parse("calculator.xml")); } public static void main(String[] args) throws Exception { new FrameLauncher("Calculator", new Calculator(), 320, 240); } } public void calculate(String number1, String number2, Object result) { try { int i1 = Integer.parseInt(number1); int i2 = Integer.parseInt(number2); setString(result, "text", String.valueOf(i1 + i2)); } catch (NumberFormatException nfe) { getToolkit().beep(); } } In JScheme with JLIB we could do this as (define (install applet) (define lib (jlib.Swing.load)) ;; Layout and component properties (define G (let* ((H (java.util.Hashtable.)) (L (lambda(name) (lambda(x) (.put H name x))))) (row (textfield "" 4 (L "number1")) (label "+") (textfield "" 4 (L "number2")) (button "=" (action (lambda(e) (calc H)))) (textfield "" 4 (L "result") (lambda(x) (.setEditable x #f))) (button "beep" (action (lambda(e) (.java.awt.Toolkit.beep (.java.applet.Applet.getToolkit applet))))) ))) ;; event handling (define (calc H) (tryCatch (writeexpr (.get H "result") (+ (readexpr (.get H "number1")) (readexpr (.get H "number2")))) (lambda(e) (.java.awt.Toolkit.beep (.java.applet.Applet.getToolkit applet))))) (.add applet G) ) But with a little macrology and mini-language building, we ought to be able to get something even cleaner.... or... we could write a XUL->S-expression parser and then evaluate the S-expression to get a JLIB widget.... You can try this example at the links below, but I didn't get the beep to work... I'll have to look into it some other time (maybe I need getDefaultTooklit instead of getToolkit??) http://tat.cs.brandeis.edu:8090/spr04/tjhickey/calc.scmapp to run the applet http://tat.cs.brandeis.edu:8090/spr04/tjhickey/calc.scmV to see the "validated applet" http://tat.cs.brandeis.edu:8090/spr04/tjhickey/calc.scm to see the plain code (which is the only thing I actually wrote!) > > k > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Jscheme-user mailing list > Jsc...@li... > https://lists.sourceforge.net/lists/listinfo/jscheme-user |