In [ ]:
package test.beaker;

import java.util.Date;
import java.text.SimpleDateFormat;

public class BeakerTest {
  private Date _date;
  private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ");
  
  public BeakerTest() {
    _date = new Date();
  }

  public String getDateTxt() {
    return "Today:" + sdf.format(_date);
  }

  public String getDateUpperCaseTxt() {
    return getDateTxt().toUpperCase();
  }

}

In [ ]:
package test.beaker;

BeakerTest bt = new BeakerTest();
return bt.getDateTxt();

In [ ]:
import java.util.List;
import java.util.ArrayList;
import com.twosigma.beakerx.chart.xychart.Plot;
import com.twosigma.beakerx.chart.xychart.plotitem.*;
import com.twosigma.beakerx.chart.Color;

Plot p = new Plot();

p.setTitle("this is a Java plot");

Bars b = new Bars();

List<Number> yList = new ArrayList<Number>();
yList.add(2);
yList.add(5);
yList.add(4);
yList.add(8);

b.setY(yList);
b.setColor(Color.blue);
b.setWidth(0.5);

p.add(b);
  
return p;

In [ ]:
package test.beaker;
interface DateGetter {
   public String getDateTxt();
}

In [ ]:
package test.beaker;
public class DG2 extends BeakerTest implements DateGetter {
}

In [ ]:
%classpath add jar ../../../doc/resources/jar/BeakerXClasspathTest.jar

In [ ]:
System.out.println("The Groovy working folder is :");
System.out.println(java.nio.file.Paths.get(".").toAbsolutePath().normalize().toString());
System.out.println("BeakerXClasspathTest.jar exists in this folder");

In [ ]:
import com.beaker.BeakerXClasspathTest;

BeakerXClasspathTest t = new BeakerXClasspathTest();
System.out.println(com.beaker.BeakerXClasspathTest.staticTest);
System.out.println(t.getObjectTest());

press 'Tab' for autocomplete


In [ ]:

press 'Shift' + 'Tab' for doc


In [ ]:

Output usage


In [ ]:
import com.twosigma.beakerx.widget.Output;
Output out2 = new Output();
OutputManager.setOutput(out2);
return out2;

In [ ]:
import static java.lang.System.out;

Thread t = new Thread(() -> {
    out.println("Some output init");
    try {
        Thread.sleep(2000);
    } catch (InterruptedException e) {
    }
    for (int i = 0; i <10 ; i++){
        out.println("Some output "+ i);    
    }
});
out.println("Start");
t.start();
//t.join();
out.println("end");
return "Thread example result";

In [ ]:
OutputManager.clearOutput();

In [ ]:
import static java.lang.System.out;
for (int i = 0; i <30 ; i++){
    out.println("Done "+ i);    
}
return 3+5;

In [ ]:
OutputManager.setOutput(null);

In [ ]: