Package javax.microedition.lcdui

Examples of javax.microedition.lcdui.Form


        newGameByoYomiAttr = new TextField(T._("Byo-Yomi Attr"), "5", 5, TextField.NUMERIC);

        newGameWhitePlayerName = new TextField(T._("White"), T._("White"), 32, TextField.ANY);
        newGameBlackPlayerName = new TextField(T._("Black"), T._("Black"), 32, TextField.ANY);

        newGameForm = new Form(T._("New game"));
        newGameForm.setCommandListener(this);
        newGameForm.addCommand(startCommand);
        newGameForm.addCommand(backCommand);
        newGameForm.append(newGameRuleSet);
        newGameForm.append(newGameBoardSize);
        newGameForm.append(newGameCustomBoardSize);
        newGameForm.append(newGameHandicap);
        newGameForm.append(newGameKomi);
        newGameForm.append(newGameTimeSystem);
        newGameForm.append(newGameMainTime);
        newGameForm.append(newGameByoYomiTime);
        newGameForm.append(newGameByoYomiAttr);
        newGameForm.append(newGameWhitePlayerName);
        newGameForm.append(newGameBlackPlayerName);

        // ---------------------------------------------------------------
        optPlayForm = new Form(T._("Play mode"));
        optPlayForm.setCommandListener(this);
        optPlayForm.addCommand(backCommand);
        optPlaySwitches = new ChoiceGroup(T._("On board"), Choice.MULTIPLE, playOptList, null);
        optPlaySwitches.setSelectedIndex(PLAY_OPT_MOVE_STATUS, true); // default show move status
        optPlayCommentLines = new TextField(T._("Comment lines"), "0", 1, TextField.NUMERIC);
        optPlayForm.append(optPlaySwitches);
        optPlayForm.append(optPlayCommentLines);

        optProbForm = new Form(T._("Problem mode"));
        optProbForm.setCommandListener(this);
        optProbForm.addCommand(backCommand);
        optProbSwitches = new ChoiceGroup(T._("On board"), Choice.MULTIPLE, probOptList, null);
        optProbSwitches.setSelectedIndex(PROB_OPT_COLOR_TO_PLAY, true);
        optProbSwitches.setSelectedIndex(PROB_OPT_SOLVED_FAILED, true);
        optProbCommentLines = new TextField(T._("Comment lines"), "1", 1, TextField.NUMERIC);
        optProbForm.append(optProbSwitches);
        optProbForm.append(optProbCommentLines);

        optGenForm = new Form(T._("General"));
        optGenForm.setCommandListener(this);
        optGenForm.addCommand(backCommand);
        optGenSwitches = new ChoiceGroup(null, Choice.MULTIPLE, genOptList, null);
        optGenSwitches.setSelectedIndex(GEN_OPT_SOUND, true);
        optCommentFontSize = new TextField(T._("Comment font size"), "14", 2, TextField.NUMERIC);
        optGenForm.append(optGenSwitches);
        optGenForm.append(optCommentFontSize);

        optForm = new List(T._("Options"), Choice.IMPLICIT, optGroupList, null);
        optForm.setCommandListener(this);
        optForm.addCommand(backCommand);
        optForm.addCommand(selectCommand);

        // -- In-game submenus -------------------------------------------
        igProblemMenuList = new List(T._("Problem"), Choice.IMPLICIT, igProblemMenuItems, null);
        igProblemMenuList.setCommandListener(this);
        igProblemMenuList.addCommand(backCommand);
        igPlayMenuList = new List(T._("Play"), Choice.IMPLICIT, igPlayMenuItems, null);
        igPlayMenuList.setCommandListener(this);
        igPlayMenuList.addCommand(backCommand);
        igViewMenuList = new List(T._("View"), Choice.IMPLICIT, igViewMenuItems, null);
        igViewMenuList.setCommandListener(this);
        igViewMenuList.addCommand(backCommand);
        igScoreMenuList = new List(T._("Score"), Choice.IMPLICIT, igScoreMenuItems, null);
        igScoreMenuList.setCommandListener(this);
        igScoreMenuList.addCommand(backCommand);

        // -- Problem filter ---------------------------------------------
        probFilterForm = new Form(T._("Problem filter"));
        probFilterForm.setCommandListener(this);
        if (fileSelectScreen != null)
            probFilterForm.addCommand(updPathsCommand);
        probFilterForm.addCommand(startCommand);
        probFilterForm.addCommand(backCommand);
View Full Code Here


                probAddPath(currDirName + fileName);
        }
    }

    private void displayText(String title, String body) {
        Form f = new Form(title);
        f.addCommand(backCommand);
        f.setCommandListener(this);
        StringItem i = new StringItem(null, body);
        i.setFont(Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_SMALL));
        f.append(i);
        setCurrent(f);
    }
