* mahazuga: Mary Ann
* serepate: Serena
  hgarciah: Henri
* balbakr: Bakr
* ruifan: Rui
* mzelenin: Matthew
* jnp2: Jay
* zeyang: Zejun
* zhang486: Jingyun
  yiwecao: Yiwei
* rthammon: Ryan
* wang686: Jiaxing
* dweissma: Andrew
* kevcao: Kevin
  ssalmero: Salmeron, Santiago (TA)
* luo23: Yawen
* runxzhao: Runxia
* dgerman: German, Dan-Adrian (Primary Instructor)
  creba: Chris

In lecture today: Stage 01 of Semester Project.

In lab today: 

  (a) finish setting up Tomcat 

  (b) Homework 09

  (c) Exam 03 (moved to Thursday morning from Wednesday) 

--

Homework 10: BigBang, two games. 

Homework 11: BST, Graphs. 

--

Poll: Exam 03 review, Homework 09 ...

Homework 09:

(a) download the .jar files to the desktop 

(b) open a command line window/prompt: cmd

(c) move into the folder where you saved these

(d) unpack them with jar xvf *.jar but first 

C:\Users\dgerman\Desktop>PATH="C:\Program Files\Java\jdk1.8.0_162\bin";%PATH%

(e) Please unpack, run, unpack, run. 

--

https://www.cs.indiana.edu/classes/c212-dgerman/spr2012/classNotes/chapter10.html

https://www.cs.indiana.edu/classes/c212-dgerman/spr2012/classNotes/ch10/Example.java

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

public class Example extends JFrame implements ActionListener 
{  private JLabel nameJLabel, ageJLabel; 
   private JTextField nameJTextField, ageJTextField, totalResultJTextField;
   private JButton calculateJButton;
   public Example() 
   {  Container contentPane = getContentPane(); 
      contentPane.setLayout( null );            
      nameJLabel = new JLabel();             
      nameJLabel.setText( "Please enter your name: " );
      nameJLabel.setBounds( 16, 16, 160, 21 );
      contentPane.add( nameJLabel );
      nameJTextField = new JTextField(); 
      nameJTextField.setBounds( 170, 16, 70, 21 );
      nameJTextField.setHorizontalAlignment( JTextField.RIGHT );
      nameJTextField.setText("Laura"); 
      contentPane.add( nameJTextField );
      ageJLabel = new JLabel(); 
      ageJLabel.setText( "How old are you (in years)?" );
      ageJLabel.setBounds( 16, 48, 164, 21 );
      contentPane.add( ageJLabel );
      ageJTextField = new JTextField(); 
      ageJTextField.setText( "8" );
      ageJTextField.setBounds( 200, 48, 40, 21 );
      ageJTextField.setHorizontalAlignment( JTextField.RIGHT );
      contentPane.add( ageJTextField );
      totalResultJTextField = new JTextField(); 
      totalResultJTextField.setBounds( 244, 16, 186, 21 );
      totalResultJTextField.setHorizontalAlignment( JTextField.RIGHT );
      totalResultJTextField.setEditable( false ); 
      contentPane.add( totalResultJTextField );
      calculateJButton = new JButton(); 
      calculateJButton.setText( "Calculate Total" );
      calculateJButton.setBounds( 304, 48, 126, 24 );
      contentPane.add( calculateJButton ); 
      calculateJButton.addActionListener( this ); 
      setTitle( "Inventory" );
      setSize( 454, 132 );    
      setVisible( true );     
   } 
   public void actionPerformed(ActionEvent e) 
   {  String name = this.nameJTextField.getText(), age = this.ageJTextField.getText(); 
      this.totalResultJTextField.setText( name + " you will be " + (Integer.parseInt(age) + 1) + " next year."); 

   }
   public static void main( String[] args ) 
   {  Example application = new Example();
      application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
   }


After walking through it a bit:

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

public class Example extends JFrame implements ActionListener 
{
   private JLabel nameJLabel, ageJLabel; 
   private JTextField nameJTextField, ageJTextField, totalResultJTextField;
   private JButton calculateJButton;

   public Example() 
   {
      Container contentPane = getContentPane(); 

      contentPane.setLayout( null );            

      nameJLabel = new JLabel();             
      nameJLabel.setText( "Please enter your name: " );
      nameJLabel.setBounds( 16, 16, 160, 21 );

      contentPane.add( nameJLabel );

      nameJTextField = new JTextField(); 
      nameJTextField.setBounds( 170, 16, 70, 21 );
      nameJTextField.setHorizontalAlignment( JTextField.RIGHT );
      nameJTextField.setText("Laura"); 

      contentPane.add( nameJTextField );

      ageJLabel = new JLabel(); 
      ageJLabel.setText( "How old are you (in years)?" );
      ageJLabel.setBounds( 16, 48, 164, 21 );

      contentPane.add( ageJLabel );

      ageJTextField = new JTextField(); 
      ageJTextField.setText( "8" );
      ageJTextField.setBounds( 200, 48, 40, 21 );
      ageJTextField.setHorizontalAlignment( JTextField.RIGHT );

      contentPane.add( ageJTextField );

      totalResultJTextField = new JTextField(); 
      totalResultJTextField.setBounds( 244, 16, 186, 21 );
      totalResultJTextField.setHorizontalAlignment( JTextField.RIGHT );
      totalResultJTextField.setEditable( false ); 

      contentPane.add( totalResultJTextField );

      calculateJButton = new JButton(); 
      calculateJButton.setText( "Calculate Total" );
      calculateJButton.setBounds( 304, 48, 126, 24 );

      contentPane.add( calculateJButton ); 

      calculateJButton.addActionListener( this ); 

      setTitle( "Inventory" );
      setSize( 454, 132 );    
      setVisible( true );   
  
   } 
   public void actionPerformed(ActionEvent e) 
   {  String name = this.nameJTextField.getText(), age = this.ageJTextField.getText(); 
      this.totalResultJTextField.setText( name + " you will be " + (Integer.parseInt(age) + 1) + " next year."); 

   }
   public static void main( String[] args ) 
   {  Example application = new Example();
      application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
   }


--

In GitHub post stages of your code.

Here's my help for Homework 09 that does that:

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

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

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

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

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

and so on ... 

--


C:\Users\dgerman\Desktop>javac Two.java
Two.java:13: error: cannot find symbol
    totalLabel.setText( "" + Math.sqrt( Double.parseDouble( numberTextField.getText() )));
                                                            ^
  symbol:   variable numberTextField
  location: class Two
Two.java:13: error: cannot find symbol
    totalLabel.setText( "" + Math.sqrt( Double.parseDouble( numberTextField.getText() )));
    ^
  symbol:   variable totalLabel
  location: class Two
2 errors

C:\Users\dgerman\Desktop>javac Two.java

C:\Users\dgerman\Desktop>java Two
java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=Calculate,when=1531769673263,modifiers=Button1] on javax.swing.JButton[,100,100,100x20,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@7bde8c2b,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Calculate,defaultCapable=true]
java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=Calculate,when=1531769695708,modifiers=Button1] on javax.swing.JButton[,100,100,100x20,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@7bde8c2b,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Calculate,defaultCapable=true]

C:\Users\dgerman\Desktop>javac Two.java

C:\Users\dgerman\Desktop>java Two
 kieo;wry34rt
 kieo;wry34rt
 kieo;wry34rt
 kieo;wry34rt
 kieo;wry34rt
 kieo;wry34rt
 kieo;wry34rt
 kieo;wry34rt

C:\Users\dgerman\Desktop>