In lab today: Homework 07. 

Tomorrow: Homework 08. 

Next week: Exam 03. 

Right now: abstract classes and interfaces.

Before, though: Stages 02, 03 in Semester Project. 

Read the instructions in Canvas and download the .jar file. 

JAR means Java ARchive. 

Tomorrow we also establish what you need to study for Exam 03:

  (a), (b)  processing mouse events
  (c)       processing key events
  (d)       keeps and reports time 
  (e), (f)  sorting with Comparable and Comparator 
  (g)       shortest program that demonstrates how to use Exceptions       
  (h)       shortest program that demonstrates Graphics
  (i)       shortest program that demonstrates GUIs with JLabel, JButton, JTextField

import javax.swing.JFrame; 

public class Program extends JFrame {
  public Program() {
    this.setSize(400, 400); 
    this.setVisible(true); 
  }
  public static void main(String[] args) {
    JFrame a = new Program();  
  }
}

Starting tomorrow I will bug you to prepare for the final. 

For the final you need to build a list of relevant things (skills) that
you learned from the textbook. They should be non-trivial and they should
match the chapters. Then I will randomly select a few for your final. Thus
your final will be customized. 

import javax.swing.JFrame; 

public class Program extends JFrame {
  public Program() {
    this.setSize(400, 400); 
    this.setVisible(true); 
  }
  public static void main(String[] args) {
    JFrame a = new Program();  
    Screen b = new Screen(); 
    b.addMouseMotionListener(b); 
    b.addMouseListener(b); 
    a.add(b); 
  }
}

import javax.swing.JComponent;
import java.awt.event.MouseMotionListener; 
import java.awt.event.MouseListener; 
import java.awt.event.MouseEvent; 
import java.awt.Graphics; 

public class Screen extends JComponent implements MouseListener, MouseMotionListener {
  int x = 100, y = 200; 
  public void mouseDragged(MouseEvent e) { 
    int x = e.getX(), y = e.getY(); 
    // System.out.println("Mouse moved: (" + x + ", " + y + ")"); 
    this.x = x; 
    this.y = y; 
    this.repaint(); 
  }
  public void mouseMoved(MouseEvent e) { }
  // https://docs.oracle.com/javase/8/docs/api/java/awt/event/MouseListener.html
  public void mouseEntered(MouseEvent e) { }
  public void mouseExited(MouseEvent e) { }
  public void mousePressed(MouseEvent e) { }
  public void mouseReleased(MouseEvent e) { }
  public void mouseClicked(MouseEvent e) { }  
  public void paintComponent(Graphics g) {
    g.drawString("What's up?", this.x, this.y);  
  }
}

Ben Nariman Chun Mary Murun JeVante Qi Zack Sai Yuying 
Dustin Namit Sunghyun Grant Chase Jiongran Michael LaBrian 
Peter W Daohui Emma Stephen K

See you in lab!

--