A modern JavaFX-based WhatsApp-style chat simulator showcasing clean architecture, multithreading, and advanced Software Engineering design patterns.
-
Shows Chats:
Mano,Yusra,Rabail -
Each item displays:
- Contact name
- Last message preview
- Unread message badge (● N)
-
Clicking a chat opens a dedicated chat window for that contact
-
List updates live when:
- A new message arrives
- Unread count changes
- Last message changes
(Implemented via ChatListController + ChatObserver + ChatEngine.)
The Simple Chat Messaging Simulator is a desktop application built with JavaFX, designed to simulate realistic two-way chat conversations. The system integrates multiple design patterns including Factory, Builder, Decorator, Observer, Singleton, and multithreading.
It features:
- Chat list screen
- Per-contact chat windows
- Human-like bot replies
- Typing indicators
- Message previews
- Unread counters
- Personality-based auto-replies
- WhatsApp-style layout
- User + bot message bubbles
- Timestamps via decorator
- Auto-scroll
- Clean FXML-driven UI
Each contact has a unique texting style:
- Mano – dramatic, playful
- Yusra – chaotic, meme-texting
- Rabail – soft, sweet, teasing
Smart reply engine supports:
- Keyword detection
- Personality-based responses
- Emoji-rich fallback replies
Typing delay calculation:
0.8s + (messageLength × 40ms)
Max ≈ 2.8 seconds
Bot shows:
- “Typing…” bubble
- Human-like delay
- Then sends reply
Bot only replies when the user sends a message.
- Last message preview
- Automatic unread count updates
- Observer pattern implementation
- Smooth UI refresh
| Pattern | Where Used | Purpose |
|---|---|---|
| Factory | MessageFactory |
Create Message objects (currently TextMessage) |
| Builder | ChatSession / session builder (initializer) |
Build initial session data / configure startup chat content |
| Decorator | MessageDecorator, StyleDecorator, TimestampDecorator |
Add timestamp and visual style to messages without changing core Message |
| Observer | ChatObserver, IncomingMessageSimulator, ChatListController |
Notify chat list when unread counts / last message change; simulate incoming messages |
| Singleton | ChatEngine |
Central manager for chat logs, active contact, UI hooks, routing & typing state |
Simple-Chat-Messaging-Simulator/
│
├── pom.xml
├── README.md
├── Report.pdf
├── screenshots/
│ ├── chat_list.png
│ └── chat_window_1.png
│ └── chat_window_2.png
├── src/
│ └── main/
│ ├── java/
│ │ └── com/chatapp/
│ │ ├── Main.java
│ │ ├── controllers/
│ │ │ ├── ChatController.java
│ │ │ └── ChatListController.java
│ │ ├── engine/
│ │ │ └── ChatEngine.java
│ │ ├── messages/
│ │ │ ├── Message.java
│ │ │ ├── TextMessage.java
│ │ │ └── MessageFactory.java
│ │ ├── builder/
│ │ │ └── ChatSession.java (or ChatSessionBuilder)
│ │ ├── decorator/
│ │ │ ├── MessageDecorator.java
│ │ │ ├── StyleDecorator.java
│ │ │ └── TimestampDecorator.java
│ │ └── observer/
│ │ ├── ChatObserver.java
│ │ └── IncomingMessageSimulator.java
│ └── resources/
│ └── ui/
│ ├── chat.fxml
│ └── chat_list.fxml
- Java 23
- JavaFX 23 / 21+
- Maven
- FXML UI Layout
- Object-Oriented Design + GoF Patterns
Download JavaFX SDK: 👉 https://gluonhq.com/products/javafx/
git clone https://github.com/yourname/Simple-Chat-Messaging-Simulator.git
cd Simple-Chat-Messaging-SimulatorAdd VM options (Run Configuration → VM options):
--module-path "C:/Program Files/javafx-sdk/lib" --add-modules javafx.controls,javafx.fxml
(Adjust path to your JavaFX SDK.)
Main class: com.chatapp.Main
-
Stores chat logs per contact
-
Tracks active contact
-
Handles:
- Sending & receiving messages
- Adding message bubbles to the UI
- Scroll-to-bottom behavior
- Typing indicator (
showTyping/hideTyping) - Unread counters + last message preview for chat list
-
Notifies
ChatObserver(implemented byChatListController) when:- Unread count changes
- Last message changes
-
User sends message via
ChatController -
ChatEngine.sendMessageTo(contact, msg):- Adds user bubble
- Notifies
IncomingMessageSimulator.onUserMessage(contact, text)
-
Simulator thread:
- Calls
ChatEngine.showTyping(contact) - Sleeps ~1–2 seconds
- Calls
ChatEngine.hideTyping(contact) - Generates personality-based reply
- Calls
ChatEngine.receiveMessage(contact, msg)
- Calls
-
Keyword-based layer
- If message contains words like
"hi","hello","how are","busy","wyd","thanks"→ reply with a relevant canned sentence.
- If message contains words like
-
Personality layer
-
If no keyword matches, pick from that contact’s own reply set:
- Mano → playful / dramatic replies
- Yusra → chaotic / meme replies
- Rabail → calm / sweet / teasing replies
-
-
All replies are English, with casual texting + emojis.
- User sends message
- ChatEngine logs + displays it
- IncomingMessageSimulator triggers typing
- Delay based on content length
- Bot reply generated
- Chat list updates
You can extend:
- Message types (image, audio)
- Contacts & personalities
- AI chatbot backend
- Database persistence
- WhatsApp-style ticks
- Urdu texting mode
- Dark mode UI
- In-memory chat only
- No media messages
- Rule-based bot logic
- LLM integration
- Persistent SQLite storage
- Voice note bubbles
- Custom themes
- Animation transitions
- Online/offline indicators


