Howdy. 

Homework Help Sessions have started. Sundays 2-4pm. 

Challenge: 

Design and implement the smallest shortest program that notices
the mouse position and reports it. (Be as loud as you need to as
you work with others or alone; feel free to use any resources you 
may have access to. Just solve the problem.) 

Haleigh, Erin, Ben, Michael, Brian, Danielle, Connor, Mahamat, Chen, 
Daniel, Grant, Minh, Nick Palumbo, Brandon, Joe, Kevin, Griffin, Vinayak
Shikun, Shane, Taylor, Phoebe. Also Nick Palmer (excused, medical reason). 

We had two people yesterday and we wrote a program. 

http://40.media.tumblr.com/tumblr_l7qhch8rBD1qd3n1to1_500.jpg

The program produces a face? What is a face? 

Homework Nine is asking the same question. 

A Face really has two eyes, a nose and a mouth. 

Lecture Nineteen posted since we saw each other. 

Lecture Notes Twenty also posted. 

Homework Eight finished almost. 

There's an exam next week: Homework Ten. 

Lab Twelve also posted discussed Java GUIs.

The lecture on Wed is going to help with that. 

Head-First Java chapter 13 has a GUI project. 

Lecture Twenty indicates what the complexity of a project stage should be.

For the project I want you to be able to design your own Big-Bang.

For that you need to know the basic atomic recipes:

(a) watching and reporting mouse events

(b) noticing and reporting key events

(d) setting up and working with timers 

(e) working with buttons and ActionEvents

(f) drawing various simple graphics 

(g) ... 

The new exam will ask you to prepare these.

Final Exam is on Fri may 8 2:45-4:45pm. 

Any conflicts? Let's schedule you earlier at your convenience.

Now let's solve the challenge.

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

public class Projector extends JComponent implements MouseMotionListener {
  public Projector() {
    this.addMouseMotionListener(this);  
  }
  public void paintComponent(Graphics g) {
    g.setColor(Color.BLUE); 
    g.drawOval(50, 50, 200, 200); 
  }
  public void mouseMoved(MouseEvent e) {
     int x = e.getX(), y = e.getY(); 
     System.out.println( "Mouse at (" + x + ", " + y + ")" ); 
  }
  public void mouseDragged(MouseEvent e) { }
}

import javax.swing.*; 

public class Challenge extends JFrame {
  public Challenge() {
    this.add( new Projector() ); 
    this.setVisible(true); 
    this.setSize(400, 400); 
    this.setDefaultCloseOperation( EXIT_ON_CLOSE ); 
  }
  public static void main(String[] args) {
    JFrame f = new Challenge();  
  }
}

--