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

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- 王朝網路 版權所有