Package net.rim.device.api.ui.component

Examples of net.rim.device.api.ui.component.LabelField


     */
    public SpellCheckDemoScreen(final SpellCheckDemo app) {
        _app = app;

        // Add UI components to the screen.
        setTitle(new LabelField("Spell Check Demo", DrawStyle.ELLIPSIS
                | Field.USE_ALL_WIDTH));
        final RichTextField infoField =
                new RichTextField(
                        "Type a misspelled word into the test field (eg. blackbery).  Select menu items to perform spell check operations.",
                        Field.NON_FOCUSABLE);
        add(infoField);
        final SeparatorField separator = new SeparatorField();
        add(separator);
        _testField = new TestField("Test Field: ", "");
        add(_testField);

        _spellCheckItem =
                new MenuItem(new StringProvider("Spell check"), 0x230010, 1);
        _spellCheckItem.setCommand(new Command(new CommandHandler() {
            /**
             * Checks the spelling in the TestField.
             *
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                if (_testField.getText().length() == 0) {
                    Dialog.alert("Test field cannot be empty");
                } else {
                    _app.spellCheck(_testField);
                }
            }
        }));

        _learnWordItem =
                new MenuItem(new StringProvider("Learn word"), 0x230020, 1);
        _learnWordItem.setCommand(new Command(new CommandHandler() {
            /**
             * Learns the word in the TestField.
             *
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                if (_testField.getText().length() == 0) {
                    Dialog.alert("Test field cannot be empty");
                } else {
                    _app.learnWord(_testField.getText());
                }
            }
        }));

        _learnCorrectionItem =
                new MenuItem(new StringProvider("Learn correction"), 0x230030,
                        2);
        _learnCorrectionItem.setCommand(new Command(new CommandHandler() {
            /**
             * Shows the user a list of possible corrections for the word in the
             * TestField.
             *
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                if (_testField.getText().length() == 0) {
                    Dialog.alert("Test field cannot be empty");
                } else {
                    final VerticalFieldManager vfm = new VerticalFieldManager();
                    _popUp = new PopupScreen(vfm);
                    final LabelField popUpLabel =
                            new LabelField("Correction for "
                                    + _testField.getText() + ":");
                    _correction = new EditField();
                    _popUp.add(popUpLabel);
                    _popUp.add(_correction);
                    final HorizontalFieldManager hfm =
View Full Code Here


            public Field[] getDataFields(final int modelRowIndex) {
                final BlackBerryMemo memo =
                        (BlackBerryMemo) _model.getRow(modelRowIndex);

                final Field[] fields =
                        { new LabelField(memo
                                .getString(BlackBerryMemo.TITLE, 0),
                                Field.NON_FOCUSABLE) };
                return fields;
            }
        };
View Full Code Here

                    final String text =
                            (String) record
                                    .getField(PhoneNumberRecord.PHONE_NUMBER);

                    final Field[] fields =
                            { new LabelField(text, Field.NON_FOCUSABLE) };

                    return fields;
                }
            };
            dataTemplate.createRegion(new XYRect(0, 0, 1, 1));
View Full Code Here

            // Couldn't find any address info
            location = "Location: unknown";
        }

        // Initialize a LabelField to display location info
        final LabelField labelField = new LabelField(location) {
            /**
             * @see LabelField#paint(Graphics g)
             */
            public void paint(final Graphics g) {
                g.setColor(Color.SKYBLUE);
                g.setBackgroundColor(Color.IVORY);
                g.clear();
                super.paint(g);
            }
        };

        // Set the font of the LabelField to be the same as that of the
        // caller info displayed on the screen by the Phone application.
        labelField.setFont(phoneScreen.getCallerInfoFont());

        // Initialize a PhoneScreenHorizontalManager
        final PhoneScreenHorizontalManager pshm =
                new PhoneScreenHorizontalManager();

View Full Code Here

                        context.getFlags());

        final VerticalFieldManager vfm =
                new VerticalFieldManager(Manager.VERTICAL_SCROLL);

        vfm.add(new LabelField("Mime type: "));
        vfm.add(new LabelField(ACCEPT[0]));
        vfm.add(new SeparatorField());
        vfm.add(new LabelField("Content of the resource file: \n"));
        vfm.add(new SeparatorField());

        InputStream in = null;
        try {
            in = context.getInputStream();
            if (in == null) {
                in = context.getInputConnection().openInputStream();
            }

            final StringBuffer sb = new StringBuffer();
            int ch;
            while (-1 != (ch = in.read())) {
                sb.append((char) ch);
            }

            vfm.add(new LabelField(sb.toString()));
        } catch (final IOException ioe) {
            errorDialog(ioe.toString());
        } finally {
            if (in != null) {
                try {
View Full Code Here

                     */
                    public void execute(final ReadOnlyCommandMetadata metadata,
                            final Object context) {
                        final MainScreen screen = new MainScreen();

                        screen.setTitle(new LabelField("View Phone Record"));

                        final PhoneNumberRecordDisplayer displayer =
                                new PhoneNumberRecordDisplayer(_record);
                        final Vector fields = displayer.getFields();
                        final int numFields = fields.size();
View Full Code Here

            // Couldn't find any address info
            location = "Location: unknown";
        }

        // Initialize a LabelField to display location info
        final LabelField labelField = new LabelField(location) {
            /**
             * @see LabelField#paint(Graphics g)
             */
            public void paint(final Graphics g) {
                g.setColor(Color.VIOLET);
                g.setBackgroundColor(Color.WHEAT);
                g.clear();
                super.paint(g);
            }
        };

        // Set the font of the LabelField to be the same as that of the
        // caller info displayed on the screen by the Phone application.
        labelField.setFont(phoneScreen.getCallerInfoFont());

        // Initialize a PhoneScreenHorizontalManager
        final PhoneScreenHorizontalManager pshm =
                new PhoneScreenHorizontalManager();

View Full Code Here

     *             if the provided type is not one of the FOR_* constants.
     */
    /* package */Object render(final int type) {
        switch (type) {
        case FOR_TITLE:
            return new LabelField(_titleField.getText());

        case FOR_ADD:
            setEditable(true);

            return new Field[] { _titleField, _notesField };
View Full Code Here

            } catch (final Exception e) {
                Dialog.alert("Exception while initializing the playback video player\n\n"
                        + e);
            }
        } else {
            add(new LabelField("The video file you are trying to play is empty"));
        }
    }
View Full Code Here

            public Field[] getDataFields(final int modelRowIndex) {
                final String text =
                        ((Memo) _model.getRow(modelRowIndex))
                                .getField(Memo.MEMO_NAME);
                final Field[] fields =
                        { new LabelField(text, Field.NON_FOCUSABLE) };

                return fields;
            }
        };
        dataTemplate.createRegion(new XYRect(0, 0, 1, 1));
View Full Code Here

TOP

Related Classes of net.rim.device.api.ui.component.LabelField

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.