As a second-year CS student, I built this project to showcase what I've learned so far in school — Java, OOP design patterns, and network socket programming. The goal was to create something that ties these concepts together in a practical way, with a focus on security industry applications.
I also used AI-assisted context engineering to speed up development. By providing clear requirements and constraints to an AI model, I was able to focus on understanding the architecture while getting help with boilerplate code and documentation.
The application uses a tabbed interface with four main sections:
- Chat - Messenger-style communication with priority alerts
- Map - Shared tactical map with pathfinding and zones
- Audit Log - Security event logging and export
- Check-in - Lone worker safety system
- Real-time synchronized chat between Host and Client
- Messages are color-coded by sender (Host = blue, Client = red)
- System messages in gray (italic)
- Type and press Enter or click Send
Three priority levels for messages:
- Normal - Standard message display
- Alert - Orange text with
[ALERT]prefix, screen flashes orange twice - Critical - Red, bold, larger text with
[CRITICAL]prefix, screen flashes red three times with audio alert
- Set a timer (1-300 seconds) for messages to auto-delete
- Messages display
[SD: Xs]indicator - After expiration, shows "[Message self-destructed]" notification
- Useful for sensitive tactical communications
- Yellow points with green connecting lines on white background
- Approximately half the grid points randomly removed for more working space
- Add points: Left-click empty space (auto-connects to nearest point)
- Add edges: Click your point, then click another point to create custom edge
- Delete points: Right-click your own points (grid points are permanent)
| Border Color | Meaning |
|---|---|
| Gray | Grid points (permanent system points) |
| Blue | Host's points |
| Red | Client's points |
- Find Path: Select your point as source → other user's point as destination
- Uses Dijkstra's algorithm with edge length (pixel distance) as weight
- Multiple paths can coexist with different colors
- Parallel edges drawn when paths share the same line
- Path length displayed in pixel distance
- Path events posted to chat automatically
- Add Zone: Click two corners to create a rectangular zone
- Add Circle Zone: Click two corners to create a circular zone
- Zones displayed as semi-transparent overlays (blue for rectangles, red for circles)
- Dashed borders with zone labels
- Zone events logged to audit trail
- Create Patrol: Click 3+ points to define checkpoint route
- Start Patrol: Begins simulated patrol with 3-second intervals per checkpoint
- End Patrol: Manually stop current patrol
- Routes shown as dashed green lines with numbered checkpoints
- Current checkpoint highlighted in green
- Progress posted to chat and audit log
Records all security-relevant events with timestamps:
- Connections and disconnections
- Messages sent and received
- Points and edges added/removed
- Paths found and removed
- Zones created and triggered
- Patrol started, progress, completed
- Check-in success, missed, reset
- Self-destruct events
- Real-time log display in dedicated tab
- Export: Save log to file for compliance records
- Refresh: Update display with latest entries
- Clear: Reset log (clearing is itself logged)
- Click Start to begin the countdown timer (default 60 seconds)
- Click Check In before time runs out to reset the timer
- If you miss a check-in, your peer is immediately alerted
- Click Stop to end the monitoring session
- Green: Plenty of time remaining (>30s)
- Orange: Warning zone (10-30s)
- Red: Critical (<10s)
- Flashing red: Missed check-in alert
- Successful check-ins notify your peer
- Missed check-ins trigger alert on peer's screen with audio
javac -d target/classes src/main/java/com/tactical/p2p/*.javaTerminal 1 (Host):
java -cp target/classes com.tactical.p2p.App hostTerminal 2 (Client):
java -cp target/classes com.tactical.p2p.App clientWhen prompted, enter 127.0.0.1 or localhost as the host address.
Or just run without args and pick from the GUI dialog.
This allows you to run the Host on one computer and connect from a Client on a different computer over your local network.
On Windows (Host machine):
ipconfigLook for "IPv4 Address" under your active network adapter (e.g., 192.168.1.100)
On Mac/Linux (Host machine):
ifconfig
# or
ip addr showLook for inet under your active network (e.g., 192.168.1.100)
On Device 1 (the server):
java -cp target/classes com.tactical.p2p.App host- A dialog will appear - set a 4-digit PIN (e.g.,
1234) - The host will wait for a client connection on port 8888
- Note the IP address you found in Step 1
On Device 2 (the client):
java -cp target/classes com.tactical.p2p.App clientOr with the host IP directly:
java -cp target/classes com.tactical.p2p.App client 192.168.1.100- A dialog will appear asking for the host address
- Enter the Host's IP address (e.g.,
192.168.1.100) - Enter the PIN when prompted
- You should now be connected!
- Both devices should show "Status: Connected" in the status bar
- Try sending a chat message from one device to the other
- The Host is shown in blue, Client in red
| Problem | Solution |
|---|---|
| Connection timeout | Check both devices are on the same network |
| Connection refused | Ensure Host is running and waiting for connection |
| Firewall blocking | Allow Java through Windows Firewall or disable temporarily |
| Wrong IP | Verify IP with ipconfig / ifconfig - use the local network IP, not public IP |
| PIN rejected | Host sets the PIN on startup - make sure you enter the same PIN |
| Command | Description |
|---|---|
java -cp target/classes com.tactical.p2p.App |
Show mode selection dialog |
java -cp target/classes com.tactical.p2p.App host |
Start as Host (skip dialog) |
java -cp target/classes com.tactical.p2p.App client |
Start as Client, show host address dialog |
java -cp target/classes com.tactical.p2p.App client 192.168.1.100 |
Start as Client connecting to specific IP |
src/main/java/com/tactical/p2p/
├── App.java # Main class, handles startup
├── StateModel.java # Stores the shared state
├── NetworkManager.java # Socket communication
├── SyncBoardUI.java # Main GUI with tabs
├── MapScreen.java # Map panel with points, lines, zones, patrols
├── Point.java # 2D point class (ratio coordinates)
├── Line.java # Line with start/end points
├── PathStrategy.java # Strategy interface for pathfinding
├── ShortestPathStrategy.java # Dijkstra implementation
├── AuditLogger.java # Security audit logging
└── CheckInManager.java # Lone worker safety system
Uses TCP sockets on port 8888. Messages are UTF-8 strings ending with newline.
| Format | Description |
|---|---|
MSG:sender:priority:text:sd |
Chat message with priority and self-destruct |
POINT:ACTION:x:y:fromHost |
Point add/remove |
EDGE:x1:y1:x2:y2 |
Custom edge added |
PATH:sx:sy:dx:dy |
Path found |
PATHREMOVE:index |
Path removed |
CHECKIN:user |
User checked in |
CHECKIN_MISSED:user |
User missed check-in |
SD:id |
Message self-destructed |
public interface PathStrategy {
List<Line> findPath(Point source, Point target, List<Point> points, List<Line> lines);
String getName();
}Allows swapping pathfinding algorithms without changing client code.
StateModelnotifies listeners when data changes- Callbacks throughout for event-driven architecture
StateModel= ModelSyncBoardUI,MapScreen= View/ControllerAuditLogger,CheckInManager= Services
- Dependencies passed via constructor
- Callbacks set via setter methods
- EDT (Event Dispatch Thread): All GUI updates
- Background threads: Network I/O (socket read/write)
SwingUtilities.invokeLater()for thread-safe UI updates- Swing Timers for countdown, patrol simulation, screen flashing
- Java 11 or higher
- No external libraries
This application simulates a tactical coordination system suitable for:
- Security team coordination
- Event management and monitoring
- Lone worker safety compliance
- Patrol route management
- Geofenced area monitoring
Made for a distributed systems learning project with security industry focus.