Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
easyCam.java
Package: DSP-C6000-DM642DEMO.rar [view]
Upload User: dahaojd
Upload Date: 2008-01-29
Package Size: 14357k
Code Size: 2k
Category:
DSP program
Development Platform:
C/C++
- import java.awt.*;
- import java.applet.*;
- import java.net.*;
- public class easyCam extends Applet {
- private Image myImage = null;
- private int startIndex = 1;
- private int endIndex = 9;
- private int currentIndex;
- private int sleepTime = 500;
- private String fileBase;
- private String fileExtension;
- private Thread timerThread;
- private volatile boolean noStopRequested;
- private MediaTracker tracker;
- public void init() {
- tracker = new MediaTracker(this);
- String strStartIndex = getParameter("STARTINDEX");
- String strEndIndex = getParameter("ENDINDEX");
- String strSleepTime = getParameter("MSDELAY");
- fileBase = getParameter("FILEBASE");
- fileExtension = getParameter("FILEEXT");
- if (strStartIndex != null)
- startIndex = Integer.parseInt(strStartIndex);
- if (strEndIndex != null)
- endIndex = Integer.parseInt(strEndIndex);
- if (strSleepTime != null)
- sleepTime = Integer.parseInt(strSleepTime);
- startThread();
- }
- private void startThread() {
- noStopRequested = true;
- Runnable r = new Runnable() {
- public void run() {
- runWork();
- }
- };
- timerThread = new Thread(r, "Timer");
- timerThread.start();
- }
- private void stopThread() {
- noStopRequested = false;
- timerThread.interrupt();
- }
- private void runWork() {
- currentIndex = startIndex;
- boolean imageload = false;
- try {
- while ( noStopRequested ) {
- currentIndex = currentIndex + 1;
- if( currentIndex > endIndex )
- currentIndex = startIndex;
- if( imageload == true ) {
- tracker.removeImage(myImage);
- myImage.flush();
- myImage = null;
- }
- myImage = getImage(getDocumentBase(), fileBase + Integer.toString(currentIndex) + fileExtension);
- tracker.addImage(myImage, 0);
- tracker.waitForAll();
- imageload = true;
- repaint();
- Thread.sleep( sleepTime );
- }
- } catch ( InterruptedException x ) {
- Thread.currentThread().interrupt();
- }
- }
- public void paint(Graphics g) {
- update(g);
- }
- public void update(Graphics g) {
- if( myImage != null ) {
- g.drawImage(myImage, 0, 0, this);
- }
- }
- public void destroy() {
- stopThread();
- myImage.flush();
- myImage = null;
- }
- }