Encrypted Chat Room 4_Class Specifications(7).............*

class ClientGUI
This class represents the GUI for each client. It provides a control panel through which the user can interact with the system. It should support one or more conversations at the time.

attributes
client: Client

operation specifications

+ ClientGUI (client: Client)
-- constructor
pre: client not null
post: self.client = client

+ displayMsg (msg: String, nameMsgSender: String, code: Character)
-- displays a text message on the textdisplay
pre: code = ‘D’ -- for decrypted
or code = ‘E’ -- for encrypted
post: The msg has been added to the text display, with the name of the message
           sender, nameMsgSender and labelled as ‘Decrypted’ or ‘Encrypted’.

+ displayConnectedUsers (connectedUsers: String[])
-- displays the list of connected users available for selection
pre: none
post: The list of connected users available for selection is displayed.
          self is not included in the list.

Note:
You are free to choose the specific Java GUI component classes needed to implement the GUI. You are expected to apply the design principles of clarity and consistency to the GUI. You are at liberty to design the aesthetic “look and feel” of the interface, as long as you satisfy the class design specifications and the scenario requirements. The specifications for the GUI classes, ClientGUI and ControlPanel, have been left relatively loosely-defined to give you sufficient freedom for your design of the GUI. Add attributes and operations as you see fit. You are free to use either Java AWT or Java Swing packages to develop the GUI classes of the system.

In the design of this GUI class you have to think of the best interface for the user to handle more than one session with other users at same time. If you consider necessary, you can add a totally new class, as long as it is a GUI class and does not change the given specification. The change in the status of a session has to be updated and made visible somehow in the client GUI.

Hint: The ClientGUI class will need to implement the Java ActionListener interface. This allows it to respond to basic GUI events such as button presses and textfield entries. For example, if a button “Send Message” is pressed, the actionPerformed( ) method is called. You should implement this method so that it then calls the sendChatMessage( ) method of the Client class. Or when the “Accept” or “Reject” button is pressed, the sendCmd( ) method of the Client class should be called.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值