import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import swidgets.*;
import sodium.*;

public class ClearField {
    public static void main(String[] args) {
        JFrame view = new JFrame("ClearField") {
            public Dimension getPreferredSize() {
                return new Dimension(400, 160);
            }
        };
        view.setLayout(new FlowLayout());

        Transaction.runVoid(() -> {
            SButton clear = new SButton("Clear");
            Stream<String> sClearIt = clear.sClicked.map(u -> "");
            STextField text = new STextField(sClearIt, "Hello", 15);
            view.add(text);
            view.add(clear);
        });

        view.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
        view.pack();
        view.setVisible(true);
    }
}


@@ -217,132 +217,8 @@
 ld%22)
- %7B%0A            public Dimension getPreferredSize() %7B%0A                return new Dimension(400, 160);%0A            %7D%0A        %7D
 ;%0A  
@@ -262,48 +262,8 @@
 );%0A%0A
-        Transaction.runVoid(() -%3E %7B%0A    
     
@@ -300,28 +300,24 @@
 n(%22Clear%22);%0A
-    
         Stre
@@ -375,20 +375,16 @@
         
-    
 STextFie
@@ -432,36 +432,32 @@
 %22, 15);%0A        
-    
 view.add(text);%0A
@@ -460,28 +460,24 @@
 t);%0A        
-    
 view.add(cle
@@ -480,28 +480,16 @@
 (clear);
-%0A        %7D);
 %0A%0A      
@@ -665,13 +665,24 @@
 iew.
-pack(
+setSize(400, 160
 );%0A 

Tidy up Book example "ClearField"