Java Reference
In-Depth Information
5. Save, compile, and run the IMServer program.
There will not be any output until we write the client program in the
next lab. For now, your IMServer program should be blocked, waiting for
a client to connect.
Lab 17.4: Finishing the
InstantMessage Program
In this lab, you will finish the InstantMessage program.
1. To make your Instant Message application communicate with the
server, the only modifications need to appear in the constructor of
the InstantMessageDialog class. Open this class in your text editor.
2. Comment out or remove any code involving pipes.
3. Within the constructor of InstantMessageDialog, create a Socket con-
nection to the IMServer program. Use the input and output streams
of this socket to instantiate the SendMessage and Participant objects.
4. Save, compile, and run the InstantMessageDialog class.
Your Instant Message program can now be executed on two different
computers on a network, or you can simply run it twice on your com-
puter. When a message is sent, it should appear in the appropriate
friend's instant message window.
Lab 17.5: Connecting to URLs
The purpose of this lab is to become familiar with connecting to URLs. In
this lab, you will create a Swing GUI that can be used to view the source
code of HTML documents. I will give you the guidelines for the applica-
tion and let you decide how to design and write it.
1. Create a JFrame that contains a text area in the center for viewing an
HTML page and a text field in the south for entering a URL.
2. When the user enters a URL in the text field, your program should
connect to the URL, read its contents, and display them in the text
area.
Search WWH ::




Custom Search