⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 drawimageapplet.java

📁 webcam written by others that is using JMF to capture the screen to the browser using java applet an
💻 JAVA
字号:
import java.awt.*;
import java.awt.image.*;
import javax.imageio.ImageIO; 
import javax.swing.JApplet;
import java.net.URL;

public class drawImageApplet extends JApplet implements Runnable{

	
	private Image img;
    private Thread myThread;
    
    
	public void init(){

	        try{
                
				img=ImageIO.read(new URL("http://localhost:8080/WebCamServlet/webcam"));
				
			}catch(Exception e){}
	}

	public void start(){
		
			myThread= new Thread(this);
			myThread.start();
				
	}

	public void run(){

		while(true){
		
                try{
                
					img=ImageIO.read(new URL("http://localhost:8080/WebCamServlet/webcam"));
				
				}catch(Exception e){}
				
					repaint();
						
		    try{
		    	
		    	Thread.sleep(33);
		    
		    }catch(Exception e){}
			 
			 
			          
		}		
	

		}	
		
	
	public void paint(Graphics g) {
		
		g.drawImage(img, 0, 0, this);

	}

	public void update(Graphics g) {
		
		paint(g);
	}


		
}	


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -