In [ ]:
val form : EasyForm = new com.twosigma.beakerx.scala.easyform.EasyForm("Form and Run")
form.addTextField("First", 250)
form.addTextField("Last", 250)
form.addButton("Go!", "run")
form
In [ ]:
"Good morning " + form.get("First") + " " + form.get("Last")
In [ ]:
val h = new EasyForm("Form and Run")
h.addTextField("first", 380)
h.addTextArea("Text Area",500,200)
h
In [ ]:
val g2 = new com.twosigma.beakerx.scala.easyform.EasyForm("Field Types")
val options = Seq("a", "b", "c", "d")
g2.addList("List Single", options, false)
g2
In [ ]:
//You can use onInit and onChange to handle component events. For button events use actionPerfromed or addAction.
val f1 = new EasyForm("Form and Run")
val first = f1.addTextField("first", 15)
first.onInit(new EasyFormListener {
override def execute(value: String): Unit = {
first.setValue("Changed!");
}
}).onChange(new EasyFormListener {
override def execute(value: String): Unit = {
first.setValue("Changed!");
}
});
val last = f1.addTextField("last", 15)
val button = f1.addButton("action button")
button.actionPerformed = new EasyFormListener {
override def execute(value: String): Unit = first.setValue("Pressed!"); last.setValue("Pressed!")
}
f1
In [ ]:
//All Kinds of Fields
val g = new EasyForm("Field Types")
g.addTextField("Short Text Field", 10)
g.addTextField("Text Field")
g.addTextArea("Text Area")
g.addCheckBox("Check Box")
val options = Seq("a", "b", "c", "d")
g.addComboBox("Combo Box", options)
g.addComboBox("Editable Combo", options, true)
g.addList("List", options)
g.addList("List Single", options, false)
g.addList("List Two Row", options, 2)
g.addCheckBoxes("Check Boxes", options)
g.addCheckBoxes("Check Boxes H", options, EasyForm.HORIZONTAL)
g.addRadioButtons("Radio Buttons", options)
g.addRadioButtons("Radio Buttons H", options, EasyForm.HORIZONTAL)
g.addDatePicker("Date")
g.addButton("Go!", "run2")
g
In [ ]:
val gdp = new EasyForm("Field Types")
val date = gdp.addDatePicker("Date")
gdp
In [ ]:
date.getValue()
In [ ]:
form.put("First", "Micheal")
form.put("Last", "Fox")
// Read values from form
val firstName = form.get("First")
val lastName = form.get("Last")
print("Good morning " + firstName + " " + lastName)
In [ ]:
EasyForm.HORIZONTAL
In [ ]: