After Javase learning, the Java-implemented chat room blends a lot of Java knowledge.
such as GUI simple graphical interface, collection, IO, multi-threading, socket, monitoring and so on.
So how is this chat system implemented?
First we have to have the interface.
This is just a simple frame window interface.
First Package: Packet entry, equivalent to the absolute path of this class of files, and others repeat the chance to reduce
Import: The meaning of the imported package/class. When you want to invoke the method of a class in a package, use the Import
EXTENDS:CHATCLIENT01 inherits the frame, which is equivalent to inheriting all the methods inside the parent class frame.
In the following code, declare the variables to be used next, the variable declaration three steps: Specify the data type, specify the variable name, assign the value
Main: The entry of the program
Instantiate ChatClient01 and then call Launchframe () inside the method and implement it.
This: Refers to the current object.
Pack (): Call the Pack () method, which sets the size of the window to fit all of the components you place
SetVisible (): Sets the visual window to be visible.
Window is implemented, the next step is to implement some response to the window.
Java Implementation Chat System project notes