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

📄 capturethread.java

📁 java开发的netbeans插件中的application原型
💻 JAVA
字号:
/*
 * CaptureThread.java
 *
 * Created on 2006年11月24日, 下午11:31
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package cn.edu.tsinghua.thss.talkie.capture;

import cn.edu.tsinghua.thss.talkie.connect.Connect;
import java.awt.image.BufferedImage;

/**
 *
 * @author promenade
 */
public class CaptureThread implements Runnable {
    
    BufferedImage screen = null;
    Capturer capturer = null;
    Connect connection = null;

    /** Creates a new instance of CaptureThread */
    public CaptureThread( Connect connection ) {
        capturer = new Capturer();
        this.connection = connection;
        ( new Thread(this,"capture Thread") ).start();
    }
    
    public void run() {
        long time;
        while( !Thread.currentThread().interrupted() ){
            time = System.currentTimeMillis();
            System.out.print("Start capturing...");
            screen = capturer.capture();
            time = System.currentTimeMillis()-time;
            System.out.print( time + " milliseconds used to capture");
            
            time = System.currentTimeMillis();
            connection.sendImage( screen );
            time = System.currentTimeMillis()-time;
            System.out.println( time + " milliseconds used to send");
            
//            try {
//                Thread.sleep( 1000 );
//            } catch (InterruptedException ex) {
//                ex.printStackTrace();
//            }
        }
    }
    
}

⌨️ 快捷键说明

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