mastan
integration of webcam
3 Answer(s)      6 years and 8 months ago
Posted in : Applet
Advertisement
View Answers

January 5, 2009 at 7:01 AM


Hi friend,

import java.awt.*;

import java.applet.*;

import java.net.*;





public class JavaCam extends Applet implements Runnable{



boolean boolean_Debug;

Image image_WebcamImage;

Thread thread_This;

int int_Interval;



public static void main(String args[]) {

System.out.println("Webcam32's JavaCam: V1.1");

}


public void trace(String message) {

if (boolean_Debug){
System.out.println(message);

}

}



public void destroy() {

trace("Applet.destroy() called");

thread_This.stop();

}



public void start() {

trace("Start called");

thread_This.resume();

}



public void stop(){

trace("Stop called");

thread_This.suspend();



}

public void run(){
trace("run(): Thread started!");
while (true){
try{
// Put the refresh thread to sleep for the supplied interval
Thread.sleep(int_Interval*1000);
trace("Flushing image");
// Flush the image in the image buffer so we get a new one
image_WebcamImage.flush();
// Track the image and wait till its loaded
MediaTracker mt = new MediaTracker(this);
mt.addImage(image_WebcamImage, 1);
mt.waitForID(1);
// Repaint the image
repaint();
}
catch (Exception e){
trace("Caught:"+e.toString());
}
}

}


January 5, 2009 at 7:02 AM


public void init() {

String string_Url;

URL url_Webcam;

int int_Port;



boolean_Debug = false;

if (getParameter("Trace") != null) {

boolean_Debug = true;

}


trace("Init called");
string_Url = getParameter("URL");

if (string_Url == null) {
showStatus("No URL for Webcam32 image supplied");
return;

}

try{
int_Interval = Integer.parseInt(getParameter("Interval"));

}

catch (Exception e){


int_Interval = 30;

}

trace("Refresh interval="+int_Interval);



try{

url_Webcam = new URL("logo.jpg");
//url_Webcam = new URL(string_Url);

trace("Target URL="+"logo.jpg".toString());

image_WebcamImage = getImage(url_Webcam);

MediaTracker mt = new MediaTracker(this);

mt.addImage(image_WebcamImage, 1);

mt.waitForID(1);

}



catch(Exception e){

trace("Image get exception:"+e.toString());

showStatus("Problem getting initial image: "+e.toString());

return;

}



thread_This = new Thread(this);

thread_This.suspend();

thread_This.start();



}



public void paint(Graphics g){

trace("paint()");

if (image_WebcamImage != null) {
g.drawImage(image_WebcamImage, 0,0, this);
}
}
}


January 5, 2009 at 7:04 AM


<HTML>
<BODY>
<div align = "center">
<APPLET code="JavaCam.class" width=320 height=240>
<PARAM name="url" value="logo.jpg">
<PARAM name="interval" value="10">
</APPLET>
</div>
</BODY>
</HTML>


----------------------------------------------

Visit for more information:

http://www.roseindia.net/java/example/java/applet/

Thanks.









Related Tutorials/Questions & Answers:
java webcam integration
java webcam integration  Hi Folks, We need some pointers on how to implement webcam integration with our java based application. Our objective is to capture picture and record video through webcame from JSP page. Then save
integration of webcam - Applet
integration of webcam  Hello sir, I have a small problem...() { String string_Url; URL url_Webcam; int int_Port; boolean_Debug..._Webcam = new URL("logo.jpg"); //url_Webcam = new URL(string_Url); trace
Advertisements
how to connect webcam in html
how to connect webcam in html  how to connect webcam in html.emphasized text
Accessing webcam in jsp
Accessing webcam in jsp  Hi Friends, I have to access the webcam through jsp and display the snap in same jsp taken after a click. I am using java media framework but i am not able to detect the device using CaptureDeviceManager
JMF WebCam detection problem - Framework
JMF WebCam detection problem  Hello friends, I am using JMF to operate my web cam.My usb webcam works perfectly with JMF, I used it in JMStudio... = CaptureDeviceManager.getDeviceList( null ); my USB "webcam" is detected however when i
How to capture picture from webcam using java
How to capture picture from webcam using java  i want catch the image from web-cam using jsp, If anyone knows please answer me
Integration Libraries
Integration Libraries Java Database Connectivity (JDBC) API Using this API, you can fetch the data from databases, Flat files or Spread sheet. Remote Method Invocation (RMI) Using this API, you can create distributed java
What is Spring Integration?
What is Spring Integration?  Hi, What is Spring Integration? Thanks
Integration Struts Spring Hibernate.
Integration Struts Spring Hibernate.  Integration Struts Spring Hibernate
struts hibenate integration - Hibernate
struts hibenate integration  struts hibernate integration
how to start intergrated webcam of a laptop without calling its exe file using java only - Java Beginners
how to start intergrated webcam of a laptop without calling its exe file using java only  how to open integrated webcam of a laptop without calling its exe file using java only?.simply what i am asking is that is there any method
Flex integration tools
Flex integration tools  Hi... I want to know What kind of source code integration tools are available with Flex? please tell me ASAP........ Thanks
spring with hibernate integration
spring with hibernate integration   how can i update and search operations in one method by using multiaction controller
Spring3 integration with Struts2
Spring3 integration with Struts2  Hi, How I can Integrate Spring3 with Struts2? Give me full code or a running project. Thanks
Enterprise Application Integration - Enterprise Application Integration EAI,EAI,Enterprise Application Integration software
EAI- Enterprise Application Integration Enterprise Application Integration or EAI for short is integration technology. EAI is a buzzword that represents the task of integration of various applications so that they may
Integration of spring with hibernate - Framework
Integration of spring with hibernate  org.hibernate.LazyInitializationException: could not initialize proxy - no Session. This is the error I am getting. I would like to know why we will get this kind of error at all? And like
hibernate and struts integration in ECLIPSE
hibernate and struts integration in ECLIPSE  hi, I saw the complete tutorial of hibernate in your website... But i found nothing for hibernate and struts integration in ECLIPSE and not using ANT Can any One pls Help.. Thanks
Hibernate Struts Integration
In this section, you will learn Hibernate Struts Integration
Hibernate Spring Integration
In this section, you will learn how to Integration Hibernate with Spring
spring with hibernate integration
spring with hibernate integration   i want code for update and find operation how can i update and search operations in one method by using multiaction controller?   Please visit the following link: http
Struts - Hibernate Integration
link: Struts Hibernate Integration Thanks
struts and hibernate integration
struts and hibernate integration  i want entire for this application using struts and hibernate integration here we have to use 4 tables i.e... the following link: Struts Hibernate Integration
The Flash JavaScript Integration Kit
The Flash JavaScript Integration Kit       The Flash JavaScript Integration Kit allows for the integration of JavaScript and Flash content and enables JavaScript to invoke ActionScript
struts hibernate integration application
Struts2 hibernate integration application. In this tutorial we are going... hibernate integration application will use hbm.xml for mapping metadata. You can also use annotation as mapping metadata. About struts hibernate integration
Struts2.2.1 and hibernate integration application
Struts2.2.1 and hibernate integration application AddInforForm.jsp Description When first time this module is loaded it fetch value from database...: gray;"> Struts2+Hibernate Integration Application </h2> <hr/>
Problem in integration struts+ spring - Framework
Problem in integration struts+ spring  Problem in integration struts+ spring hi, i am facing problem in integration struts+ spring. I am also using jstl tag. web.xml Test action org.apache.struts.action.ActionServlet config /WEB
Struts 2 Integration with Struts 1
Struts 2 Integration with Struts 1  I want to integrate struts 2 with struts 1 existing application. Can you please help on how to go about this. I am not finding any good source to integrate struts 2 with struts 1 framework
PayPal integration in iPhone native app
PayPal integration in iPhone native app  I am looking for some help in integrating the paypal in iPhone application. Please help. Thanks.   Instead of integrating the paypal into the app .. you can open it within
Integration of velocity with struts 2.0 - Struts
Integration of velocity with struts 2.0  Hi , I am going to implement Struts 2 with Velocity. Is there any plugin available? I am totally new to velocity. Please tell the steps to integrate Struts 2 and velocity
Paypal integration to my website - Struts
Paypal integration to my website  Hi there, I am working on paypal.My question is....I have one webiste and in that I kept a button called Buy Now and if I click that it will redirect to paypal website,that is fine I