The demo of this project can be viewed in here
This is my course design for my freshman year. The course design aims at designing QQ-like chat software.
- Privilege management: Administrators and users have two kinds of permissions. Administrators have log records of the operation process. Administrators have the right to issue announcements and votes.
- Submitting votes: List the options of consent and disagreement. Each student who receives the votes can see the current status of the manuscript and add a suggestion column for supplementary comments. Voting status and details are displayed when voting.
- Announcement Circulation: Announcement is sent to every member of the class and reminded. The bulletin information is displayed on the class bulletin board with underlined headings.
- File sharing: On the server side, each class has a shared space, allowing class members to upload and download (offline). It realizes the preview of file attributes, including file name, size, upload time and uploader. The file can be opened directly after downloading.
- Instant messaging: independent pop-up window, basic functions: a one-to-one dialogue (private chat), speaking to the class (group chat), can send pictures.
- Emotional Sending: Implement the function of selecting an expression and sending it.
- Screenshot function: Select and send screenshots, monitor the keyboard to achieve the combination key Ctrl + Alt + X fast screenshots function.
- Jitter function: self-jitter and send jitter message, realize the function of both sides jitter together, private chat and group chat can be used. 9. System tray: realize the following functions: left-click pop-up window; right-click pop-up option menu, you can add classes, create classes, open, exit; when receiving messages, the tray flickers until the user clicks on the tray;
- Message Prompt Voice: Send Message Prompt Voice when Receiving Message
- Send message function, support picture sending. Monitor message text editor, monitor keyboard to realize the function of sending messages by pressing the Enter key.
- Drawing board: realizes the function of real-time hand-drawing and sends it to the current chat users or classes.
- Avatar function: users and classes can add avatars. 14. Login registration function: verify the password is correct. A mechanism to prevent duplicate logins is added. 15. Join the class, create the class function: you can create and join the class, create the class, and automatically become an administrator.
- The message reminder will change from Fig. 1 to Fig. 2 after receiving the message. Administrators publish manuscripts and announcements; voting will also be prompted. 17. Chat Bubble Function: Draw chat bubbles to distinguish message users from other users. Chat bubbles can contain text and pictures.
- Click on the avatar in the class to initiate a private chat.
- Clicking on the avatar or username during a private conversation can display user information.
- Add a small game function, and add a score statistics function, view user information can see the highest records of each other.
- Realize the log function. Each time a user makes a request, the result is written to the log. Image
Usually the client runs the application program, the server runs the service program, and the application program submits an application to the service program. The service program analyses whether the application is reasonable, and decides whether to return data information or error instructions. It achieves the separation of chat, document and information service, and does not interfere with each other. Client: Client includes three parts: chat, file, information service and GUI of the system. Server: including server and database. The servers include chat, file and information service servers, which monitor three ports respectively. The database part includes database connection and database query API. System module There are five packages in the system. They are beans, DB, GUI, net, and util packages. There are seven classes:
- User class: Contains user information invocation methods.
- Constant class: System static tool class, which contains the path of cache folders (files, chat records, screenshots, etc.) and the tool static method of getting file size.
- Draw class: Drawing board function. By listening to the mouse drawing and calling the screen capture.
- Emoticon class: facial expression function, draw a JLabel array, add facial expression to the array, by listening for each facial image.
- Game 2048: 2048 mini-games, materials downloaded from the Internet, added the score statistics function, view user information can see the highest records of each other.
- ScreenShot class: ScreenShot function, call the system's Toolkit. getDefaultToolkit (). getScreenSize () method to obtain full-screen screenshots, monitor the mouse to determine the location and save pictures to achieve this function.
- TipMusic Class: Message prompt sound function, receiving the message to play the specified sound.
There is also a base package inside the package, which is a rewritten swing component and a rewritten font class to beautify the interface. In addition, there are eight user interface classes, namely login, registration, home page, announcement, voting, user details, class creation and class participation. And add message list component charbar and draw bubble component chatbubble.
3. Net package is the system communication package, which contains four packages: base, Client, Json and Server.
Base package is the communication base package shared by client and server, including Csocket class and Message class. The Csocket class is a rewritten socket tool, and the Message class is the basic protocol for transmission.
Json packages are packages related to JSON transformation. In data transmission, the system uses the form of JSON transformation to realize object <-> JSON string. The class inside the package implements the method of converting objects used to transfer messages to JSON and JSON to object.
Client packages are client-related packages. The package contains three clients: chat, file and information service, as well as interfaces for monitoring chat and file clients. The chat client realizes the function of sending and receiving chat information, the file client realizes the function of uploading and downloading files, and the information service client realizes the function of inquiry and feedback of information (such as login, registration, publication of announcements, etc.). There is also a client startup class, responsible for starting the client.
Server packages are server-related packages. There are two packages handler and Server inside the package. 1) The Server package contains three servers (chat, file, information service) and one Server Manager (responsible for starting three servers). All three servers realize the function of communication connection. 2) Each server is equipped with a client handler class (message transceiver) and a message handler in the handler package. Each time there is a client connection, the server opens a new client handler thread to receive messages, and processes them with message handler and returns the results to the client. 3) There is also a server startup class, which is responsible for starting the server.
It has database connection and database API, which is responsible for processing all data addition, search, modify, delete commands, and provide data acquisition methods.
5. Util package is the system material and picture beautification package, there are three internal categories.
The PictureUtil class simplifies the way to call the image path. PictureUtil. class. getClassLoader (). getResource ("util/resource/image/"+name)) ImageUtil class is an image processing class that can compress images and create a circular mask. The RendererUtil class is a rendering class that creates image shadows.