| 導購 | 订阅 | 在线投稿
分享
 
 
 

JMF驱动问题

2006-04-19 14:25:04  編輯來源:互聯網  简体版  手機版  評論  字體: ||
 
  下面是一段捕获摄像头数据的程序(运行成功),我想捕获显示器的数据应该怎么办,str2是摄像头驱动的名字,那显示器驱动的名字是什么?

  各位大侠请指教,小弟先谢谢了

  import javax.media.*;

  import java.awt.event.*;

  import java.awt.*;

  public class SpJieKou {

  public static Player player;

  private CaptureDeviceInfo di;

  private MediaLocator ml;

  String str2 = "vfw:Microsoft WDM Image Capture (Win32):0";

  public SpJieKou(){

   try{

   di = CaptureDeviceManager.getDevice(str2);

   ml = di.getLocator();

   player = Manager.createRealizedPlayer(ml);

   player.start();

   }catch(Exception e){

   e.printStackTrace();

   }

  }//end

  

  void go(){

   HqFrame fr = new HqFrame();

   Component comp;

   if ((comp = player.getVisualComponent()) != null)

   {

   fr.add(comp, BorderLayout.CENTER);

   fr.setVisible(true);

   }

  }//end

  

  public static void main(String[] args) {

  

   SpJieKou sss = new SpJieKou();

   sss.go();

  }//end

  }

  //YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY

  class HqFrame extends Frame {

  

   public HqFrame() {

   MenuBar menuBar = new MenuBar();

   Menu menuFile = new Menu();

   MenuItem menuFileExit = new MenuItem();

  

   menuFile.setLabel("File");

   menuFileExit.setLabel("Exit");

  

   menuFileExit.addActionListener

   (

   new ActionListener() {

   public void actionPerformed(ActionEvent e) {

   HqFrame.this.windowClosed();

   }

   }

   );

  

   menuFile.add(menuFileExit);

   menuBar.add(menuFile);

   setTitle("Hq");

   setMenuBar(menuBar);

   setSize(new Dimension(450, 400));

  

  

   this.addWindowListener

   (

   new WindowAdapter() {

   public void windowClosing(WindowEvent e) {

   HqFrame.this.windowClosed();

   }

   }

   );

   }

   protected void windowClosed() {

  

   System.exit(0);

   }

  }
 
 
 
下面是一段捕获摄像头数据的程序(运行成功),我想捕获显示器的数据应该怎么办,str2是摄像头驱动的名字,那显示器驱动的名字是什么? 各位大侠请指教,小弟先谢谢了 import javax.media.*; import java.awt.event.*; import java.awt.*; public class SpJieKou { public static Player player; private CaptureDeviceInfo di; private MediaLocator ml; String str2 = "vfw:Microsoft WDM Image Capture (Win32):0"; public SpJieKou(){ try{ di = CaptureDeviceManager.getDevice(str2); ml = di.getLocator(); player = Manager.createRealizedPlayer(ml); player.start(); }catch(Exception e){ e.printStackTrace(); } }//end void go(){ HqFrame fr = new HqFrame(); Component comp; if ((comp = player.getVisualComponent()) != null) { fr.add(comp, BorderLayout.CENTER); fr.setVisible(true); } }//end public static void main(String[] args) { SpJieKou sss = new SpJieKou(); sss.go(); }//end } //YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY class HqFrame extends Frame { public HqFrame() { MenuBar menuBar = new MenuBar(); Menu menuFile = new Menu(); MenuItem menuFileExit = new MenuItem(); menuFile.setLabel("File"); menuFileExit.setLabel("Exit"); menuFileExit.addActionListener ( new ActionListener() { public void actionPerformed(ActionEvent e) { HqFrame.this.windowClosed(); } } ); menuFile.add(menuFileExit); menuBar.add(menuFile); setTitle("Hq"); setMenuBar(menuBar); setSize(new Dimension(450, 400)); this.addWindowListener ( new WindowAdapter() { public void windowClosing(WindowEvent e) { HqFrame.this.windowClosed(); } } ); } protected void windowClosed() { System.exit(0); } }
󰈣󰈤
 
 
 
>>返回首頁<<
 
 
 
 
 
 熱帖排行
 
 
王朝网络微信公众号
微信扫码关注本站公众号 wangchaonetcn
 
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味著赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有