Realization of displaying emoticons in chat rooms based on JavaEE

1. Write in front

This semester newly opened JavaEE, used sockets to make a chat room, thinking about adding a little of its own functions. It’s a bit troublesome to transfer the file stream, so I use the client's direct agreement to realize the function of displaying the picture. Note: The picture file is not transmitted in the socket, but the string convention is used, like a secret code. Own client output picture

Two, design ideas

  1. Xiao Ming made a real-time chat based on the socket channel, realizing real-time communication between multiple client clients and servers, but the teacher requires everyone to have their own unique functions...So Xiao Ming thought, innovation is not It may be innovative, so what can be transplanted to QQ's workmanship now,, Xiaoming worked around, and found that most of the multi-functions are based on file transfer, so I looked for the socket file transfer and decided to choose. What's more, or make an agreement on your own client, a special string indicates a special operation, for example, the following Xiaoming will give an example:                                                                                                                                    there are two clients A and B, the clients are exactly the same, and the resources inside are stored 10 pictures, and agreed: when sending a message as " @ ", a number will be followed by this string, and the two of us will simultaneously output the picture with the number representing the number to the chat box, such as                                                                 A sent to B: @     那Now , The two clients will output the No. 3 picture to the chat box, causing the illusion that the picture is sent
  2. Just do it, first implement your own window to judge the output picture, and then make the judgment when you get the text in the chat input area (I am adding the emoticon button, then you don’t need to remember the password), and output the corresponding numbered picture, hey No, this chat information display area is a text box, so change it to a panel, use the new panel class, use a stream layout to specify the layout width (otherwise it will output messages horizontally), then add scroll bars to the panel, and then chat Just type out the area

Three, code implementation

QQ2905257286

Suddenly I want to upload csdn to download it. I heard that there is a rebate for this stuff. Just a meal?

https://download.csdn.net/download/qq_41170600/12277060

Four, configuration instructions

Message to be sent: At present, the program is not very complete. Sending an @ on the client side will show that you can use it as a tool for the next step of development

Five, effect display

Guess you like

Origin blog.csdn.net/qq_41170600/article/details/105156301