public MyCaptureDeviceInfo[] autoDetect ( )
    {
        Vector list = CaptureDeviceManager.getDeviceList ( null );
        System.out.println(list.toString());
        CaptureDeviceInfo devInfo = null;
        String name;
        Vector capDevices = new Vector();

        if ( list != null )
        {

            for ( int i=0; i<list.size(); i++ )
            {
                devInfo = (CaptureDeviceInfo)list.elementAt ( i );
                name = devInfo.getName();

                if ( name.startsWith ("vfw:") )
                {
                    System.out.println ("DeviceManager List : " + name );
                    capDevices.addElement ( new MyCaptureDeviceInfo ( devInfo ) );
                }
            }
        }
        else
        {
            for ( int i = 0; i < 10; i++ )
            {
                try
                {
                    name = VFWCapture.capGetDriverDescriptionName ( i );
                    if (name != null && name.length() > 1)
                    {
                        devInfo = com.sun.media.protocol.vfw.VFWSourceStream.autoDetect ( i );
                        if ( devInfo != null )
                        {
                            System.out.println ("VFW Autodetect List : " + name );
                            capDevices.addElement ( new MyCaptureDeviceInfo ( devInfo ) );
                        }
                    }
                }
                catch ( Exception ioEx )
                {

                    System.err.println ("Error connecting to [" + webCamDeviceInfo.getName() + "] : " + ioEx.getMessage() );

                    // ignore errors detecting device
                    statusBar.setText ( "AutoDetect failed : " + ioEx.getMessage() );
                }
            }
        }

        MyCaptureDeviceInfo[] detected = new MyCaptureDeviceInfo[ capDevices.size() ];
        for ( int i=0; i<capDevices.size(); i++ )
        {
            detected[i] = (MyCaptureDeviceInfo)capDevices.elementAt ( i );
        }

        return ( detected );
    }