View Full Code Here

            FileConnection fc = (FileConnection) Connector.open("file://localhost/" + currDirName + fileName);
            if (!fc.exists())
                throw new IOException(T._("File does not exists."));

            Form props = new Form(T._("Properties") + ": " + fileName);
            props.addCommand(backToBCommand);
            props.setCommandListener(this);

            props.append(new StringItem(T._("Location"), currDirName));
            props.append(new StringItem(T._("Type"), fc.isDirectory() ? T._("Directory") : T._("Regular File")));
            props.append(new StringItem(T._("Size"), Long.toString((fc.isDirectory() ? fc.directorySize(true) : fc.fileSize()))));
            props.append(new StringItem(T._("Modified"), myDate(fc.lastModified())));

            ChoiceGroup attrs = new ChoiceGroup(T._("Attributes"), Choice.MULTIPLE, attrList, null);
            attrs.setSelectedFlags(new boolean[] { fc.canRead(), fc.canWrite(), fc.isHidden() });
            props.append(attrs);

            if (fileName.toLowerCase().endsWith(".sgf"))
                try {
                    StringBuffer sb = new StringBuffer();
                    InputStream is = fc.openInputStream();
                    SGFParser parser = new SGFParser(new InputStreamReader(is));
                    SGFNode head = parser.parseHead();
                    is.close();
                    for (Enumeration e = head.getProperties(); e.hasMoreElements(); ) {
                        sb.append(e.nextElement().toString());
                        sb.append("\n");
                    }
                    props.append(new StringItem(T._("SGF Header"), sb.toString()));
                } catch (Exception e) {
                }

            fc.close();
            display.setCurrent(props);
View Full Code Here

            //#endif
        }
    }

    void createFile() {
        Form creator = new Form(T._("New File"));
        nameInput = new TextField(T._("Enter Name"), null, 256, TextField.ANY);
        typeInput = new ChoiceGroup(T._("Enter File Type"), Choice.EXCLUSIVE,
                typeList, iconList);
        creator.append(nameInput);
        creator.append(typeInput);
        creator.addCommand(newOkCommand);
        creator.addCommand(backToBCommand);
        creator.setCommandListener(this);
        display.setCurrent(creator);
    }
View Full Code Here

        newGameByoYomiAttr = new TextField(T._("Byo-Yomi Attr"), "5", 5, TextField.NUMERIC);

        newGameWhitePlayerName = new TextField(T._("White"), T._("White"), 32, TextField.ANY);
        newGameBlackPlayerName = new TextField(T._("Black"), T._("Black"), 32, TextField.ANY);

        newGameForm = new Form(T._("New game"));
        newGameForm.setCommandListener(this);
        newGameForm.addCommand(startCommand);
        newGameForm.addCommand(backCommand);
        newGameForm.append(newGameRuleSet);
        newGameForm.append(newGameBoardSize);
        newGameForm.append(newGameCustomBoardSize);
        newGameForm.append(newGameHandicap);
        newGameForm.append(newGameKomi);
        newGameForm.append(newGameTimeSystem);
        newGameForm.append(newGameMainTime);
        newGameForm.append(newGameByoYomiTime);
        newGameForm.append(newGameByoYomiAttr);
        newGameForm.append(newGameWhitePlayerName);
        newGameForm.append(newGameBlackPlayerName);

        // ---------------------------------------------------------------
        optPlayForm = new Form(T._("Play mode"));
        optPlayForm.setCommandListener(this);
        optPlayForm.addCommand(backCommand);
        optPlaySwitches = new ChoiceGroup(T._("On board"), Choice.MULTIPLE, playOptList, null);
        optPlaySwitches.setSelectedIndex(PLAY_OPT_MOVE_STATUS, true); // default show move status
        optPlayCommentLines = new TextField(T._("Comment lines"), "0", 1, TextField.NUMERIC);
        optPlayForm.append(optPlaySwitches);
        optPlayForm.append(optPlayCommentLines);

        optProbForm = new Form(T._("Problem mode"));
        optProbForm.setCommandListener(this);
        optProbForm.addCommand(backCommand);
        optProbSwitches = new ChoiceGroup(T._("On board"), Choice.MULTIPLE, probOptList, null);
        optProbSwitches.setSelectedIndex(PROB_OPT_COLOR_TO_PLAY, true);
        optProbSwitches.setSelectedIndex(PROB_OPT_SOLVED_FAILED, true);
        optProbCommentLines = new TextField(T._("Comment lines"), "1", 1, TextField.NUMERIC);
        optProbForm.append(optProbSwitches);
        optProbForm.append(optProbCommentLines);

        optGenForm = new Form(T._("General"));
        optGenForm.setCommandListener(this);
        optGenForm.addCommand(backCommand);
        optGenSwitches = new ChoiceGroup(null, Choice.MULTIPLE, genOptList, null);
        optGenSwitches.setSelectedIndex(GEN_OPT_SOUND, true);
        optCommentFontSize = new TextField(T._("Comment font size"), "14", 2, TextField.NUMERIC);
        optGenForm.append(optGenSwitches);
        optGenForm.append(optCommentFontSize);

        optForm = new List(T._("Options"), Choice.IMPLICIT, optGroupList, null);
        optForm.setCommandListener(this);
        optForm.addCommand(backCommand);
        optForm.addCommand(selectCommand);

        // -- In-game submenus -------------------------------------------
        igProblemMenuList = new List(T._("Problem"), Choice.IMPLICIT, igProblemMenuItems, null);
        igProblemMenuList.setCommandListener(this);
        igProblemMenuList.addCommand(backCommand);
        igPlayMenuList = new List(T._("Play"), Choice.IMPLICIT, igPlayMenuItems, null);
        igPlayMenuList.setCommandListener(this);
        igPlayMenuList.addCommand(backCommand);
        igViewMenuList = new List(T._("View"), Choice.IMPLICIT, igViewMenuItems, null);
        igViewMenuList.setCommandListener(this);
        igViewMenuList.addCommand(backCommand);
        igScoreMenuList = new List(T._("Score"), Choice.IMPLICIT, igScoreMenuItems, null);
        igScoreMenuList.setCommandListener(this);
        igScoreMenuList.addCommand(backCommand);

        // -- Problem filter ---------------------------------------------
        probFilterForm = new Form(T._("Problem filter"));
        probFilterForm.setCommandListener(this);
        if (fileSelectScreen != null)
            probFilterForm.addCommand(updPathsCommand);
        probFilterForm.addCommand(startCommand);
        probFilterForm.addCommand(backCommand);
