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

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


                    new BitmapField(bitmapOrig, Field.FOCUSABLE);
            final StringBuffer strBuff = new StringBuffer("Original - ");
            strBuff.append(bitmapOrig.getWidth());
            strBuff.append(LABEL_X);
            strBuff.append(bitmapOrig.getHeight());
            add(new LabelField(strBuff.toString()));
            add(bitmapFieldOrig);

            add(new SeparatorField());

            // Display the scaled Bitmap on the screen
            final BitmapField bitmapFieldScaled1 =
                    new BitmapField(bitmapScaled, Field.FOCUSABLE);
            strBuff.delete(0, strBuff.length());
            strBuff.append("\nScaled - ");
            strBuff.append(bitmapScaled.getWidth());
            strBuff.append(LABEL_X);
            strBuff.append(bitmapScaled.getHeight());
            strBuff.append(" - FILTER_LANCZOS - Aspect ratio not preserved");
            add(new LabelField(strBuff.toString()));
            add(bitmapFieldScaled1);

            add(new SeparatorField());

            // Redefine the scaled Bitmap
            bitmapScaled =
                    new Bitmap(Bitmap.ROWWISE_32BIT_ARGB8888, scaledX, scaledY);

            // Scale the original Bitmap into the new Bitmap using
            // a bilinear filter and maintaining aspect ratio.
            bitmapOrig.scaleInto(bitmapScaled, Bitmap.FILTER_BILINEAR,
                    Bitmap.SCALE_TO_FILL);

            // Display the newly scaled Bitmap on the screen
            final BitmapField bitmapFieldScaled2 =
                    new BitmapField(bitmapScaled, Field.FOCUSABLE);
            strBuff.delete(0, strBuff.length());
            strBuff.append("\nScaled - ");
            strBuff.append(bitmapScaled.getWidth());
            strBuff.append(LABEL_X);
            strBuff.append(bitmapScaled.getHeight());
            strBuff.append(" - FILTER_BILINEAR - Aspect ratio preserved");
            add(new LabelField(strBuff.toString()));
            add(bitmapFieldScaled2);

            add(new SeparatorField());

            // Redefine the scaled Bitmap
            bitmapScaled =
                    new Bitmap(Bitmap.ROWWISE_32BIT_ARGB8888, scaledX, scaledY);

            // Calculate fragment dimensions
            final int fragmentWidth = bitmapOrig.getWidth() >> 1; // >> 1
                                                                  // equivalent
                                                                  // to / 2
            final int fragmentHeight = bitmapOrig.getHeight() >> 1; // >> 1
                                                                    // equivalent
                                                                    // to / 2

            // Scale a fragment of the original Bitmap into the new Bitmap
            // using a box filter.
            bitmapOrig.scaleInto(0, 0, fragmentWidth, fragmentHeight,
                    bitmapScaled, 0, 0, bitmapScaled.getWidth(), bitmapScaled
                            .getHeight(), Bitmap.FILTER_BOX);

            // Display the newly scaled Bitmap on the screen
            final BitmapField bitmapFieldScaled3 =
                    new BitmapField(bitmapScaled, Field.FOCUSABLE);
            strBuff.delete(0, strBuff.length());
            strBuff.append("\nScaled fragment ");
            strBuff.append(fragmentWidth);
            strBuff.append(LABEL_X);
            strBuff.append(fragmentHeight);
            strBuff.append(" into ");
            strBuff.append(bitmapScaled.getWidth());
            strBuff.append(LABEL_X);
            strBuff.append(bitmapScaled.getHeight());
            strBuff.append(" - FILTER_BOX");
            add(new LabelField(strBuff.toString()));
            add(bitmapFieldScaled3);

            // Add a menu item to display an animation in a popup screen
            final MenuItem showAnimation =
                    new MenuItem(new StringProvider("Show Animation"),
View Full Code Here


                NavigationDeviceSettings.createEmptySet();
        settings.set(NavigationDeviceSettings.DETECT_SWIPE, 1);
        addInputSettings(settings);

        // Create label fields for directions/display of gestures
        final LabelField directions =
                new LabelField(
                        "Swipe the trackpad. Swipe direction will be displayed on screen.");
        _log = new LabelField("");

        // Add fields to screen
        add(directions);
        add(_log);
    }
