@@ -92,11 +92,25 @@ public void initialize(URL location, ResourceBundle resources) {
92
92
showProPic .setFill (new ImagePattern (image ));
93
93
clientName .setText (Login_Signup .username );
94
94
connectSocket ();
95
+
96
+ emojiBox .setVisible (false );
97
+ a .setVisible (false );
98
+ b .setVisible (false );
99
+ c .setVisible (false );
100
+ d .setVisible (false );
101
+ e .setVisible (false );
102
+ f .setVisible (false );
103
+ g .setVisible (false );
104
+ h .setVisible (false );
105
+ i .setVisible (false );
106
+ j .setVisible (false );
107
+ k .setVisible (false );
108
+ l .setVisible (false );
95
109
}
96
110
97
111
public void connectSocket (){
98
112
try {
99
- socket = new Socket ("localhost" , 5005 );
113
+ socket = new Socket ("localhost" , 5006 );
100
114
System .out .println ("Socket is connected with server!" );
101
115
reader = new BufferedReader (new InputStreamReader (socket .getInputStream ()));
102
116
writer = new PrintWriter (socket .getOutputStream (), true );
@@ -151,6 +165,7 @@ public void handleProfileBtn(ActionEvent event) {
151
165
profileBtn .setText ("Profile" );
152
166
}
153
167
}
168
+
154
169
public void setProfile () {
155
170
for (User user : users ) {
156
171
if (Login_Signup .username .equalsIgnoreCase (user .name )) {
@@ -164,13 +179,13 @@ public void setProfile() {
164
179
}
165
180
}
166
181
167
-
168
182
public void handleSendEvent (MouseEvent mouseEvent ) {
169
183
send ();
170
184
for (User user : users ) {
171
185
System .out .println (user .name );
172
186
}
173
187
}
188
+
174
189
String msg ="" ;
175
190
public void send () {
176
191
msg = msgField .getText ();
@@ -206,56 +221,81 @@ public void saveImage(ActionEvent event) {
206
221
}
207
222
}
208
223
}
224
+
209
225
public void sendMessageByKey (KeyEvent event ) {
210
226
if (event .getCode ().toString ().equals ("ENTER" )) {
211
227
send ();
212
228
}
213
229
}
214
230
231
+
215
232
public void mouseClickedAnotherArea (MouseEvent mouseEvent ) {
233
+ emojiBox .setVisible (false );
234
+ a .setVisible (false );
235
+ b .setVisible (false );
236
+ c .setVisible (false );
237
+ d .setVisible (false );
238
+ e .setVisible (false );
239
+ f .setVisible (false );
240
+ g .setVisible (false );
241
+ h .setVisible (false );
242
+ i .setVisible (false );
243
+ j .setVisible (false );
244
+ k .setVisible (false );
245
+ l .setVisible (false );
216
246
}
217
247
218
-
219
-
220
248
public void cameraIconMouseClicked (MouseEvent mouseEvent ) {
249
+ emojiBox .setVisible (true );
250
+ a .setVisible (true );
251
+ b .setVisible (true );
252
+ c .setVisible (true );
253
+ d .setVisible (true );
254
+ e .setVisible (true );
255
+ f .setVisible (true );
256
+ g .setVisible (true );
257
+ h .setVisible (true );
258
+ i .setVisible (true );
259
+ j .setVisible (true );
260
+ k .setVisible (true );
261
+ l .setVisible (true );
221
262
}
222
263
223
264
public void clickEmoji1 (MouseEvent mouseEvent ) {
265
+ msgField .setText (msg +a .getText ());
224
266
}
225
-
226
267
public void clickEmoji2 (MouseEvent mouseEvent ) {
268
+ msgField .setText (msg +b .getText ());
227
269
}
228
-
229
270
public void clickEmoji3 (MouseEvent mouseEvent ) {
271
+ msgField .setText (msg +c .getText ());
230
272
}
231
-
232
273
public void clickEmoji4 (MouseEvent mouseEvent ) {
274
+ msgField .setText (msg +d .getText ());
233
275
}
234
-
235
276
public void clickEmoji5 (MouseEvent mouseEvent ) {
277
+ msgField .setText (msg +e .getText ());
236
278
}
237
-
238
279
public void clickEmoji6 (MouseEvent mouseEvent ) {
280
+ msgField .setText (msg +f .getText ());
239
281
}
240
-
241
282
public void clickEmoji7 (MouseEvent mouseEvent ) {
283
+ msgField .setText (msg +g .getText ());
242
284
}
243
-
244
285
public void clickEmoji8 (MouseEvent mouseEvent ) {
286
+ msgField .setText (msg +h .getText ());
245
287
}
246
-
247
288
public void clickEmoji9 (MouseEvent mouseEvent ) {
289
+ msgField .setText (msg +i .getText ());
248
290
}
249
-
250
291
public void clickEmoji10 (MouseEvent mouseEvent ) {
292
+ msgField .setText (msg +j .getText ());
251
293
}
252
-
253
294
public void clickEmoji11 (MouseEvent mouseEvent ) {
295
+ msgField .setText (msg +k .getText ());
254
296
}
255
-
256
297
public void clickEmoji12 (MouseEvent mouseEvent ) {
257
-
298
+ msgField . setText ( msg + l . getText ());
258
299
}
259
300
260
-
261
301
}
0 commit comments