1. Debug Chat, Iceblox, Lab 10

2. Project

3. Homework 08 Prototype

3. Exam on Wed

  mouse listener 
  mouse motion listener 
  keyboard events
  timer events
  gui (button, textfield, label, panel, layout)
  graphics (circle, jcomponent)
  sorting with comparable 
  sorting with comparators 
  exception example 

Write the shortest program that keeps time. 

Mitch Mitch Kirk 
Jordan Vaishali Menghan Alex Nico 
Drake Chad Jerry Tianqi Yuanyuan Younghun Chetan 
Magdalena Elizabeth Tobias Clarence Rui Yixuan 
Chris Max Levi Chris 
Nova Kendall Quinton Graham Yicheng Olivia 
Justin Kyle McW Leanne Yiqing Jiahao Derek

import javax.swing.Timer;
import java.awt.event.*;

public class One implements ActionListener {
  public void actionPerformed(ActionEvent e) {
    System.out.println("Time passes..."); 
  }
  public static void main(String[] args) {
    Timer t = new Timer(1000, new One()); 
    t.start(); 
  }
}

This program runs fine in DrJava but doesn't seem to start even by itself. 

import javax.swing.*;
import java.awt.event.*;

public class One implements ActionListener {
  public void actionPerformed(ActionEvent e) {
    System.out.println("Time passes..."); 
  }
  public static void main(String[] args) {
    Timer t = new Timer(1000, new One()); 
    System.out.println( t ); 
    t.start(); 
    JFrame f = new JFrame(); 
    // f.setVisible(true); 
    // f.setSize(300, 300); 
  }
}

This program does work by itself from the command prompt. 

--