A modern, feature-rich chat application built with JavaFX, supporting real-time private and group messaging, file sharing, media, and more. The project uses the MVC architecture and incorporates design patterns such as Observer and Factory for maintainability and scalability.
- Project Name: JavaFX Chat System
- Author: Eng: Mohammed Mogeab Ahmed
- Description: A desktop chat application for real-time communication, supporting private and group chats, file/media sharing, notifications, and a modern user interface. Built for educational and demonstration purposes.
- User Authentication: Login, sign up, and Google OAuth support.
- Private & Group Chat: Real-time messaging with friends or groups.
- File & Media Sharing: Send images, videos, and files in chats.
- Group Management: Create groups, add/remove members, and manage group settings.
- Search: Find users, groups, and messages with full-text search.
- Notifications: In-app toast notifications and Windows notifications.
- Modern UI: Stylish, responsive interface with custom JavaFX CSS.
- Database Integration: MySQL backend for users, messages, groups, and media.
- Design Patterns: Uses MVC, Observer, and Factory patterns for clean code.
src/
main/
java/
program/
chatsystem/
Home.java # Main chat window/controller
Main.java # Application entry point
HelloApplication.java # JavaFX Application launcher
ChatServer.java # Server-side logic
database # MySQL schema and sample data
Model/ # Data models (User, Contact, Group, Message, etc.)
service/ # Service layer (ChatService, GroupService)
Controller/ # Controllers for UI and logic
Factory/ # Factory pattern for message creation
observer/ # Observer pattern interfaces
Toast/ # Toast/notification utilities
ui/ # Custom UI components
resources/
program/
chatsystem/
*.fxml # JavaFX UI layouts (Login, Home, Group, etc.)
*.css # Custom stylesheets
images/ # UI images/icons
- Java 22 or later
- Maven 3.6+
- MySQL server
-
Clone the repository:
git clone <your-repo-url> cd ChatSystem
-
Database Setup:
- Import the provided SQL schema and sample data:
mysql -u <user> -p < src/main/java/program/chatsystem/database
- Update your MySQL credentials in the code if needed.
- Import the provided SQL schema and sample data:
-
Build the Project:
mvn clean install
-
Run the Server:
mvn exec:java -Dexec.mainClass="program.chatsystem.ChatServer" -
Run the Client:
mvn javafx:run
Or, run the main class:
mvn exec:java -Dexec.mainClass="program.chatsystem.Main"
- Login/Sign Up: Start at the login screen (
LoginPage.fxml). Supports username/password and Google sign-in. - Main Chat Window: After login, access the main chat UI (
home.fxml) with tabs for All Chats, Friends, and Groups. - Group Chat: Create and manage groups, send group messages, and view group info/settings.
- File/Media Sharing: Use the attachment button to send images, videos, or files.
- Search: Use the search bar to find users, groups, or messages.
- Notifications: Receive toast and system notifications for new messages.
- MVC: Separation of UI (FXML), controllers, and models.
- Observer:
ChatObserverandChatSubjectfor real-time updates. - Factory:
MessageFactoryfor creating different message types.
Home.java: Main controller for chat UI and logic.ChatService.java: Handles private chat logic and server communication.GroupService.java: Manages group creation, membership, and group messages.ChatServer.java: Multi-threaded server for handling all chat operations.Model/: ContainsUser,Contact,Group,ChatMessage, etc.Factory/MessageFactory.java: Factory for message creation.observer/ChatObserver.java,observer/ChatSubject.java: Observer pattern interfaces.
- FXML Layouts: All UI screens are defined in FXML (e.g.,
LoginPage.fxml,home.fxml,ChatSetting.fxml). - Custom CSS: Modern look and feel with
styles.cssandpopup-styles.css. - Responsive Design: UI adapts to different window sizes.
- MySQL schema for users, friends, groups, messages, media, and files.
- Sample data for quick testing.
- Full-text search indexes for fast message and group search.
- Add new message types (e.g., voice, stickers) via the Factory pattern.
- Integrate more notification channels.
- Enhance group management (roles, permissions).
- Add REST API for mobile/web clients.
- Author: Eng: Mohammed Mogeab Ahmed
- JavaFX for UI
- MySQL for database
- OpenJFX, ControlsFX, and other libraries (see
pom.xmlfor details)
This project is for educational purposes. Please check with your instructor or team for licensing and usage.
Enjoy chatting!