Howdy. 

This time next week we'll be back on EST (from EDT).

Elizabeth C, Chetan C, Joshua L-M, Menghan X, Nico P, Glenn K, 
Chad K, Chris C, Olivia P, Justin F, Kyle McW, Kyle R, Chris D, 
Jiahao Y, Kirk H, Yiqing S, Derek E, Graham H, Max T, Skylar M, 
Vaishali S, Jordan K, Mitch S, Nova R, Kendall N, DeAsis S, 
Younghun K, Magdalena L, Leanne M, Drake W, Sarah S, Yixuan W,
Quinton B, Mitchell T, Rui X, Yuanyuan T, Yichen R, 
                                         _
                         /\              )\
           _           __)_)__        .'`--`'.
           )\_      .-'._'-'_.'-.    /  ^  ^  \
        .'`---`'. .'.' /o\'/o\ '.'.  \ \/\/\/ /
       /  <> <>  \ : ._:  0  :_. : \  '------'       _J_
       |    A    |:   \\/\_/\//   : |     _/)_    .'`---`'.
       \  <\_/>  / :  :\/\_/\/:  : /   .'`----`'./.'0\ 0\  \
      _?_._`"`_.'`'-:__:__:__:__:-'   /.'<\   /> \:   o    |
   .'`---`'.``  _/(              /\   |:,___A___,|' V===V  /
  /.'a . a  \.'`---`'.        __(_(__ \' \_____/ /'._____.'
  |:  ___   /.'/\ /\  \    .-'._'-'_.'-:.______.' _?_
  \'  \_/   |:   ^    |  .'.' (o\'/o) '.'.     .'`"""`'.
   '._____.'\' 'vvv'  / / :_/_:  A  :_\_: \   /   ^.^   \
             '.__.__.' | :   \'=...='/   : |  \  `===`  /
          jgs           \ :  :'.___.':  : /    `-------`
                         '-:__:__:__:__:-'

Minute paper: what should be the project for the semester?

Announcements: 

(a) gradebook is very up to date 

(b) individual grade reports forthcoming 

(c) homework 07 posted, lab 10 this week soon

(d) we need to prepare for exam 03 next week

Look at Oct 18 under What's New? for what to study. 

There are 9 programs to discuss. 

We are looking for the shortest programs that illustrate a concept:

  -- mouse motion events

  -- mouse events

  -- key events

  -- keeping time 

  -- exceptions

  -- graphics 

  -- basic gui (button, label, tex field)

  -- sorting with Comparables

  -- sorting with Comparators

Let's start with:

http://silo.cs.indiana.edu:8346/04142012/001.html

https://www.cs.indiana.edu/classes/c212-dgerman/spr2015/labTwelve.html

import javax.swing.*;

public class Nine extends JFrame {
  JButton button;
  JLabel label; // = new JLabel("sdjkfhsd");
  JTextField textField; 
  public Nine() {
    this.button = new JButton(); 
    this.label = new JLabel(); 
    this.textField = new JTextField(); 
  }
  public void report() {
    System.out.println( this.button );  
    System.out.println( this.label );  
    System.out.println( this.textField );  
  }
  public static void main(String[] args) {
    Nine a = new Nine();  
    a.setVisible(true); 
    a.setSize(400, 400); 
    a.report(); 
  }
}

So this has all the elements inside, we just need to connect them. 

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

public class Nine extends JFrame implements ActionListener {
  public void actionPerformed(ActionEvent e) {
    System.out.println( e ); 
  }
  JButton button;
  JLabel label; // = new JLabel("sdjkfhsd");
  JTextField textField; 
  public Nine() {
    this.button = new JButton(" Push me now. "); 
    this.button.addActionListener( this ); 
    this.label = new JLabel(" How are you? "); 
    this.textField = new JTextField(); 
    this.add( label ); 
    this.add( button ); 
  }
  public void report() {
    System.out.println( this.button );  
    System.out.println( this.label );  
    System.out.println( this.textField );  
  }
  public static void main(String[] args) {
    Nine a = new Nine();  
    a.setVisible(true); 
    a.setSize(400, 400); 
    a.report(); 
  }
}

Some of the elements are visible now and they are live. 

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

public class Nine extends JFrame implements ActionListener {
  int count; // = 0;
  public void actionPerformed(ActionEvent e) {
    // System.out.println( e ); 
    this.count += 1;
    this.label.setText( "Count: " + this.count ); 
  }
  JButton button;
  JLabel label; // = new JLabel("sdjkfhsd");
  JTextField textField; 
  public Nine() {
    this.button = new JButton(" Push me now. "); 
    this.button.addActionListener( this ); 
    this.label = new JLabel(" How are you? "); 
    this.textField = new JTextField(); 
    JPanel panel = new JPanel(); // get a panel (flow layout)
    panel.add( label ); 
    panel.add( button ); 
    this.add(panel); // add the panel to the frame 
  }
  public void report() {
    System.out.println( this.button );  
    System.out.println( this.label );  
    System.out.println( this.textField );  
  }
  public static void main(String[] args) {
    Nine a = new Nine();  
    a.setVisible(true); 
    a.setSize(400, 400); 
    // a.report(); 
  }
}

Now the end is up to you. 

Turn in minute papers now. 

--

http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html#setPreferredSize(java.awt.Dimension)

https://www.cs.indiana.edu/classes/c212-dgerman/spr2015/labTwelve.html