View Full Code Here

    public TableAdapterScreen(final DemoStringTokenizer deviceData) {
        super(Manager.NO_VERTICAL_SCROLL);

        setTitle("Table Adapter Screen");

        add(new LabelField("BlackBerry Devices", Field.FIELD_HCENTER));
        add(new SeparatorField());

        _devices = new Vector();

        _tableModel = new DeviceTableModelAdapter();

        // Add data to adapter
        while (deviceData.hasMoreTokens()) {
            final String modelNumber = deviceData.nextToken().trim();
            final String modelName = deviceData.nextToken().trim();
            deviceData.nextToken(); // Consume unwanted input
            final Bitmap bitmap =
                    Bitmap.getBitmapResource(modelNumber + ".png");
            deviceData.nextToken();
            deviceData.nextToken();

            final Object[] row = { modelName, modelNumber, bitmap };

            _tableModel.addRow(row);
        }

        // Set up table view and controller
        final TableView tableView = new TableView(_tableModel);
        tableView.setDataTemplateFocus(BackgroundFactory
                .createLinearGradientBackground(Color.WHITE, Color.WHITE,
                        Color.BLUEVIOLET, Color.BLUEVIOLET));
        final TableController tableController =
                new TableController(_tableModel, tableView);
        tableController.setFocusPolicy(TableController.ROW_FOCUS);
        tableView.setController(tableController);

        // Specify a simple data template for displaying 3 columns
        final DataTemplate dataTemplate =
                new DataTemplate(tableView, NUM_ROWS, NUM_COLUMNS) {
                    /**
                     * @see DataTemplate#getDataFields(int)
                     */
                    public Field[] getDataFields(final int modelRowIndex) {
                        final Object[] data =
                                (Object[]) _tableModel.getRow(modelRowIndex);
                        final Field[] fields =
                                { new BitmapField((Bitmap) data[0]),
                                        new LabelField(data[1]),
                                        new LabelField(data[2]) };
                        return fields;
                    }
                };

        dataTemplate.useFixedHeight(true);
View Full Code Here

                }
            });
            add(_buttonField);

            // Create a label field that displays the file chosen
            _labelField = new LabelField();
            add(_labelField);

            // Make this class a FilePicker listener
            _filePicker.setListener(this);
        }
View Full Code Here

                    screen.setType(DemoMainScreen.AUDIO_TYPE);

                    // Play an audio file
                    if (_audioPlayer == null) {
                        final String url = invoc.getURL();
                        screen.add(new LabelField("Playing audio file: " + url));

                        initAudio(url);
                    }
                }
View Full Code Here

            final Screen screen = getActiveScreen();
            if (screen instanceof MainScreen) {
                final Field field = screen.getField(0);
                if (field instanceof LabelField) {
                    final LabelField labelField = (LabelField) field;
                    invokeLater(new Runnable() {
                        public void run() {
                            labelField.setText("End of media reached.");
                        }
                    });
                }
            }
        }
View Full Code Here

            _buttonField =
                    new ButtonField("Choose location", ButtonField.NEVER_DIRTY
                            | ButtonField.CONSUME_CLICK);
            _buttonField.setChangeListener(this);
            add(_buttonField);
            _nameLabel = new LabelField();
            _descLabel = new LabelField();
            _coordLabel = new LabelField();
            add(_nameLabel);
            add(_descLabel);
            add(_coordLabel);

            // Define suggested locations
View Full Code Here

     *            Used to retrieve the file information
     */
    public FileExplorerDemoScreenFileInfoPopup(
            final FileExplorerDemoFileHolder fileholder) {
        super(new VerticalFieldManager());
        add(new LabelField("File Information"));
        add(new SeparatorField());
        add(new LabelField(fileholder.getFileName()));
        add(new LabelField(""));

        // Use the MIMETypeAssociations class to determine information about the
        // file
        add(new LabelField("MIME Type: "
                + MIMETypeAssociations.getMIMEType(fileholder.getFileName())));
    }
View Full Code Here

                controller.destroyReceiver(_uriReceiverField.getText());

            }
        });

        final LabelField instructions =
                new LabelField(
                        "This test allows you to start listening for push messages. On the push server you have to"
                                + " specify receiver as '/test8'.  The push messages can be paused, restarted or stopped completely using the 'Pause',"
                                + " 'Resume' and 'Destroy' buttons, respectively. Registering for pushes also registers auto-start where the app wakes up if"
                                + " it is closed for any incoming push to it.",
                        Field.NON_FOCUSABLE);
View Full Code Here

        // Disable shared mode
        _map.getAction().disableOperationMode(MapConstants.MODE_SHARED_FOCUS);

        // Label fields to show the user location info
        _latField = new LabelField("Latitude: ");
        _lonField = new LabelField("Longitude: ");
        _zoomField = new LabelField("Zoom: ");

        add(_map);
        add(_latField);
        add(_lonField);
        add(_zoomField);
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.