Lab 2 -- A robot greeter: to be demonstrated by 2/11
Work with your partner, but each of you should do the lab (so you get practice!).
Your job in this lab is to write a Java application that will input the name of a person and then say hello to that person
when they hit enter
(very much like in Chapter 2).
If the input name were Robin, your program should output "Hi Robin!". Input should come from one TextField and output should go
to another TextField.
There are several new things you must know before you can do this lab.
- How to create a project and save it on your network drive
- How to add a Frame to a project
- TextFields
- How to add a TextField to a Frame
- How to add the ActionPerformed method to a TextField
- How to get text from a TextField
- How to set the text in a TextField
- Strings
- How to save text in a String variable
- How to concatenate Strings
These will have all been demonstrated in class, possibly several times. Unfortunately, if you can't recall
how to do any one of these, you will be stuck (like most of computing, the details can get in your way -- they do not capture
your involuntary attention, but if you don't make yourself learn them they can take a lot of your time!). With any luck, either you
or your partner will recall each of them!
Make sure to complete this lab before class on the due date so that you can ask questions in class if something goes horribly wrong. Then
we can clear up any problems so you can demo it on time.