How to create a JavaScriptObject by hand in GWT?

gwt

Solution

You should be able to do this?

Person a = (Person)JavaScriptObject.createObject().cast();

Problem

how could i create an JavaScriptObject by hand when i have this class ``` public class Person extends JavaScriptObject{ protected Person(){} public final native String FirstName()/*-{ return this.firstName; }-*/; public final native String LastName()/*-{ return this.lastName; }-*/; } ``` i am asking because i have an array of this JavaScriptObject Peron ``` public JsArray<Person> persons = JavaScriptObject.createArray().cast(); ``` and i would like to full this array with some of these Person objects ``` Peson a = new Person(); a.setfirstName(textField1.getText()); a.setLastName(textField2.getText()); persons.push(a) ``` but i doesnt know how to create such an object by hand. The values of firstName and lastName i would take from an UI component like an textField. Please help!

Original source