Package javax.microedition.lcdui

Examples of javax.microedition.lcdui.StringItem


    public void displayScore(Score score) {
        Form f = new Form(score.scoreText);
        f.addCommand(backCommand);
        f.setCommandListener(this);

        StringItem item;

        item = new StringItem(null, "Rules: Japanese");
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_CENTER | Item.LAYOUT_NEWLINE_BEFORE | Item.LAYOUT_NEWLINE_AFTER);
        f.append(item);

        // ----------------------------------------------------------------------------
        item = new StringItem(null, T._("White"));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_EXPAND | Item.LAYOUT_NEWLINE_BEFORE);
        f.append(item);

        item = new StringItem(null, T._("Black"));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_SHRINK | Item.LAYOUT_NEWLINE_AFTER);
        f.append(item);

        // ----------------------------------------------------------------------------
        item = new StringItem(null, T._("Territory"));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_CENTER | Item.LAYOUT_NEWLINE_BEFORE | Item.LAYOUT_NEWLINE_AFTER);
        f.append(item);

        item = new StringItem(null, String.valueOf(score.wTerr));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_EXPAND | Item.LAYOUT_NEWLINE_BEFORE);
        f.append(item);

        item = new StringItem(null, String.valueOf(score.bTerr));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_SHRINK | Item.LAYOUT_NEWLINE_AFTER);
        f.append(item);

        // ----------------------------------------------------------------------------
        item = new StringItem(null, T._("Captured"));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_CENTER | Item.LAYOUT_NEWLINE_BEFORE | Item.LAYOUT_NEWLINE_AFTER);
        f.append(item);

        item = new StringItem(null, String.valueOf(-score.wCaptured));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_EXPAND | Item.LAYOUT_NEWLINE_BEFORE);
        f.append(item);

        item = new StringItem(null, String.valueOf(-score.bCaptured));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_SHRINK | Item.LAYOUT_NEWLINE_AFTER);
        f.append(item);

        // ----------------------------------------------------------------------------
        item = new StringItem(null, T._("Dead"));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_CENTER | Item.LAYOUT_NEWLINE_BEFORE | Item.LAYOUT_NEWLINE_AFTER);
        f.append(item);

        item = new StringItem(null, String.valueOf(-score.wDead));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_EXPAND | Item.LAYOUT_NEWLINE_BEFORE);
        f.append(item);

        item = new StringItem(null, String.valueOf(-score.bDead));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_SHRINK | Item.LAYOUT_NEWLINE_AFTER);
        f.append(item);

        // ----------------------------------------------------------------------------
        item = new StringItem(null, T._("Komi"));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_CENTER | Item.LAYOUT_NEWLINE_BEFORE | Item.LAYOUT_NEWLINE_AFTER);
        f.append(item);

        item = new StringItem(null, String.valueOf(score.komi));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_EXPAND | Item.LAYOUT_NEWLINE_BEFORE);
        f.append(item);

        // ----------------------------------------------------------------------------
        item = new StringItem(null, "=");
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_CENTER | Item.LAYOUT_NEWLINE_BEFORE | Item.LAYOUT_NEWLINE_AFTER);
        f.append(item);

        item = new StringItem(null, String.valueOf(score.wScore));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_EXPAND | Item.LAYOUT_NEWLINE_BEFORE);
        f.append(item);

        item = new StringItem(null, String.valueOf(score.bScore));
        item.setFont(fontPlain());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_SHRINK | Item.LAYOUT_NEWLINE_AFTER);
        f.append(item);

        // ----------------------------------------------------------------------------
        item = new StringItem(null, score.scoreText);
        item.setFont(fontBold());
        item.setLayout(Item.LAYOUT_2 | Item.LAYOUT_CENTER | Item.LAYOUT_NEWLINE_BEFORE | Item.LAYOUT_NEWLINE_AFTER);
        f.append(item);

        extern = true;
        display.setCurrent(f);
    }
