Package net.rim.device.api.ui.container

Examples of net.rim.device.api.ui.container.AbsoluteFieldManager


       
        mi_about.setCommandContext(this);
        mi_about.setCommand(new Command(new AboutCommand()));
        addMenuItem(mi_about);

        AbsoluteFieldManager abmgr = new AbsoluteFieldManager();
        new_game_screen = BitmapFactory.getNewGameScreen();
        Background bg_new_game = BackgroundFactory.createBitmapBackground(new_game_screen);
        abmgr.setBackground(bg_new_game);
        status_message = new TimedLabelField(this, "");
        abmgr.add(status_message);
        add(abmgr);
    }
View Full Code Here


        int icon_height=nought_focused.getHeight();
        // spacer width must be 1/3 the width of an icon for even spacing
        int width_spacer = icon_width / 3;
       
        int icon_x = width_spacer;
        AbsoluteFieldManager mgr = new AbsoluteFieldManager();
        mgr.add(msbf_nought,icon_x,icon_height);
        icon_x = icon_x + icon_width + width_spacer;
        mgr.add(msbf_cross,icon_x,icon_height);
        add(mgr);
    }
View Full Code Here

    public RoleSelectionScreen() {
        super(USE_ALL_HEIGHT | USE_ALL_WIDTH | FIELD_HCENTER | FIELD_VCENTER | NO_VERTICAL_SCROLL);
        setTitle("NfcSnepResponder V" + Constants.MYAPP_VERSION);

        AbsoluteFieldManager btnRow = new AbsoluteFieldManager();
        // bitmaps are 120 x 120
        int hgap = (int) ((Display.getWidth() - 120) / 2);
        int vgap = (int) (Display.getHeight() - 120) / 2;
        int x= hgap;
        int y = (int) (vgap * 0.75);
       
        MsbConfig vcardResponderBtnConfig = new MsbConfig();
        MsbState vcardResponderBtnState = new MsbState(Constants.VCARD_RESPONDER_BTN_STATE,
                "vCard Responder",
                "vCard Responder");
        vcardResponderBtnState.setbmp_focused(vcardResponderFocused);
        vcardResponderBtnState.setbmp_unfocused(vcardResponderUnfocused);
        vcardResponderBtnState.setbmp_clicked(vcardResponderClicked);
        vcardResponderBtnState.setbmp_unclicked(vcardResponderFocused);
        vcardResponderBtnConfig.addState(vcardResponderBtnState);
        msbfVcardResponder = new MultiStateButtonField(vcardResponderBtnConfig,
                new ResponderCommand(), 0, Field.FIELD_HCENTER);
        btnRow.add(msbfVcardResponder,x,y);

        msbfVcardResponder.setFocusListener(focusListener);

        add(btnRow);
        add(uiMsg);
View Full Code Here

    public RoleSelectionScreen() {
        super(USE_ALL_HEIGHT | USE_ALL_WIDTH | FIELD_HCENTER | FIELD_VCENTER | NO_VERTICAL_SCROLL);
        setTitle("LLCPDemo V" + Constants.MYAPP_VERSION);

        AbsoluteFieldManager btn_row = new AbsoluteFieldManager();
        // bitmaps are 120 x 120
        int hgap = (int) ((Display.getWidth() - 240) / 3);
        int vgap = (int) (Display.getHeight() - 120) / 2;
        int x1= hgap;
        int x2= x1 + 120 + hgap;
        int y = (int) (vgap * 0.75);
       
        MsbConfig snd_btn_config = new MsbConfig();
        MsbState snd_btn_state = new MsbState(Constants.SND_BTN_STATE, "Send data over LLCP", "Send data over LLCP");
        snd_btn_state.setbmp_focused(snd_focused);
        snd_btn_state.setbmp_unfocused(snd_unfocused);
        snd_btn_state.setbmp_clicked(snd_clicked);
        snd_btn_state.setbmp_unclicked(snd_focused);
        snd_btn_config.addState(snd_btn_state);
        msbf_snd = new MultiStateButtonField(snd_btn_config, new SendCommand(), 0, Field.FIELD_HCENTER);
        btn_row.add(msbf_snd,x1,y);

        MsbConfig rcv_btn_config = new MsbConfig();
        MsbState rcv_btn_state = new MsbState(Constants.RCV_BTN_STATE, "Receive data over LLCP", "Receive data over LLCP");
        rcv_btn_state.setbmp_focused(rcv_focused);
        rcv_btn_state.setbmp_unfocused(rcv_unfocused);
        rcv_btn_state.setbmp_clicked(rcv_clicked);
        rcv_btn_state.setbmp_unclicked(rcv_focused);
        rcv_btn_config.addState(rcv_btn_state);
        msbf_rcv = new MultiStateButtonField(rcv_btn_config, new ReceiveCommand(), 0, Field.FIELD_HCENTER);
        btn_row.add(msbf_rcv,x2,y);

        msbf_rcv.setFocusListener(focus_listener);
        msbf_snd.setFocusListener(focus_listener);

        add(btn_row);
View Full Code Here

    public RoleSelectionScreen() {
        super(USE_ALL_HEIGHT | USE_ALL_WIDTH | FIELD_HCENTER | FIELD_VCENTER | NO_VERTICAL_SCROLL);
        setTitle("NfcVirtualTargetFun V" + Constants.MYAPP_VERSION);

        AbsoluteFieldManager btn_row = new AbsoluteFieldManager();
        // bitmaps are 120 x 120
        int hgap = (int) ((Display.getWidth() - 240) / 3);
        int vgap = (int) (Display.getHeight() - 120) / 2;
        int x1= hgap;
        int x2= x1 + 120 + hgap;
        int y = (int) (vgap * 0.75);
       
        MsbConfig sc_btn_config = new MsbConfig();
        MsbState sc_btn_state = new MsbState(Constants.SC_BTN_STATE, "Emulate Smart Card", "Emulate Smart Card");
        sc_btn_state.setbmp_focused(sc_focused);
        sc_btn_state.setbmp_unfocused(sc_unfocused);
        sc_btn_state.setbmp_clicked(sc_clicked);
        sc_btn_state.setbmp_unclicked(sc_focused);
        sc_btn_config.addState(sc_btn_state);
        msbf_sc = new MultiStateButtonField(sc_btn_config, new EmulateScCommand(), 0, Field.FIELD_HCENTER);
        btn_row.add(msbf_sc,x1,y);

        MsbConfig sr_btn_config = new MsbConfig();
        MsbState sr_btn_state = new MsbState(Constants.SR_BTN_STATE, "Emulate Reader", "Emulate Reader");
        sr_btn_state.setbmp_focused(sr_focused);
        sr_btn_state.setbmp_unfocused(sr_unfocused);
        sr_btn_state.setbmp_clicked(sr_clicked);
        sr_btn_state.setbmp_unclicked(sr_focused);
        sr_btn_config.addState(sr_btn_state);
        msbf_sr = new MultiStateButtonField(sr_btn_config, new EmulateSrCommand(), 0, Field.FIELD_HCENTER);
        btn_row.add(msbf_sr,x2,y);

        msbf_sc.setFocusListener(focus_listener);
        msbf_sr.setFocusListener(focus_listener);

        add(btn_row);
View Full Code Here

        Bitmap cross_clicked = BitmapFactory.addStateIndicator(cross_unfocused, Constants.CLICKED_COLOUR);

        stale_mate_cross_bmp = BitmapFactory.addStateIndicator(cross_unfocused, Constants.STALE_MATE_TILE_COLOUR);
        stale_mate_nought_bmp = BitmapFactory.addStateIndicator(cross_unfocused, Constants.STALE_MATE_TILE_COLOUR);

        AbsoluteFieldManager abmgr = new AbsoluteFieldManager();

        cmd_select_tile = new SelectTileCommand();

        Background board = BackgroundFactory.createBitmapBackground(BitmapFactory.getBackground(width, height));
        abmgr.setBackground(board);
        // Each button has 3 states : blank|nought|cross
        int i = 0;
        for(int r = 0; r < 3; r++) {
            for(int c = 0; c < 3; c++) {
                MsbConfig tile_btn_config = new MsbConfig();
                MsbState tile_btn_state_blank = new MsbState(Constants.TILE_STATE_BLANK, "Blank Tile", "Blank Tile");
                tile_btn_state_blank.setbmp_focused(blank_focused);
                tile_btn_state_blank.setbmp_unfocused(blank_unfocused);
                tile_btn_state_blank.setbmp_clicked(blank_clicked);
                tile_btn_state_blank.setbmp_unclicked(blank_focused);
                tile_btn_config.addState(tile_btn_state_blank);
                MsbState tile_btn_state_nought = new MsbState(Constants.TILE_STATE_NOUGHT, "Nought", "Nought");
                tile_btn_state_nought.setbmp_focused(nought_focused);
                tile_btn_state_nought.setbmp_unfocused(nought_unfocused);
                tile_btn_state_nought.setbmp_clicked(nought_clicked);
                tile_btn_state_nought.setbmp_unclicked(nought_focused);
                tile_btn_config.addState(tile_btn_state_nought);
                MsbState tile_btn_state_cross = new MsbState(Constants.TILE_STATE_CROSS, "Cross", "Cross");
                tile_btn_state_cross.setbmp_focused(cross_focused);
                tile_btn_state_cross.setbmp_unfocused(cross_unfocused);
                tile_btn_state_cross.setbmp_clicked(cross_clicked);
                tile_btn_state_cross.setbmp_unclicked(cross_focused);
                tile_btn_config.addState(tile_btn_state_cross);

                MultiStateButtonField msbf_tile = new MultiStateButtonField(tile_btn_config, cmd_select_tile, 0, Field.FIELD_HCENTER);
                msbf_tile.setFocusListener(focus_listener);
                tiles[i] = msbf_tile;
                abmgr.add(msbf_tile, uiconfig.getTileX(i), uiconfig.getTileY(i));
                i++;
            }
        }

        add(abmgr);
View Full Code Here

    }

    private TimerScreen() {
        super(Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH | Screen.NO_VERTICAL_SCROLL);
        ColouredBackground bg = new ColouredBackground(Color.WHITE, Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH | Screen.NO_VERTICAL_SCROLL);
        AbsoluteFieldManager ab_mgr = new AbsoluteFieldManager();
        hour1 = new BitmapField(digits[0]);
        hour2 = new BitmapField(digits[0]);
        minute1 = new BitmapField(digits[0]);
        minute2 = new BitmapField(digits[0]);
        second1 = new BitmapField(digits[0]);
        second2 = new BitmapField(digits[0]);
        colon1 = new BitmapField(colon);
        colon2 = new BitmapField(colon);
        bg.add(ab_mgr);

        int y = (Display.getHeight() - 112) / 2; // images are 112 pixels high
        int x = (Display.getWidth() - (8 * 60)) / 2; // and 60 pixels wide

        ab_mgr.add(hour1, x, y);
        x = x + 60;
        ab_mgr.add(hour2, x, y);
        x = x + 60;
        ab_mgr.add(colon1, x, y);
        x = x + 60;
        ab_mgr.add(minute1, x, y);
        x = x + 60;
        ab_mgr.add(minute2, x, y);
        x = x + 60;
        ab_mgr.add(colon2, x, y);
        x = x + 60;
        ab_mgr.add(second1, x, y);
        x = x + 60;
        ab_mgr.add(second2, x, y);
        add(bg);
    }
View Full Code Here

        super(USE_ALL_HEIGHT | USE_ALL_WIDTH | FIELD_HCENTER | FIELD_VCENTER | NO_VERTICAL_SCROLL);
        setTitle("NFC Read NDEF SmartTag v" + Constants.MYAPP_VERSION);
       
        Utilities.log("XXXX constructing ListenerControlScreen");
       
        AbsoluteFieldManager icon_manager = new AbsoluteFieldManager();
        // button bitmaps are 120 x 120
        int hgap = (int) ((Display.getWidth() - 240) / 3);
        int vgap = (int) (Display.getHeight() - 120) / 2;
        int x1= hgap;
        int x2= x1 + 120 + hgap;
        int y = (int) (vgap * 0.75);
       
        // position the little LED in the top right hand corner
        int led_x = (Display.getWidth() - reg_led.getWidth() - 5);
        int led_y = 5;
      
        MsbConfig sc_btn_config = new MsbConfig();
        MsbState sc_btn_state = new MsbState(Constants.REG_BTN_STATE, "Register Listener", "Register Listener");
        sc_btn_state.setbmp_focused(reg_focused);
        sc_btn_state.setbmp_unfocused(reg_unfocused);
        sc_btn_state.setbmp_clicked(reg_clicked);
        sc_btn_state.setbmp_unclicked(reg_focused);
        sc_btn_config.addState(sc_btn_state);
        msbf_sc = new MultiStateButtonField(sc_btn_config, new RegisterListenerCommand(), 0, Field.FIELD_HCENTER);
        icon_manager.add(msbf_sc,x1,y);

        MsbConfig sr_btn_config = new MsbConfig();
        MsbState sr_btn_state = new MsbState(Constants.UNR_BTN_STATE, "Unregister Listener", "Unregister Listener");
        sr_btn_state.setbmp_focused(unr_focused);
        sr_btn_state.setbmp_unfocused(unr_unfocused);
        sr_btn_state.setbmp_clicked(unr_clicked);
        sr_btn_state.setbmp_unclicked(unr_focused);
        sr_btn_config.addState(sr_btn_state);
        msbf_sr = new MultiStateButtonField(sr_btn_config, new UnregisterListenerCommand(), 0, Field.FIELD_HCENTER);
        icon_manager.add(msbf_sr,x2,y);

        if (_listener_mgr.is_listening()) {
            led = new BitmapField(reg_led);
        } else {
            led = new BitmapField(unr_led);
        }
        icon_manager.add(led,led_x, led_y);
       
        add(icon_manager);

        Utilities.log("XXXX done constructing ListenerControlScreen");

View Full Code Here

    public TypeSelectionScreen() {
        super(USE_ALL_HEIGHT | USE_ALL_WIDTH | FIELD_HCENTER | FIELD_VCENTER | NO_VERTICAL_SCROLL);
        setTitle("NfcWriteNdefSmartTag V" + Constants.MYAPP_VERSION);

        AbsoluteFieldManager mgr = new AbsoluteFieldManager();
        // bitmaps are 120 x 120
        int hgap = (int) ((Display.getWidth() - 240) / 3);
        int vgap = (int) (Display.getHeight() - 240) / 3;
        int x1= hgap;
        int x2= x1 + 120 + hgap;
        int y1 = vgap;
        int y2 = y1 + 120 + vgap;

        MsbConfig uri_btn_config = new MsbConfig();
        MsbState uri_btn_state = new MsbState(Constants.BTN_STATE, "Create URI type tag", "Create URI type tag");
        uri_btn_state.setbmp_focused(uri_focused);
        uri_btn_state.setbmp_unfocused(uri_unfocused);
        uri_btn_state.setbmp_clicked(uri_clicked);
        uri_btn_state.setbmp_unclicked(uri_focused);
        uri_btn_config.addState(uri_btn_state);
        msbf_uri = new MultiStateButtonField(uri_btn_config, new CreateUriTagCommand(), 0, Field.FIELD_HCENTER);
        mgr.add(msbf_uri,x1,y1);
        msbf_uri.setFocusListener(focus_listener);

        MsbConfig sp_btn_config = new MsbConfig();
        MsbState sp_btn_state = new MsbState(Constants.BTN_STATE, "Create Smart Poster type tag", "Create Smart Poster type tag");
        sp_btn_state.setbmp_focused(sp_focused);
        sp_btn_state.setbmp_unfocused(sp_unfocused);
        sp_btn_state.setbmp_clicked(sp_clicked);
        sp_btn_state.setbmp_unclicked(sp_focused);
        sp_btn_config.addState(sp_btn_state);
        msbf_sp = new MultiStateButtonField(sp_btn_config, new CreateSpTagCommand(), 0, Field.FIELD_HCENTER);
        mgr.add(msbf_sp,x2,y1);
        msbf_sp.setFocusListener(focus_listener);

        MsbConfig text_btn_config = new MsbConfig();
        MsbState text_btn_state = new MsbState(Constants.BTN_STATE, "Create Text type tag", "Create Text type tag");
        text_btn_state.setbmp_focused(text_focused);
        text_btn_state.setbmp_unfocused(text_unfocused);
        text_btn_state.setbmp_clicked(text_clicked);
        text_btn_state.setbmp_unclicked(text_focused);
        text_btn_config.addState(text_btn_state);
        msbf_text = new MultiStateButtonField(text_btn_config, new CreateTextTagCommand(), 0, Field.FIELD_HCENTER);
        mgr.add(msbf_text,x1,y2);
        msbf_text.setFocusListener(focus_listener);

        MsbConfig custom_btn_config = new MsbConfig();
        MsbState custom_btn_state = new MsbState(Constants.BTN_STATE, "Create custom type tag", "Create custom type tag");
        custom_btn_state.setbmp_focused(custom_focused);
        custom_btn_state.setbmp_unfocused(custom_unfocused);
        custom_btn_state.setbmp_clicked(custom_clicked);
        custom_btn_state.setbmp_unclicked(custom_focused);
        custom_btn_config.addState(custom_btn_state);
        msbf_custom = new MultiStateButtonField(custom_btn_config, new CreateCustomTagCommand(), 0, Field.FIELD_HCENTER);
        mgr.add(msbf_custom,x2,y2);
        msbf_custom.setFocusListener(focus_listener);

//        mgr.add(ui_msg,x1,10);

        add(mgr);
View Full Code Here

        final int displayWidth = Display.getWidth();
        final int displayHeight = Display.getHeight();

        // Add an AbsoluteFieldManager to contain a video field
        final AbsoluteFieldManager absoluteFieldManager =
                new AbsoluteFieldManager();
        absoluteFieldManager.setBackground(BackgroundFactory
                .createSolidBackground(Color.KHAKI));
        add(absoluteFieldManager);

        // Set up video field
        final Field videoField = initializeVideo();

        if (videoField != null) {
            // Calculate position of video field and add to manager
            final int videoFieldX = (displayWidth - VIDEO_WIDTH) / 2;
            final int videoFieldY = (displayHeight - VIDEO_HEIGHT) / 2;
            absoluteFieldManager.add(videoField, videoFieldX, videoFieldY);

            // Create a ComponentCanvas for overlaying fields on the video
            final ComponentCanvas componentCanvas =
                    new ComponentCanvas(VIDEO_WIDTH + MARGIN, VIDEO_HEIGHT
                            + MARGIN);

            // Calculate the position of the ComponentCanvas
            // and add to the manager.
            final int canvasX = (displayWidth - (VIDEO_WIDTH + MARGIN)) / 2;
            final int canvasY = (displayHeight - (VIDEO_HEIGHT + MARGIN)) / 2;
            absoluteFieldManager.add(componentCanvas, canvasX, canvasY);

            // Button for pausing the video
            final ButtonField pauseButton =
                    new ButtonField("Pause", ButtonField.CONSUME_CLICK
                            | ButtonField.NEVER_DIRTY);
View Full Code Here

TOP

Related Classes of net.rim.device.api.ui.container.AbsoluteFieldManager

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.