CSE116 Introduction to Computer Science II Fall 2000 Lab 2 Labs are to be completed within the week in which it is allocated and shown to the TA who teaches the lab to you. Goals: 1. Learn to design and implement graphical user interface (GUI) using Java 2 Swing. 2. Study and understand event handling methods (delgation model). 3. Use inner classes. 1. Create a new directory tree cse116/lab/lab2 in your home directory. 2. Copy ~bina/cse116/fall2000/lab/lab2/Calculator.java into your lab2 directory. 3. Calculator.java represents the example given during lecture class. Study the program. 4. Compile, execute and observe its operation. 5. The given Calculator application has only add and subtract operations. Add two more operatio, division and multiplication. Modify the calculator.java class to include components and handlers to carry out the operations. Let the button represented by Division be handled by anonymous class/object and that of multiplication by a named action handler inner class. compile, debug, execute and observe operation. 6. Project 1 needs a "combo box" like component. An example for this is available at /projects/bina/ddjava2/examples/ch12/fig12_14/ListTest.java Copy it into your lab2 directory, study the code, compile, execute and observe operation. 7. A single handler class can handle many action events. See an example for this in /projects/bina/ddjava2/examples/ch12/fig12_07/TextFieldTest.java Copy this into your directory, study it, compile, execute and observe operation. 8. How will you clear the fields of the operands and the result in your caculator? Find out the solution for this task by looking at java API on line documentation. "browse" /util/lang/jdk1.2/docs/api/index.html or look at the source for many of these components in /util/lang/jdk1.2/src/javax/swing You may also want to look at the example in /projects/bina/ddjava2/examples/ch12 directory. Show your completed lab to your TA. ===============================================================