Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/mwexler/public_html/tp/textpattern/lib/txplib_db.php on line 14
The Net Takeaway: Judoscript and Graphics

OTHER PLACES OF INTEREST

Danny Flamberg's Blog
Danny has been marketing for a while, and his articles and work reflect great understanding of data driven marketing.

Eric Peterson the Demystifier
Eric gets metrics, analytics, interactive, and the real world. His advice is worth taking...

Geeking with Greg
Greg Linden created Amazon's recommendation system, so imagine what can write about...

Ned Batchelder's Blog
Ned just finds and writes interesting things. I don't know how he does it.

R at LoyaltyMatrix
Jim Porzak tells of his real-life use of R for marketing analysis.

 

HOW DID YOU GET HERE?

https:
baidu.com
https:
https:
https:
https:
nettakeaway.com
https:
https:
https:

 

 

 

Judoscript and Graphics · 11/26/2004 01:38 PM,

First off, if you found this page via a web search or bookmark, you may be much happier in the JudoScript Section of this site to see the multiple articles about Judoscript, including this one, but also about Databases, Graphics, Files, etc.

Swing
Basic info at http://www.judoscript.com/articles/gui.html though Listing 2 is completely wrong.

Probably need to update all of this with namespace issues (i.e., use gui::events instead of guiEvents, etc.)

Basic shell resembles this:

 const #JFrame = javaclass javax.swing.JFrame;
 
 frame = javanew #JFrame("Simplest GUI");
 frame.setVisible(true);
 
 guiEvents {
   <frame:Window:windowClosing> :  exit(0);
 }

The Frame-Window thing basically reads as component frame which listens for Window events and handles the windowClosing message.

Buttons get <b1,b3: Action : actionPerformed> : with behaviors following the colon. More at http://www.judoscript.com/examples/ButtonDemo.judo.html

From the Docs: GUI programs typically involve large number of Java classes. Declaring them one by one is tedious, because they are spread across many different packages. JudoScript provides a mechanism called standard Java class declaration shortcut, which are three directives used to easily declare a large number of standard J2SE and J2EE classes:

 !JavaBaseClass  =     #System, #Hashtable, #Dimension
 !JavaGuiClass   =     #JFrame, #JPanel, #Color, #ActionListener
 !JavaEnterpriseClass = #HttpServletRequest, #EJBObject, #EJBContext
 

Look out for the Extra Paren on formatbool()), http://www.judoscript.com/examples/SimpleTableDemo.judo.html

Additional sample code, this from the mailing list:

 !JavaBaseClass #Object, #String, #Integer, #Boolean
 !JavaGuiClass #BorderLayout, #JTable, #JScrollPane,
                       #JPanel,#JFrame, #Dimension
 
 $h = new array();
 $t = new tableData();
 $file = openTextFile("data.txt");
 $fc = new array();
 while (($line=$file.readLine()) != eof )
  {
         $t = new tableData($h = $line.csv() );
         while (($line=$file.readLine()) != eof )
                 {
                  $t.add( $line.csv() );
                 }
 
 }
 $file.close();
 
 $columnNames = $h.toStringArray();
 $data = $t.getData();
 $table = javanew #JTable($data, $columnNames);

And, from a mailing list commentary:
Since you are watching for a click on a button, you should be using Action : actionPerformed. This is standard Java. Second, you should place the code executed by the GUI event inside a function and call the function instead. Using a function in the event handler instead of free-flowing code in the event handler is a technique used by most professional programmers. It allows you to keep your code modular and makes it easier to make modifications later if the need arises. The code is also easier to read.

More sample code:

 !JavaBaseClass #String
 !JavaGuiClass #JFrame, #JPanel, #JButton
 frame = javanew #JFrame("FRAME");
 button = javanew #JButton("Click me!");
 panel = javanew #JPanel;
 panel.add(button);
 frame.setContentPane(panel);
 str = javanew #String("On ButtonClick, this string should be produced 10 times on the prompt.");
 var = 9;
 
 guiEvents {
     < button : Action : actionPerformed> :
     print_String_Ten_Times();
     <frame : Window : windowClosing> : exit;
     }
 
 frame.pack();
 frame.setVisible(true);
 
 function print_String_Ten_Times {
         for i from 0 to var { flush i; . "-> ",str; 
 }

Thinlets
A popular way to create a GUI is through an XML description file and handing that to a display library. The family of these programs is called XUL (based on the Mozilla XML programming specification), but there are a few which are more or less popular. Also, not everyone follows the XUL XML format; some make their own extensions or XML standards… but XUL seems to be winning out.

One version is a quick and easy set of widgets which work well on applets, mobile and underpowered devices, as well as requiring less overhead than Swing or SWT. Thinlets is basically one class, is LGPL, and only 38k. It basically uses the AWT widget set. SwiXml is sort of parallel project to Thinlets, and gives access to the entire Swing library. This latter is a more expandable option, but of course, its also larger and fatter (at runtime, of course; the library is still very small!).

The groups had some discussion on how to use Thinlets with Judoscript; look here

Also, if you are a XUL person, there are lots of others. For example, Ultrid has a BSF interface and so can link to Judoscript. If you are married to the Mozilla XUL, btw, then you want Luxor (No idea if the latter will work with Judoscript, btw.)

http://leepoint.net/notes-java/30GUI/95misc/80gui-generator.html is a nice summary of current options for Guis. Xul Alliance tries to organize all the XUL specific ones.

* * *

 

Name
E-mail
http://
Message
  Textile Help
Please note that your email will be obfuscated via entities, so its ok to put a real one if you feel like it...

Admin
powered by Textpattern 4.0.4 (r1956)