File tree Expand file tree Collapse file tree 4 files changed +26
-3
lines changed Expand file tree Collapse file tree 4 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,23 @@ public void actionPerformed(ActionEvent e) {
160
160
161
161
}
162
162
}
163
+ public static void main (String args []) {
164
+ EventQueue .invokeLater (new Runnable () {
165
+ @ Override
166
+ public void run () {
167
+ ChatView chat = new ChatView ();
168
+ chat .chatdisplay ();
163
169
170
+ chat .addbutton .addActionListener (chat );
171
+ //todo
172
+ //after chat history is done next line code can run.
173
+ // chat.send.addActionListener(chat);
174
+
175
+
176
+ }
177
+ });
178
+
179
+ }
164
180
165
181
}
166
182
Original file line number Diff line number Diff line change 1
1
package chatlinitation ;
2
+
3
+ import entities .PrivateChat ;
4
+
2
5
/**
3
6
* chatviewmodel connects our ChatView UI to our Entities.
4
7
* It provide data to the view, so that view can put that data on the screen.
@@ -24,15 +27,15 @@ public ChatViewmodel() {
24
27
25
28
// when we click the addbutton for username.our private chat should update it's Recipientusername.
26
29
public void setRecipientUsername (String recipientUsername ) {
27
- this .privatechat .setrecipientUsername (recipientUsername ) ;
30
+ this .privatechat .setRecipientUsername (recipientUsername ) ;
28
31
}
29
32
30
33
31
34
//when type an input click send button , the input should set the txtmessge content
32
35
//and privatechat should the txtmessage to conversation.
33
36
public void setMessage (String content ) {
34
37
this .txtmessage .setMsgContent (content ) ;
35
- privatechatchat .addtoconvHist (txtmessage );
38
+ privatechat .addtoconvHist (txtmessage );
36
39
37
40
}
38
41
Original file line number Diff line number Diff line change @@ -47,8 +47,9 @@ public ArrayList<Message> getConvHist(){
47
47
* Add a message to the chat's conversation history when a message is sent or received
48
48
* @param message Message that is sent or received
49
49
*/
50
- public void sendRecieveMessage (Message message ){
50
+ public void addtoconvHist (Message message ){
51
51
this .convHist .add (message );
52
52
}
53
53
54
+
54
55
}
Original file line number Diff line number Diff line change @@ -37,4 +37,7 @@ public String getRecipientUsername(){
37
37
return this .recipientUsername ;
38
38
}
39
39
40
+ public void setRecipientUsername (String recipientUsername ) {
41
+ this .recipientUsername = recipientUsername ;
42
+ }
40
43
}
You can’t perform that action at this time.
0 commit comments