ECE309Spring2010Lecture3

ECE309Spring2010Lecture3 - ECE309 - Lecture 3 - Spring 2010...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE309 - Lecture 3 - Spring 2010 - Tuesday January 19
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Lab2 TherapistGUI is due this Thursday Reading Assignment: Learn about Java Strings See Strings.html in JavaNotes on ECE309 Wolfware See String class methods in Java Class Library See about Strings in the Java Tutorial on-line at http://java.sun.com/docs/books/tutorial Today's topics prepare the student to program lab 2. How is everyone doing on Lab 2? What are your GUI questions? Personal items: Thomas Russel - is your NCSU e-mailbox still full? Michael Plautz - is your NCSU e-mailbox still full? In-class exercise: Write a simple GUI In-class exercise: Draw a storage map of lab 1 execution. A "call" is a branch (maybe in Lecture 4) IN-CLASS EXERCISE: Write a Java program that presents a simple GUI. Write a Java program called SimpleGUI. You may find it helpful to refer to your Lab2 code. (Or the Lab2 instructions if you have not yet started Lab2. ..)
Background image of page 2
This program will have a single GUI object: a text field. When the user types into the text field, your program will print the entered text on the console. 1. Since this program will have a GUI, can you provide your program code in the main() method? Why not? So do you need/want to provide a main() method? What code WILL you put in there? 2. Declare (and make) a graphics window. (Where will you put this declaration?) 3. Declare a text field. Show initial text "Enter something here". (How - take a guess - would be an easy way to show initial text? How could you tell if this would work without guessing?) 4. Add the text field to the window. (Where will you put code to do this? Why there?) 5. Add any other code required to show this simple GUI. 6. Run your program. Do you see your GUI on the screen? (Why not?) 7. CHECKPOINT: let's get this far, and discuss the questions above, and make sure everyone is seeing their GUI. 8. Announce/promise to the compiler that your program implements code to handle GUI events - to "listen" for GUI "action". (This program expects to receive calls from GUI objects.) This phrase goes on the end of your class declaration line. (See your Lab2 code or the instructions if you can't remember.) 9. Add the call-back method (where the text field will call you) to your program if you have not alreay done so. 10.Ask the text field to call you (the SimpleGUI program) when the user
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/25/2010 for the course ECE 309 taught by Professor Bowman during the Spring '09 term at N.C. State.

Page1 / 7

ECE309Spring2010Lecture3 - ECE309 - Lecture 3 - Spring 2010...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online