View Full Code Here

                probAddPath(currDirName + fileName);
        }
    }

    private void displayText(String title, String body) {
        Form f = new Form(title);
        f.addCommand(backCommand);
        f.setCommandListener(this);
        StringItem i = new StringItem(null, body);
        i.setFont(Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_SMALL));
        f.append(i);
        setCurrent(f);
    }
View Full Code Here

        newGameByoYomiAttr = new TextField(T._("Byo-Yomi Attr"), "5", 5, TextField.NUMERIC);

        newGameWhitePlayerName = new TextField(T._("White"), T._("White"), 32, TextField.ANY);
        newGameBlackPlayerName = new TextField(T._("Black"), T._("Black"), 32, TextField.ANY);

        newGameForm = new Form(T._("New game"));
        newGameForm.setCommandListener(this);
        newGameForm.addCommand(startCommand);
        newGameForm.addCommand(backCommand);
        newGameForm.append(newGameRuleSet);
        newGameForm.append(newGameBoardSize);
        newGameForm.append(newGameCustomBoardSize);
        newGameForm.append(newGameHandicap);
        newGameForm.append(newGameKomi);
        newGameForm.append(newGameTimeSystem);
        newGameForm.append(newGameMainTime);
        newGameForm.append(newGameByoYomiTime);
        newGameForm.append(newGameByoYomiAttr);
        newGameForm.append(newGameWhitePlayerName);
        newGameForm.append(newGameBlackPlayerName);

        // ---------------------------------------------------------------
        optPlayForm = new Form(T._("Play mode"));
        optPlayForm.setCommandListener(this);
        optPlayForm.addCommand(backCommand);
        optPlaySwitches = new ChoiceGroup(T._("On board"), Choice.MULTIPLE, playOptList, null);
        optPlaySwitches.setSelectedIndex(PLAY_OPT_MOVE_STATUS, true); // default show move status
        optPlayCommentLines = new TextField(T._("Comment lines"), "0", 1, TextField.NUMERIC);
        optPlayForm.append(optPlaySwitches);
        optPlayForm.append(optPlayCommentLines);

        optProbForm = new Form(T._("Problem mode"));
        optProbForm.setCommandListener(this);
        optProbForm.addCommand(backCommand);
        optProbSwitches = new ChoiceGroup(T._("On board"), Choice.MULTIPLE, probOptList, null);
        optProbSwitches.setSelectedIndex(PROB_OPT_COLOR_TO_PLAY, true);
        optProbSwitches.setSelectedIndex(PROB_OPT_SOLVED_FAILED, true);
        optProbCommentLines = new TextField(T._("Comment lines"), "1", 1, TextField.NUMERIC);
        optProbForm.append(optProbSwitches);
        optProbForm.append(optProbCommentLines);

        optGenForm = new Form(T._("General"));
        optGenForm.setCommandListener(this);
        optGenForm.addCommand(backCommand);
        optGenSwitches = new ChoiceGroup(null, Choice.MULTIPLE, genOptList, null);
        optGenSwitches.setSelectedIndex(GEN_OPT_SOUND, true);
        optCommentFontSize = new TextField(T._("Comment font size"), "14", 2, TextField.NUMERIC);
        optGenForm.append(optGenSwitches);
        optGenForm.append(optCommentFontSize);

        optForm = new List(T._("Options"), Choice.IMPLICIT, optGroupList, null);
        optForm.setCommandListener(this);
        optForm.addCommand(backCommand);
        optForm.addCommand(selectCommand);

        // -- In-game submenus -------------------------------------------
        igProblemMenuList = new List(T._("Problem"), Choice.IMPLICIT, igProblemMenuItems, null);
        igProblemMenuList.setCommandListener(this);
        igProblemMenuList.addCommand(backCommand);
        igPlayMenuList = new List(T._("Play"), Choice.IMPLICIT, igPlayMenuItems, null);
        igPlayMenuList.setCommandListener(this);
        igPlayMenuList.addCommand(backCommand);
        igViewMenuList = new List(T._("View"), Choice.IMPLICIT, igViewMenuItems, null);
        igViewMenuList.setCommandListener(this);
        igViewMenuList.addCommand(backCommand);
        igScoreMenuList = new List(T._("Score"), Choice.IMPLICIT, igScoreMenuItems, null);
        igScoreMenuList.setCommandListener(this);
        igScoreMenuList.addCommand(backCommand);

        // -- Problem filter ---------------------------------------------
        probFilterForm = new Form(T._("Problem filter"));
        probFilterForm.setCommandListener(this);
        if (fileSelectScreen != null)
            probFilterForm.addCommand(updPathsCommand);
        probFilterForm.addCommand(startCommand);
        probFilterForm.addCommand(backCommand);
