Topic: JMF的摄像头Applet无法运行的问题? |
Print this page |
1.JMF的摄像头Applet无法运行的问题? | Copy to clipboard |
Posted by: yanqlv Posted on: 2005-09-16 22:39 我做了一个基于JMF的摄像头程序, 在Application的时候运行很好, 可是一改成applet, 就在这个地方出错:(加******的地方), 用过的高手请帮忙看一下是什么问题, 我已经排除了由于applet 的安全问题, 我把安全设置为AllPermission 因为/* test applet security */ /* test end */之间的部分能够正常对本地文件进行操作。 ..... String str1 = "vfw:Logitech USB Video Camera:0"; String str2 = "vfw:Microsoft WDM Image Capture (Win32):0"; di = CaptureDeviceManager.getDevice(str2); /* test applet security */ try{ java.io.File existDir = new java.io.File("e:/empty"); java.io.File newFile = new java.io.File("e:/testforjava"); System.out.println("existDir.delete()="+existDir.delete()); System.out.println("newFile.createNewFile()="+newFile.createNewFile()); }catch(Exception e){ System.out.println("file delete exception:"+e); e.printStackTrace(); } /* test end */ System.out.println("di="+di);///**************** di=null************** ml = di.getLocator();///**************** exception throw here************** try { player = Manager.createRealizedPlayer(ml); player.start(); Component comp; if ((comp = player.getVisualComponent()) != null) { add(comp, BorderLayout.NORTH); } Panel panel1 = new Panel(new BorderLayout()); panel1.add(capture, BorderLayout.NORTH); panel1.add(new Label("请输入对应的文件名:"), BorderLayout.WEST); panel1.add(num, BorderLayout.CENTER); panel1.add(save, BorderLayout.SOUTH); add(panel1, BorderLayout.CENTER); add(imgpanel, BorderLayout.SOUTH); } catch (Exception e) { e.printStackTrace(); } } ..... 错误提示: di=null java.lang.NullPointerException at CamApplet.<init>(CamApplet.java:96) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at sun.applet.AppletPanel.createApplet(Unknown Source) at sun.plugin.AppletViewer.createApplet(Unknown Source) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) ?? |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |