Setting Videoformat problem in Applet

hi

I have webcam applet from JWebCam Example given in many fourms my problem is that the video format of my webcam is max 640 x 480

but the applet shows 340*240 only when i changed the format the image is stretch from 320 * 240 to 640* 480 so image qualtiy is very bad

i have to save this image also...

my code is:

publicboolean initialise ( CaptureDeviceInfo _deviceInfo )throws Exception

{

webCamDeviceInfo = _deviceInfo;

if ( webCamDeviceInfo !=null )

{

try

{

ml = webCamDeviceInfo.getLocator();

if ( ml !=null )

{

player = Manager.createRealizedPlayer ( ml );

if ( player !=null )

{

formatControl = (FormatControl)player.getControl ("javax.media.control.FormatControl" );

videoFormats = webCamDeviceInfo.getFormats();

System.out.println(videoFormats.length);

setFormat ((VideoFormat)videoFormats[0] );

visualComponent = player.getVisualComponent();

add(visualComponent);

invalidate();

}

}

return (true );

}

catch ( Exception ioEx )

{

System.out.println(ioEx);

return (false );

}

}

else

{

return (false );

}

}

publicvoid setFormat ( VideoFormat selectedFormat )

{

if ( formatControl !=null )

{

player.stop();

imageSize = selectedFormat.getSize();

formatControl.setFormat ( selectedFormat );

currentFormat = selectedFormat;

setSize ( imageSize.width, imageSize.height);

player.start();

}

else

{

System.out.println ("Visual component not an instance of FormatControl");

}

}

[3062 byte] By [VishnuAggarwala] at [2007-11-15]