下面是一段捕获摄像头数据的程序(运行成功),我想捕获显示器的数据应该怎么办,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);
}
}