public class LiveCam extends Applet implements Runnable, ActionListener{ Image img; Thread liveThread; int timeInterval=500; String time=""; protected static Button BStop = new Button("Stop"); protected static Button BStart = new Button("Start"); public void run() { while (true) { try { Thread.sleep(timeInterval); ImageIO.setUseCache(false); URL url = new URL ("http://localhost/live.jpg"); InputStream input = new BufferedInputStream (url.openStream ()); img = ImageIO.read(input); System.out.println(img); repaint(); input.close(); } catch (Exception e) { System.out.println("Caught:"+e.toString()); } } } public void init() { setComponents(); try { img = ImageIO.read( new URL("http://localhost/__live.jpg")); } catch(Exception e) { showStatus("Problem getting initial image: "+e.toString()); return; } } public void paint(Graphics g) { try { DateFormat dateInstance = DateFormat.getDateTimeInstance(); time = dateInstance.format( new Date() ); } catch ( Exception e ) { e.printStackTrace(); } g.drawImage(img, 0,0, this); g.drawString("Time:", 10,300); g.drawString(time, 45,300); } }