lwuit视频组件浮动命令

时间:2013-12-25 10:33:50

标签: java java-me lwuit lwuit-form lwuit-command

我的LWUIT视频组件浮动在我的命令上。知道如何解决这个问题吗?我的代码如下。

public void showQuickProfileForm() {
 Form f = new Form();
        VideoComponent videoComponent = null;
        try {
            videoComponent = VideoComponent.createVideoPeer("capture://image");
        } catch (IOException e) {
          //  e.printStackTrace();
            try {
                videoComponent = VideoComponent.createVideoPeer("capture://video");
            } catch (IOException ex) {
              //  ex.printStackTrace();
            }
        }
        videoComponent.setPreferredH((int) (Display.getInstance().getDisplayHeight() * 0.8));
        videoComponent.setPreferredW(Display.getInstance().getDisplayWidth());
        Player player = (Player) videoComponent.getNativePeer();
        try {
            player.realize();
            player.start();
        } catch (MediaException ex) {
            ex.printStackTrace();
        }
        VideoControl videoControl = (VideoControl) player.getControl("VideoControl");
        videoComponent.start();
        f.addComponent(videoComponent);
        f.addCommand(new Command("capture", 1));
        f.show();
    }

    public void actionPerformed(ActionEvent evt) {
        if (evt.getCommand().getId() == 1) {
            // midlet.destroyApp(true);
            Form d = new Form();
            d.show();
        }
    }

1 个答案:

答案 0 :(得分:0)

初始化视频控制后,请根据需要更改宽度和高度:

videoControl.setDisplaySize(width + 4, height - 25);