Lwuit MediaComponent的使用
2009-12-12 11:16
253 查看
来源于:http://forums.java.net/jive/thread.jspa?threadID=44377&tstart=30
不过里面的问题也没有解决。
倒是最后的一句话是这样说的:
There isn't really a solution for this problem, except using another
emulator than the emulators coming with the Sun Wireless Toolkit.
不过里面的问题也没有解决。
倒是最后的一句话是这样说的:
There isn't really a solution for this problem, except using another
emulator than the emulators coming with the Sun Wireless Toolkit.
import java.io.IOException; import com.sun.lwuit.Command; import com.sun.lwuit.Display; import com.sun.lwuit.Form; import com.sun.lwuit.MediaComponent; import com.sun.lwuit.TabbedPane; import com.sun.lwuit.events.ActionEvent; import com.sun.lwuit.layouts.BorderLayout; import com.sun.lwuit.plaf.UIManager; import com.sun.lwuit.util.Resources; import javax.microedition.media.Manager; import javax.microedition.media.MediaException; import javax.microedition.media.Player; import javax.microedition.media.control.VideoControl; import javax.microedition.midlet.MIDlet; public class TryMidlet extends MIDlet { private MediaComponent mc = null; private Player player = null; private VideoControl vc = null; private Form f; public void startApp() { Display.init(this); Resources r; try { r = Resources.open("/javaTheme.res"); UIManager.getInstance().setThemeProps(r.getTheme("javaTheme")); } catch (IOException e1) { e1.printStackTrace(); } Display.getInstance().setFlashGraphicsBug(true); f = new Form("hello"); f.setLayout(new BorderLayout()); try { player = Manager.createPlayer("capture://video"); player.realize(); player.start(); mc = new MediaComponent(player); f.addComponent(BorderLayout.CENTER, mc); vc = (VideoControl) player.getControl("VideoControl"); vc.setDisplayFullScreen(true); f.addCommand(new Command("Exit") { public void actionPerformed(ActionEvent arg0) { release(); exitMIDlet(); } }); f.show(); } catch (Exception e) { } } private void release() { if (player != null) { try { player.stop(); player.close(); } catch (MediaException ex) { ex.printStackTrace(); } } } public void exitMIDlet() { destroyApp(true); notifyDestroyed(); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } }
相关文章推荐
- LWUIT + ChartComponent 之三实现柱体图(HBarChar)
- lwuit-List控件使用
- LWUIT + ChartComponent 之一实现饼图(PieChart)
- LWUIT + ChartComponent 之三实现柱体图(HBarChar)
- Lwuit 中关于TextField的使用
- 解读 LWUIT 之六:使用表格(Table)和树(Tree)
- LWUIT + ChartComponent 之一实现饼图(PieChart)
- LWUIT + ChartComponent实现折线表
- LWUIT 上使用List实现表格
- lwuit-List控件使用
- LWUIT 自定义灵活Style的Component
- 使用 LWUIT 的风格、主题和 Painter 特性
- LWUIT 上使用List实现表格
- lwuit-tab与list配合使用
- 解读 LWUIT 之九:使用布局管理器(Layout Manager)
- lwuit-List控件使用
- 解读 LWUIT 之九:使用布局管理器(Layout Manager)
- LWUIT + ChartComponent 之二实现线形图(LineChart)
- canal的使用错误“Context namespace element 'component-scan' and its parser class”
- LWUIT 自定义灵活Style的Component