Package net.rim.device.api.ui

Examples of net.rim.device.api.ui.MenuItem


            for (int i = 0; i < numFields; ++i) {
                add((Field) fields.elementAt(i));
            }

            // Create a menu item to save the new call
            final MenuItem saveItem =
                    new MenuItem(new StringProvider("Save"), 0x230010, 100);
            saveItem.setCommand(new Command(new CommandHandler() {
                /**
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
                 */
                public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here


        for (int i = 0; i < numFields; ++i) {
            add((Field) fields.elementAt(i));
        }

        _editItem = new MenuItem(new StringProvider("Edit"), 0x230010, 0);
        _editItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                /* outer. */makeEditScreen();
            }
        }));

        _saveItem = new MenuItem(new StringProvider("Save"), 0x230010, 0);
        _saveItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
 
View Full Code Here

            for (int i = 0; i < numFields; ++i) {
                add((Field) fields.elementAt(i));
            }

            // Create a menu item to save the new call
            final MenuItem saveItem =
                    new MenuItem(new StringProvider("Save"), 0x230010, 100);
            saveItem.setCommand(new Command(new CommandHandler() {
                /**
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
                 */
                public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

        }

        add(_rtf);

        // Closes the screen
        final MenuItem closeSP =
                new MenuItem(new StringProvider("Close serial port"), 0x230010,
                        0);
        closeSP.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                close();
            }
        }));

        // Displays the DTR line's state
        final MenuItem dtr =
                new MenuItem(new StringProvider("Get DTR"), 0x230020, 1);
        dtr.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                try {
                    Status.show("DTR: " + _port.getDtr());
                } catch (final IOException ioex) {
                    Status.show("");
                    BluetoothDemo
                            .errorDialog("BluetoothSerialPort#getDtr() threw "
                                    + ioex.toString());
                }
            }
        }));

        // Turns DSR on
        final MenuItem dsrOn =
                new MenuItem(new StringProvider("DSR on"), 0x230030, 2);
        dsrOn.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                Status.show("DSR on");
                try {
                    _port.setDsr(true);
                } catch (final IOException ioex) {
                    Status.show("");
                    BluetoothDemo
                            .errorDialog("BluetoothSerialPort#setDsr(boolean) threw "
                                    + ioex.toString());
                }
            }
        }));

        // Turns DSR off
        final MenuItem dsrOff =
                new MenuItem(new StringProvider("DSR off"), 0x230040, 3);
        dsrOff.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                Status.show("DSR off");
                try {
                    _port.setDsr(false);
                } catch (final IOException ioex) {
                    Status.show("");
                    BluetoothDemo
                            .errorDialog("BluetoothSerialPort#setDsr(boolean) threw "
                                    + ioex.toString());
                }
            }
        }));

        // Enables loop back
        final MenuItem enableLoopback =
                new MenuItem(new StringProvider("Enable loopback"), 0x230050, 4);
        enableLoopback.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                _loopback = true;
            }
        }));

        // Disables loop back
        final MenuItem disableLoopback =
                new MenuItem(new StringProvider("Disable loopback"), 0x230060,
                        5);
        disableLoopback.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                _loopback = false;
            }
        }));

        // Sends 1kb of information to the other device
        final MenuItem send1k =
                new MenuItem(new StringProvider("Send 1k"), 0x230070, 6);
        send1k.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

        /**
         * @see net.rim.device.api.ui.container.MainScreen#makeMenu(Menu,int)
         */
        protected void makeMenu(final Menu menu, final int instance) {
            if (HomeScreen.supportsIcons()) {
                final MenuItem setIconItem =
                        new MenuItem(
                                new StringProvider("Set Home Screen Icon"),
                                0x230010, 0);
                setIconItem.setCommand(new Command(new CommandHandler() {
                    /**
                     * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                     *      Object)
                     */
                    public void execute(final ReadOnlyCommandMetadata metadata,
                            final Object context) {
                        final Bitmap bitmap =
                                Bitmap.getBitmapResource("img/logo_blue.jpg");
                        HomeScreen.updateIcon(bitmap);
                    }
                }));
                menu.add(setIconItem);

                final MenuItem setRolloverItem =
                        new MenuItem(new StringProvider("Set Rollover Icon"),
                                0x230020, 1);
                setRolloverItem.setCommand(new Command(new CommandHandler() {
                    /**
                     * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                     *      Object)
                     */
                    public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

        _uuid = uuid;
        _statusField = new RichTextField(Field.NON_FOCUSABLE);
        add(_statusField);

        final MenuItem infoScreen =
                new MenuItem(new StringProvider("Info Screen"), 0x230010, 1);
        infoScreen.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

     */
    public void inquiryCompleted(final int discType) {
        delete(_statusField);
        add(_view);

        final MenuItem connectToDevice =
                new MenuItem(new StringProvider("Connect to Device"), 0x230020,
                        0);
        connectToDevice.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

            for (int i = 0; i < numFields; ++i) {
                add((Field) fields.elementAt(i));
            }

            // Menu item to edit the displayed CallLog
            final MenuItem editItem =
                    new MenuItem(new StringProvider("Edit"), 0x230010, 110);
            editItem.setCommand(new Command(new CommandHandler() {
                /**
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
                 */
                public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

    public AccelerometerDemo() {
        if (AccelerometerSensor.isSupported()) {

            // Menu item to start the ball moving
            _startMenuItem =
                    new MenuItem(new StringProvider("Start"), 0x230010, 0);
            _startMenuItem.setCommand(new Command(new CommandHandler() {
                /**
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
                 */
                public void execute(final ReadOnlyCommandMetadata metadata,
                        final Object context) {
                    if (_thread == null) {
                        // Start drawing
                        _thread = new DrawThread();
                        _thread.start();
                    }
                }
            }));

            // Menu item to stop the ball moving
            _stopMenuItem =
                    new MenuItem(new StringProvider("Stop"), 0x230010, 0);
            _stopMenuItem.setCommand(new Command(new CommandHandler() {
                /**
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
                 */
 
View Full Code Here

            for (int i = 0; i < numFields; ++i) {
                add((Field) fields.elementAt(i));
            }

            // Menu itme to save the current phone log
            final MenuItem saveItem =
                    new MenuItem(new StringProvider("Save"), 0x230010, 100);
            saveItem.setCommand(new Command(new CommandHandler() {
                /**
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
                 */
                public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

TOP

Related Classes of net.rim.device.api.ui.MenuItem

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.