<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.erights.org/mediawiki/skins/common/feed.css?207"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.erights.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Scribble_demo</id>
		<title>Scribble demo - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.erights.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Scribble_demo"/>
		<link rel="alternate" type="text/html" href="http://wiki.erights.org/mediawiki/index.php?title=Scribble_demo&amp;action=history"/>
		<updated>2026-04-20T23:23:52Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.15.5-7</generator>

	<entry>
		<id>http://wiki.erights.org/mediawiki/index.php?title=Scribble_demo&amp;diff=1793&amp;oldid=prev</id>
		<title>Kevin Reid:&amp;#32;some categories</title>
		<link rel="alternate" type="text/html" href="http://wiki.erights.org/mediawiki/index.php?title=Scribble_demo&amp;diff=1793&amp;oldid=prev"/>
				<updated>2009-05-23T15:20:55Z</updated>
		
		<summary type="html">&lt;p&gt;some categories&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This is a simple demo of drawing and event handling in an [[AWT]] window from [[E]].&lt;br /&gt;
&lt;br /&gt;
 #!/usr/bin/env rune&lt;br /&gt;
 &lt;br /&gt;
 [[pragma.syntax]](&amp;quot;0.9&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 # --- init&lt;br /&gt;
 &lt;br /&gt;
 [[Vat#morphInto/1|currentVat.morphInto]](&amp;quot;awt&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 # --- definitions&lt;br /&gt;
 &lt;br /&gt;
 def makeEPainter := &amp;lt;unsafe:com.zooko.tray.makeEPainter&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 /** protection against throwing out of an AWT callback and getting a useless backtrace */&lt;br /&gt;
 def catching(inner) {&lt;br /&gt;
   def catcher match msg {&lt;br /&gt;
     try {&lt;br /&gt;
       [[Object E#callWithPair/2|E.callWithPair]](inner, msg)&lt;br /&gt;
     } catch p {&lt;br /&gt;
       [[stderr]].println(`$p${p.eStack()}`)&lt;br /&gt;
       null&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   return catcher&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 def makeScribbleComponent(model) {&lt;br /&gt;
    var x := 0&lt;br /&gt;
    var y := 0&lt;br /&gt;
 &lt;br /&gt;
    def scribbleC := makeEPainter(catching(def painter {&lt;br /&gt;
      to paintComponent(g) {&lt;br /&gt;
        for line :Tuple[int, int, int, int] in model {&lt;br /&gt;
          E.call(g, &amp;quot;drawLine&amp;quot;, line)&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    }))&lt;br /&gt;
 &lt;br /&gt;
    scribbleC.addMouseListener(catching(def ml {&lt;br /&gt;
      to mousePressed(event) {&lt;br /&gt;
        x := event.getX()&lt;br /&gt;
        y := event.getY()&lt;br /&gt;
      }&lt;br /&gt;
      match _ {}&lt;br /&gt;
    }))&lt;br /&gt;
 &lt;br /&gt;
    scribbleC.addMouseMotionListener(catching(def mml {&lt;br /&gt;
      to mouseDragged(event) {&lt;br /&gt;
        model.push([x, y,&lt;br /&gt;
                    x := event.getX(),&lt;br /&gt;
                    y := event.getY()])&lt;br /&gt;
        scribbleC.repaint()&lt;br /&gt;
      }&lt;br /&gt;
      match _ {}&lt;br /&gt;
    }))&lt;br /&gt;
    &lt;br /&gt;
    scribbleC.setPreferredSize(&amp;lt;awt:makeDimension&amp;gt;(300, 300))&lt;br /&gt;
    return scribbleC&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 # --- application&lt;br /&gt;
 &lt;br /&gt;
 def lines := [].diverge()&lt;br /&gt;
 def done&lt;br /&gt;
 &lt;br /&gt;
 def frame := &amp;lt;unsafe:javax.swing.makeJFrame&amp;gt;(&amp;quot;Scribble&amp;quot;)&lt;br /&gt;
 frame.setContentPane(makeScribbleComponent(lines))&lt;br /&gt;
 &lt;br /&gt;
 frame.addWindowListener(catching(def mainWindowListener {&lt;br /&gt;
    to windowClosing(event) :void {&lt;br /&gt;
      bind done := null&lt;br /&gt;
    }&lt;br /&gt;
    match _ {}&lt;br /&gt;
 }))&lt;br /&gt;
 &lt;br /&gt;
 frame.setLocation(50, 50)&lt;br /&gt;
 frame.pack()&lt;br /&gt;
 frame.show()&lt;br /&gt;
 &lt;br /&gt;
 [[interp]].waitAtTop(done)&lt;br /&gt;
&lt;br /&gt;
[[Category:Examples]]&lt;br /&gt;
[[Category:AWT]]&lt;/div&gt;</summary>
		<author><name>Kevin Reid</name></author>	</entry>

	<entry>
		<id>http://wiki.erights.org/mediawiki/index.php?title=Scribble_demo&amp;diff=3904&amp;oldid=prev</id>
		<title>Kevin Reid at 15:20, 23 May 2009</title>
		<link rel="alternate" type="text/html" href="http://wiki.erights.org/mediawiki/index.php?title=Scribble_demo&amp;diff=3904&amp;oldid=prev"/>
				<updated>2009-05-23T15:20:16Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 15:20, 23 May 2009&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 80:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 80:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; [[interp]].waitAtTop(done)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; [[interp]].waitAtTop(done)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Examples]]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:AWT]]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-20 23:23:53 --&gt;
&lt;/table&gt;</summary>
		<author><name>Kevin Reid</name></author>	</entry>

	</feed>