FileDocCategorySizeDatePackage
SunVideoPlusManual.javaAPI DocJMF 2.1.1e15706Mon May 12 12:20:34 BST 2003None

SunVideoPlusManual

public class SunVideoPlusManual extends Frame

Fields Summary
private static String
DEVICE_PREFIX
CaptureDeviceInfo[]
devices
int
currentID
Constructors Summary
public SunVideoPlusManual()

    
      
	super("SunVideoPlus");

	Font lblFont = new Font("Dialog", Font.BOLD + Font.ITALIC, 12);
	setLayout(new BorderLayout());
	BorderPanel bp = new BorderPanel();
	bp.setLayout(new BorderLayout(0, 0));

	Panel p = new Panel();
	p.setLayout(new FlowLayout(FlowLayout.LEFT));
	Label lbl = new Label("Configure Capture Devices");
	lbl.setFont(lblFont);
	p.add(lbl);
	bp.add(BorderLayout.NORTH, p);

	p = new Panel();
	p.setLayout(new FlowLayout());

	int nDevices = 0;
	for (int i = 0; i < 10; i++) {
	    File fl = new File(DEVICE_PREFIX + i);
	    if (fl.exists()) {
		Button device = new Button(DEVICE_PREFIX + i);
		p.add(device);
		device.addActionListener( new DBListener(i) );
		nDevices++;
	    }
	}
	bp.add(BorderLayout.CENTER, p);
	add(BorderLayout.NORTH, bp);

	devices = new CaptureDeviceInfo[nDevices];

	p = new Panel();
	p.setLayout(new FlowLayout());
	Button bDone = new Button("Done");
	bDone.addActionListener( new ActionListener() {
	    public void actionPerformed(ActionEvent ae) {
		if (currentID != -1) {
		    System.err.println("Need to close other window first");
		    return;
		}
		dispose();
		System.exit(0);
	    }
	} );
	p.add(bDone);
	add(BorderLayout.SOUTH, p);

	pack();
	addWindowListener( new WindowAdapter() {
	    public void windowClosing(WindowEvent we) {
		if (currentID != -1) {
		    System.err.println("Need to close other window first");
		    return;
		}
		dispose();
		System.exit(0);
	    }
	} );
    
Methods Summary
public voidcreateDialog(int id)

	if (currentID == id)
	    return;
	currentID = id;
	Thread t = new Thread( new Runnable() {
	    public void run() {
		FormatsDialog fd = new FormatsDialog(currentID);
		fd.setVisible(true);
		Vector cdiv = fd.getDeviceInfo();
		if (cdiv != null && cdiv.size() > 0) {
		    for (int i = 0; i < cdiv.size(); i++) {
			CaptureDeviceInfo cdi = 
					(CaptureDeviceInfo) cdiv.elementAt(i);
			// At the moment, the name and locator are identical
			System.err.println("CaptureDeviceInfo = "
						+ cdi.getName());
//			System.err.println("CaptureDeviceInfo = "
//						+ cdi.getName() + " "
//						+ cdi.getLocator());
		    }
		}
		
		currentID = -1;
	    }
	} );
	t.start();
	// Create a CaptureDeviceInfo....
    
public static voidmain(java.lang.String[] args)

	SunVideoPlusManual m = new SunVideoPlusManual();
	m.setVisible(true);