View Full Code Here

                probAddPath(currDirName + fileName);
        }
    }

    private void displayText(String title, String body) {
        Form f = new Form(title);
        f.addCommand(backCommand);
        f.setCommandListener(this);
        StringItem i = new StringItem(null, body);
        i.setFont(Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_SMALL));
        f.append(i);
        setCurrent(f);
    }
View Full Code Here

            FileConnection fc = (FileConnection) Connector.open("file://localhost/" + currDirName + fileName);
            if (!fc.exists())
                throw new IOException(T._("File does not exists."));

            Form props = new Form(T._("Properties") + ": " + fileName);
            props.addCommand(backToBCommand);
            props.setCommandListener(this);

            props.append(new StringItem(T._("Location"), currDirName));
            props.append(new StringItem(T._("Type"), fc.isDirectory() ? T._("Directory") : T._("Regular File")));
            props.append(new StringItem(T._("Size"), Long.toString((fc.isDirectory() ? fc.directorySize(true) : fc.fileSize()))));
            props.append(new StringItem(T._("Modified"), myDate(fc.lastModified())));

            ChoiceGroup attrs = new ChoiceGroup(T._("Attributes"), Choice.MULTIPLE, attrList, null);
            attrs.setSelectedFlags(new boolean[] { fc.canRead(), fc.canWrite(), fc.isHidden() });
            props.append(attrs);

            if (fileName.toLowerCase().endsWith(".sgf"))
                try {
                    StringBuffer sb = new StringBuffer();
                    InputStream is = fc.openInputStream();
                    InputStreamReader isr = new InputStreamReader(is);
                    SGFParser parser = new SGFParser(isr);
                    SGFNode head = parser.parseHead();
                    is.close();
                    for (Enumeration e = head.getProperties(); e.hasMoreElements(); ) {
                        sb.append(e.nextElement().toString());
                        sb.append("\n");
                    }
                    props.append(new StringItem(T._("SGF Header"), sb.toString()));
                } catch (Exception e) {
                }

            fc.close();
            display.setCurrent(props);
View Full Code Here

            //#endif
        }
    }

    void createFile() {
        Form creator = new Form(T._("New File"));
        nameInput = new TextField(T._("Enter Name"), null, 256, TextField.ANY);
        typeInput = new ChoiceGroup(T._("Enter File Type"), Choice.EXCLUSIVE,
                typeList, iconList);
        creator.append(nameInput);
        creator.append(typeInput);
        creator.addCommand(newOkCommand);
        creator.addCommand(backToBCommand);
        creator.setCommandListener(this);
        display.setCurrent(creator);
    }
View Full Code Here

TOP

Related Classes of javax.microedition.lcdui.Form

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.