Search in sources :

Example 1 with SplitPane

use of com.codename1.components.SplitPane in project CodenameOne by codenameone.

the class SharedJavascriptContextSample method start.

public void start() {
    if (current != null) {
        current.show();
        return;
    }
    Form hi = new Form("Hi World", new BorderLayout());
    TextArea input = new TextArea();
    TextArea output = new TextArea();
    output.setEditable(false);
    Button execute = new Button("Run");
    execute.addActionListener(evt -> {
        BrowserComponent bc = CN.getSharedJavascriptContext().ready().get();
        bc.execute("callback.onSuccess(window.eval(${0}))", new Object[] { input.getText() }, res -> {
            output.setText(res.toString());
        });
    });
    SplitPane split = new SplitPane(SplitPane.VERTICAL_SPLIT, input, output, "0", "50%", "99%");
    hi.add(CENTER, split);
    hi.add(NORTH, execute);
    hi.show();
}
Also used : BorderLayout(com.codename1.ui.layouts.BorderLayout) Form(com.codename1.ui.Form) TextArea(com.codename1.ui.TextArea) Button(com.codename1.ui.Button) BrowserComponent(com.codename1.ui.BrowserComponent) SplitPane(com.codename1.components.SplitPane)

Aggregations

SplitPane (com.codename1.components.SplitPane)1 BrowserComponent (com.codename1.ui.BrowserComponent)1 Button (com.codename1.ui.Button)1 Form (com.codename1.ui.Form)1 TextArea (com.codename1.ui.TextArea)1 BorderLayout (com.codename1.ui.layouts.BorderLayout)1