Search in sources :

Example 1 with TextBox

use of javax.microedition.lcdui.TextBox in project CodenameOne by codenameone.

the class GameCanvasImplementation method editString.

/**
 * @inheritDoc
 */
public void editString(Component cmp, int maxSize, int constraint, String text, int keyCode) {
    UIManager m = UIManager.getInstance();
    CONFIRM_COMMAND = new Command(m.localize("ok", "OK"), Command.OK, 1);
    CANCEL_COMMAND = new Command(m.localize("cancel", "Cancel"), Command.CANCEL, 2);
    if (mid.getAppProperty("forceBackCommand") != null) {
        canvas.addCommand(MIDP_BACK_COMMAND);
    }
    currentTextBox = new TextBox("", "", maxSize, TextArea.ANY);
    currentTextBox.setCommandListener((CommandListener) canvas);
    currentTextBox.addCommand(CONFIRM_COMMAND);
    currentTextBox.addCommand(CANCEL_COMMAND);
    currentTextComponent = cmp;
    currentTextBox.setMaxSize(maxSize);
    currentTextBox.setString(text);
    currentTextBox.setConstraints(constraint);
    display.setCurrent(currentTextBox);
    ((C) canvas).setDone(false);
    Display.getInstance().invokeAndBlock(((C) canvas));
}
Also used : Command(javax.microedition.lcdui.Command) UIManager(com.codename1.ui.plaf.UIManager) TextBox(javax.microedition.lcdui.TextBox)

Aggregations

UIManager (com.codename1.ui.plaf.UIManager)1 Command (javax.microedition.lcdui.Command)1 TextBox (javax.microedition.lcdui.TextBox)1