Objective:
Create a user-friendly JavaFX application that allows users to establish connections with their friends and send them messages within a graphical interface.
Specifications:
Design a GUI using JavaFX components, including a friend list panel for selecting the recipient of the message, a text area for composing the message, and a send button to transmit the message.
Create a Message class to represent individual messages. The Message class should include the following attributes:
id: Unique identifier for the message
senderId: Identifier for the user who sent the message
recipientId: Identifier for the user who received the message
content: The text content of the message
createdAt: Timestamp indicating the time the message was sent
The class should implement the following methods:
sendMessage(Message message): This method should send the provided Message object to the recipient and store it in a persistent storage mechanism ( file).
getAllMessages(): This method should retrieve all messages from the persistent storage mechanism.
Create a controller class to manage the interaction between the GUI components and the Message class.
Upon clicking the send button, extract the message content from the text area and create a Message object with the appropriate sender and recipient IDs.
Call the sendMessage method of the Message class to send the message to the recipient.
Upon successful message transmission, display a confirmation message or update the message list accordingly.
Implement error handling to gracefully handle invalid input or data access issues.
Acceptance Criteria:
- The GUI should provide a user-friendly interface for selecting a recipient, composing a message, and sending the message.
- Users should be able to choose a friend from their friend list and enter the message content in the text area.
- Upon clicking the send button, the message should be sent to the selected recipient and displayed in the corresponding message area.
- The program should handle invalid input or data access issues gracefully.