View Full Code Here


        display.setCurrent(f);
    }

    private void displayNodeProperties() {
        Form sgfPropsForm = new Form(T._("Node properties"));
        StringItem sgfNodeProps = new StringItem(T._("Node"), null);
        StringItem sgfRootProps = new StringItem(T._("Root"), null);

        sgfPropsForm.addCommand(backCommand);
        sgfPropsForm.setCommandListener(this);

        sgfNodeProps.setFont(fontPlain());
        sgfNodeProps.setLayout(Item.LAYOUT_2 | Item.LAYOUT_EXPAND | Item.LAYOUT_NEWLINE_BEFORE | Item.LAYOUT_NEWLINE_AFTER);
        sgfPropsForm.append(sgfNodeProps);
        sgfRootProps.setFont(fontPlain());
        sgfRootProps.setLayout(Item.LAYOUT_2 | Item.LAYOUT_EXPAND | Item.LAYOUT_NEWLINE_BEFORE | Item.LAYOUT_NEWLINE_AFTER);
        sgfPropsForm.append(sgfRootProps);

        SGFNode root = game.kifuHead();
        SGFNode node = game.kifuLastMove();

        StringBuffer sb = new StringBuffer();
        for (Enumeration e = root.getProperties(); e.hasMoreElements(); ) {
            SGFProperty p = (SGFProperty) e.nextElement();
            sb.append(p.toString());
            sb.append("\n");
        }
        sgfRootProps.setText(sb.toString());

        sb.setLength(0);
        if (node != root)
            for (Enumeration e = node.getProperties(); e.hasMoreElements(); ) {
                SGFProperty p = (SGFProperty) e.nextElement();
View Full Code Here

        display.setCurrent(sgfPropsForm);
    }

    private void displaySource() {
        Form srcForm = new Form(T._("Source"));
        StringItem srcText = new StringItem(null, null);

        srcForm.addCommand(backCommand);
        srcForm.setCommandListener(this);

        srcText.setFont(fontPlain());
        srcForm.append(srcText);

        SGFNode root = game.kifuHead();
        try {
            srcText.setText(SGFWriter.toString(root));
        } catch (IOException e) {
            srcText.setText(e.getMessage());
        }

        display.setCurrent(srcForm);
    }
View Full Code Here

        display.setCurrent(srcForm);
    }

    private void displayInfo() {
        Form infoForm = new Form(T._("Info"));
        StringItem infoText = new StringItem(null, null);

        infoForm.addCommand(backCommand);
        infoForm.setCommandListener(this);

        infoText.setFont(fontPlain());
        infoForm.append(infoText);

        StringBuffer sb = new StringBuffer();

        SGFNode root = game.kifuHead();

        for (Enumeration e = root.getProperties(); e.hasMoreElements(); ) {
            SGFProperty p = (SGFProperty) e.nextElement();
            // skip point and comment properties in this screen
            if (!p.name().hasPoint() && p.name() != SGFPropertyName.C) {
                sb.append(p.toString());
                sb.append("\n");
            }
        }

        infoText.setText(sb.toString());

        display.setCurrent(infoForm);
    }
View Full Code Here

            String  sInfoText,
            boolean bAutoShowAndHide)
  {
    super(sTitle);

    aInfo      = new StringItem(null, null);
    aProgressInfo = new StringItem(null, null);
    aProgressBar  = new Gauge(null, false, 100, 0);

    if (rImage != null)
    {
      append(rImage);
View Full Code Here

        return buffer.toString();
    }

    private StringItem appendMessage()
    {
        final StringItem item = new StringItem( null, null );
        item.setLayout( Item.LAYOUT_NEWLINE_BEFORE );
        item.setFont( Font.getFont( Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL ) );
        append( item );
        return item;
    }
View Full Code Here

        return item;
    }

    private Item createUrlItem( final String url )
    {
        final StringItem item = new StringItem( null, url, Item.HYPERLINK );
        item.setLayout( Item.LAYOUT_NEWLINE_BEFORE );
        return item;
    }
View Full Code Here

     *
     * @param text the content of the message
     */
    protected final void appendMessage( final String text )
    {
        final StringItem item = new StringItem( null, text );
        item.setLayout( Item.LAYOUT_NEWLINE_BEFORE );
        item.setFont( Font.getFont( Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM ) );
        append( item );
    }
View Full Code Here

        return chapters[number];
    }

    public final void fillBookInfo(Form f) {

        StringItem s;

        s = new StringItem("Title:", title);
        s.setLayout(StringItem.LAYOUT_LEFT);

        f.append(s);

        s = new StringItem("Author:", author);
        f.append(s);

        s = new StringItem("Language:", getLanguageAlias());
        f.append(s);

        s = new StringItem("Language:", language);
    }
View Full Code Here

TOP

Related Classes of javax.microedition.lcdui.StringItem

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.