Browse Source

Minimal chat functinalities with bugs

EyeXion 3 years ago
parent
commit
ba6ebdca6e

+ 36
- 0
.idea/inspectionProfiles/Project_Default.xml View File

@@ -0,0 +1,36 @@
1
+<component name="InspectionProjectProfileManager">
2
+  <profile version="1.0">
3
+    <option name="myName" value="Project Default" />
4
+    <inspection_tool class="JavaDoc" enabled="false" level="WARNING" enabled_by_default="false">
5
+      <option name="TOP_LEVEL_CLASS_OPTIONS">
6
+        <value>
7
+          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
8
+          <option name="REQUIRED_TAGS" value="" />
9
+        </value>
10
+      </option>
11
+      <option name="INNER_CLASS_OPTIONS">
12
+        <value>
13
+          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
14
+          <option name="REQUIRED_TAGS" value="" />
15
+        </value>
16
+      </option>
17
+      <option name="METHOD_OPTIONS">
18
+        <value>
19
+          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
20
+          <option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
21
+        </value>
22
+      </option>
23
+      <option name="FIELD_OPTIONS">
24
+        <value>
25
+          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
26
+          <option name="REQUIRED_TAGS" value="" />
27
+        </value>
28
+      </option>
29
+      <option name="IGNORE_DEPRECATED" value="false" />
30
+      <option name="IGNORE_JAVADOC_PERIOD" value="true" />
31
+      <option name="IGNORE_DUPLICATED_THROWS" value="false" />
32
+      <option name="IGNORE_POINT_TO_ITSELF" value="false" />
33
+      <option name="myAdditionalJavadocTags" value="" />
34
+    </inspection_tool>
35
+  </profile>
36
+</component>

+ 46
- 9
src/main/java/app/insa/clav/Core/Model.java View File

@@ -1,11 +1,14 @@
1 1
 package app.insa.clav.Core;
2 2
 
3 3
 import app.insa.clav.Messages.Message;
4
+import app.insa.clav.Messages.MessageChatTxt;
5
+import app.insa.clav.Messages.MessageInit;
4 6
 import app.insa.clav.Messages.MessagePseudo;
5 7
 import app.insa.clav.Reseau.TCPChatConnection;
6 8
 import app.insa.clav.Reseau.TCPListener;
7 9
 import app.insa.clav.Reseau.UDPInput;
8 10
 import app.insa.clav.Reseau.UDPOutput;
11
+import jdk.jshell.execution.Util;
9 12
 
10 13
 import java.beans.PropertyChangeEvent;
11 14
 import java.beans.PropertyChangeListener;
@@ -81,16 +84,16 @@ public class Model implements PropertyChangeListener{
81 84
      *                  Port d'Output UDP
82 85
      */
83 86
 /*
84
-ID 1 -> Listening on 6000, sending on 5000
85
-ID 2 -> Listening on 6001, sending on 5001
86
-ID 2 -> Listening on 6002, sending on 5002
87
+ID 1 -> Listening on 6000, sending on 5000, tcpServer on 7000
88
+ID 2 -> Listening on 6001, sending on 5001, tcpServer on 7001
89
+ID 2 -> Listening on 6002, sending on 5002, tcpServer on 7002
87 90
 */
88
-    private Model(int id, int inputPort, int outputPort){
91
+    private Model(int id, int inputPort, int outputPort, int tcpListenerPort){
89 92
         try {
90 93
             this.user = new Utilisateurs("NA", InetAddress.getLocalHost(), id, inputPort);
91 94
             this.UDPOut = new UDPOutput(InetAddress.getLocalHost(), outputPort);
92 95
             this.UDPIn = new UDPInput(user.getInetAddress(),inputPort);
93
-            this.tcpListener = new TCPListener(this.user.getInetAddress(),this.user.getId());
96
+            this.tcpListener = new TCPListener(this.user.getInetAddress(),tcpListenerPort,user.getId());
94 97
             this.tim= new Timer();
95 98
             this.support = new PropertyChangeSupport(this);
96 99
         }
@@ -99,6 +102,7 @@ ID 2 -> Listening on 6002, sending on 5002
99 102
             e.printStackTrace();
100 103
         }
101 104
         this.userList = new ArrayList<Utilisateurs>();
105
+        this.listTCPConnection = new ArrayList<TCPChatConnection>();
102 106
     }
103 107
 
104 108
     /**
@@ -112,10 +116,10 @@ ID 2 -> Listening on 6002, sending on 5002
112 116
      * @return
113 117
      *         instance of Model
114 118
      */
115
-    public static Model getInstance(int id, int inputPort, int outputPort){
119
+    public static Model getInstance(int id, int inputPort, int outputPort, int tcpListenerPort){
116 120
         synchronized(Model.class){
117 121
             if (instance == null) {
118
-                instance = new Model(id, inputPort, outputPort);
122
+                instance = new Model(id, inputPort, outputPort,tcpListenerPort);
119 123
             }
120 124
         }
121 125
         return instance;
@@ -138,6 +142,7 @@ ID 2 -> Listening on 6002, sending on 5002
138 142
     }
139 143
 
140 144
     public void openTCPListener(){
145
+        System.out.println(("Start tcp listener"));
141 146
         tcpListener.start();
142 147
         this.tcpListener.addPropertyChangeListener(this);
143 148
     }
@@ -234,6 +239,28 @@ ID 2 -> Listening on 6002, sending on 5002
234 239
         return true;
235 240
     }
236 241
 
242
+
243
+    public void createChatFromLocalRequest(String remotePseudo){
244
+        for (Utilisateurs u : userList){
245
+            if (u.getPseudo().equals(remotePseudo)){
246
+                int destPort;
247
+                if (u.getId() == 1){
248
+                    destPort = 7000;
249
+                }
250
+                else if (u.getId() == 2){
251
+                    destPort = 7001;
252
+                }
253
+                else{
254
+                    destPort = 7002;
255
+                }
256
+                System.out.println("Dans le createChat du Model, avec dest : " +u.getId() + " " + remotePseudo + " "  +destPort);
257
+                MessageInit msgInit = new MessageInit(7,user.getInetAddress(),user.getPort(),u.getInetAddress(),destPort,user.getId());
258
+                TCPChatConnection tcpCo = new TCPChatConnection(msgInit,u.getId());
259
+                listTCPConnection.add(tcpCo);
260
+            }
261
+        }
262
+    }
263
+
237 264
     /**
238 265
      * Handler de notification (Obsevateur) pour le thread UDP.
239 266
      * @param evt
@@ -246,11 +273,10 @@ ID 2 -> Listening on 6002, sending on 5002
246 273
                 this.messageHandler(msgReceived);
247 274
                 break;
248 275
             case "chatCreated" :
276
+                System.out.println(("Dans le handler chatCreated receveur"));
249 277
                 TCPChatConnection tcpCo = this.tcpListener.getTCPChatConnection();
250 278
                 tcpCo.addPropertyChangeListener(this);
251 279
                 this.listTCPConnection.add(tcpCo);
252
-            case "TCPReceived" :
253
-                //Faire le handler de msgTCP
254 280
         }
255 281
     }
256 282
 
@@ -322,6 +348,17 @@ ID 2 -> Listening on 6002, sending on 5002
322 348
         return userList;
323 349
     }
324 350
 
351
+    public Utilisateurs getUserFromId(int id){
352
+        Utilisateurs res = null;
353
+        for (Utilisateurs u : userList){
354
+            if (u.getId() == id){
355
+                res = u;
356
+                break;
357
+            }
358
+        }
359
+        return res;
360
+    }
361
+
325 362
 
326 363
     /**
327 364
      * Classe interne au model pour au bout d'une seconde d'envoi de demande pseudo type 1,

+ 2
- 1
src/main/java/app/insa/clav/Main.java View File

@@ -17,8 +17,9 @@ public class Main extends Application{
17 17
         int id = Integer.parseInt(args[0]);
18 18
         int inputPort = Integer.parseInt(args[1]);
19 19
         int outPutPort = Integer.parseInt(args[2]);
20
+        int tcpListenerPort = Integer.parseInt(args[3]);
20 21
 
21
-        Model model = Model.getInstance(id,inputPort, outPutPort);
22
+        Model model = Model.getInstance(id,inputPort, outPutPort,tcpListenerPort);
22 23
 
23 24
         FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/splashScreen.fxml"));
24 25
         Parent root =fxmlLoader.load();

+ 4
- 2
src/main/java/app/insa/clav/Messages/Message.java View File

@@ -10,6 +10,8 @@ import java.net.InetAddress;
10 10
     2 ---> Messages.MessagePseudo réponse à type 1 pseudo ok
11 11
     3 ---> Messages.MessagePseudo réponse à type 1 pseudo pas ok
12 12
     4 ---> Messages.MessagePseudo si après type 1 aucun type 2 pour un delai, envoi confirmation pseudo
13
+    5 ---> Message Init envoyé quand on se connecte en TCP à un user distant
14
+    6 ---> MessageChatTxt pour le chat
13 15
  */
14 16
 
15 17
 /**
@@ -28,8 +30,8 @@ public class Message implements Serializable {
28 30
     public int typeMessage;
29 31
     public InetAddress srcIP;
30 32
     public int srcResponsePort; //Seulement besoin car on teste en localHost
31
-    public InetAddress destIP;
32
-    public int destPort;
33
+    public InetAddress destIP; //Seulement pour UDP ou ouverture CO TCP
34
+    public int destPort; //Seulement pour UDP ou l'ouverture connexion TCP, sinon à 0.
33 35
 
34 36
     /**
35 37
      * Constructeur d'un message depuis un autre

+ 1
- 1
src/main/java/app/insa/clav/Messages/MessageInit.java View File

@@ -4,7 +4,7 @@ import java.net.InetAddress;
4 4
 
5 5
 public class MessageInit extends Message{
6 6
 
7
-    int id;
7
+    public int id;
8 8
 
9 9
 
10 10
     public MessageInit(int typeMessage, InetAddress srcIP, int srcResponsePort, InetAddress destIP, int destPort, int localId) {

+ 20
- 11
src/main/java/app/insa/clav/Reseau/TCPChatConnection.java View File

@@ -1,12 +1,16 @@
1 1
 package app.insa.clav.Reseau;
2 2
 import app.insa.clav.Messages.Message;
3
+import app.insa.clav.Messages.MessageChatTxt;
3 4
 import app.insa.clav.Messages.MessageInit;
5
+import app.insa.clav.UISubStages.ChatStage;
6
+import javafx.application.Platform;
4 7
 
5 8
 import java.beans.PropertyChangeListener;
6 9
 import java.beans.PropertyChangeSupport;
7 10
 import java.io.IOException;
8 11
 import java.io.ObjectInputStream;
9 12
 import java.io.ObjectOutputStream;
13
+import java.net.InetAddress;
10 14
 import java.net.Socket;
11 15
 import java.util.ArrayList;
12 16
 
@@ -16,7 +20,7 @@ public class TCPChatConnection extends Thread{
16 20
     /**
17 21
      * Buffer dans lequel on met les messages reçus si ils passent le filter
18 22
      */
19
-    private ArrayList<Message> msgReceivedBuffer;
23
+    private final ArrayList<Message> msgReceivedBuffer;
20 24
 
21 25
     private Socket link;
22 26
 
@@ -32,15 +36,15 @@ public class TCPChatConnection extends Thread{
32 36
      * Constructeur utilisé quand l'utilisateur distant inititie la connexion
33 37
      * @param link
34 38
      */
35
-    public TCPChatConnection(Socket link){
39
+    public TCPChatConnection(Socket link, int remoteUserId, ObjectInputStream ois, ObjectOutputStream oos){
36 40
         this.link = link;
37
-        try {
38
-            this.objectOutStream = new ObjectOutputStream(this.link.getOutputStream());
39
-            this.objectInStream = new ObjectInputStream(this.link.getInputStream());
40
-        } catch (IOException e) {
41
-            e.printStackTrace();
42
-        }
41
+        this.objectOutStream = oos;
42
+        this.objectInStream = ois;
43 43
         this.msgReceivedBuffer = new ArrayList<Message>();
44
+        this.remoteUserId = remoteUserId;
45
+        this.support = new PropertyChangeSupport(this);
46
+        Platform.runLater(() -> new ChatStage(this));
47
+        this.start();
44 48
     }
45 49
 
46 50
     /**
@@ -58,11 +62,15 @@ public class TCPChatConnection extends Thread{
58 62
         } catch (IOException e) {
59 63
             e.printStackTrace();
60 64
         }
65
+        this.msgReceivedBuffer = new ArrayList<Message>();
61 66
         this.remoteUserId = remoteUserId;
67
+        this.support = new PropertyChangeSupport(this);
68
+        Platform.runLater(() -> new ChatStage(this));
69
+        this.start();
62 70
     }
63 71
 
64 72
     public void addPropertyChangeListener(PropertyChangeListener pcl){
65
-        this.support.addPropertyChangeListener("TCPReceived",pcl);
73
+        this.support.addPropertyChangeListener("messageTextReceivedTCP",pcl);
66 74
     }
67 75
 
68 76
 
@@ -87,11 +95,12 @@ public class TCPChatConnection extends Thread{
87 95
                 e.printStackTrace();
88 96
             }
89 97
             this.msgReceivedBuffer.add(msgReceived);
90
-            this.support.firePropertyChange("TCPReceived",true,false);
98
+            this.support.firePropertyChange("messageTextReceivedTCP",true,false);
91 99
         }
92 100
     }
93 101
 
94
-    public void sendMessage(Message msg){
102
+    public void sendMessageTxt(String payload){
103
+        MessageChatTxt msg = new MessageChatTxt(6,this.link.getLocalAddress(),this.link.getLocalPort(),this.link.getInetAddress(),this.link.getPort(),payload);
95 104
         try {
96 105
             this.objectOutStream.writeObject(msg);
97 106
         } catch (IOException e) {

+ 9
- 7
src/main/java/app/insa/clav/Reseau/TCPListener.java View File

@@ -6,6 +6,7 @@ import app.insa.clav.Messages.MessageInit;
6 6
 import java.beans.PropertyChangeListener;
7 7
 import java.beans.PropertyChangeSupport;
8 8
 import java.io.IOException;
9
+import java.io.ObjectInputStream;
9 10
 import java.io.ObjectOutputStream;
10 11
 import java.net.InetAddress;
11 12
 import java.net.ServerSocket;
@@ -24,10 +25,10 @@ public class TCPListener extends Thread{
24 25
 
25 26
     private ArrayList<TCPChatConnection> bufferTCPConnection;
26 27
 
27
-    public TCPListener(InetAddress inetAddress, int localId){
28
+    public TCPListener(InetAddress inetAddress, int tcpListenerPort,int localId){
28 29
         this.inetAddress = inetAddress;
29 30
         try {
30
-            this.servSocket = new ServerSocket(0,1000,inetAddress); //0 alloue un port dispo
31
+            this.servSocket = new ServerSocket(tcpListenerPort,1000,inetAddress); //0 alloue un port dispo
31 32
         } catch (IOException e) {
32 33
             e.printStackTrace();
33 34
         }
@@ -57,11 +58,12 @@ public class TCPListener extends Thread{
57 58
             try {
58 59
                 Socket link = servSocket.accept();
59 60
                 ObjectOutputStream objectOutStream = new ObjectOutputStream(link.getOutputStream());
60
-                MessageInit msg = new MessageInit(7,this.inetAddress,0,link.getInetAddress(),link.getPort(),this.localId);
61
-                objectOutStream.writeObject(msg);
62
-                objectOutStream.close();
63
-                this.bufferTCPConnection.add(new TCPChatConnection(link));
64
-            } catch (IOException e) {
61
+                ObjectInputStream objectInStream = new ObjectInputStream(link.getInputStream());
62
+                MessageInit msgInit = (MessageInit) objectInStream.readObject();
63
+                int remoteUserId = msgInit.id;
64
+                this.bufferTCPConnection.add(new TCPChatConnection(link,remoteUserId,objectInStream,objectOutStream));
65
+                this.support.firePropertyChange("chatCreated",true,false);
66
+            } catch (IOException | ClassNotFoundException e) {
65 67
                 e.printStackTrace();
66 68
             }
67 69
         }

+ 85
- 0
src/main/java/app/insa/clav/UIControllers/ChatWindowController.java View File

@@ -0,0 +1,85 @@
1
+package app.insa.clav.UIControllers;
2
+
3
+import app.insa.clav.Core.Model;
4
+import app.insa.clav.Core.Utilisateurs;
5
+import app.insa.clav.Messages.MessageChatTxt;
6
+import app.insa.clav.Messages.MessageInit;
7
+import app.insa.clav.Reseau.TCPChatConnection;
8
+import com.jfoenix.controls.JFXButton;
9
+import com.sun.javafx.collections.ImmutableObservableList;
10
+import javafx.application.Platform;
11
+import javafx.collections.FXCollections;
12
+import javafx.collections.ObservableArray;
13
+import javafx.collections.ObservableList;
14
+import javafx.event.ActionEvent;
15
+import javafx.fxml.FXML;
16
+import javafx.fxml.Initializable;
17
+import javafx.scene.control.ListView;
18
+import javafx.scene.control.TextField;
19
+import javafx.scene.layout.AnchorPane;
20
+import javafx.stage.Stage;
21
+
22
+import java.beans.PropertyChangeEvent;
23
+import java.beans.PropertyChangeListener;
24
+import java.net.URL;
25
+import java.util.ArrayList;
26
+import java.util.ResourceBundle;
27
+
28
+public class ChatWindowController implements Initializable, PropertyChangeListener {
29
+
30
+    @FXML
31
+    private AnchorPane rootAnchor;
32
+
33
+    private Model model;
34
+
35
+    private TCPChatConnection tcpCo;
36
+
37
+    private Utilisateurs remoteUser;
38
+
39
+
40
+    @FXML
41
+    private ListView<String> messageList;
42
+
43
+    @FXML
44
+    private TextField messageInput;
45
+
46
+    @FXML
47
+    private JFXButton sendButton;
48
+
49
+    private ObservableList<String> listMessages;
50
+
51
+
52
+    public ChatWindowController(){
53
+        this.model = Model.getInstance();
54
+    }
55
+
56
+    @Override
57
+    public void initialize(URL location, ResourceBundle resources) {
58
+        this.listMessages = FXCollections.observableList(new ArrayList<String>());
59
+        this.messageList.setItems(this.listMessages);
60
+    }
61
+
62
+    public void setTCPCo(TCPChatConnection tcpCo){
63
+        this.tcpCo = tcpCo;
64
+        tcpCo.addPropertyChangeListener(this);
65
+        int remoteUserId = tcpCo.remoteUserId;
66
+        this.remoteUser = model.getUserFromId(remoteUserId);
67
+    }
68
+
69
+    @Override
70
+    public void propertyChange(PropertyChangeEvent evt) {
71
+        switch(evt.getPropertyName()){
72
+            case "messageTextReceivedTCP" :
73
+                MessageChatTxt msg = (MessageChatTxt) tcpCo.getMessageReceived();
74
+                String payload = msg.payload;
75
+                Platform.runLater(() -> this.listMessages.add(payload));
76
+        }
77
+    }
78
+
79
+    public void buttonSendMessageClicked(ActionEvent actionEvent) {
80
+        String payload = model.user.getPseudo() + " : " + this.messageInput.getText();
81
+        this.listMessages.add(payload);
82
+        this.messageInput.clear();
83
+        this.tcpCo.sendMessageTxt(payload);
84
+    }
85
+}

+ 1
- 1
src/main/java/app/insa/clav/UIControllers/MainDrawerController.java View File

@@ -57,7 +57,7 @@ public class MainDrawerController implements PropertyChangeListener,Initializabl
57 57
      * @param evt
58 58
      */
59 59
     public void buttonPseudoHandler(ActionEvent evt){
60
-        this.pseudoWindow = new PseudoStage(this.model);
60
+        this.pseudoWindow = new PseudoStage();
61 61
     }
62 62
 
63 63
     /**

+ 12
- 0
src/main/java/app/insa/clav/UIControllers/MainWindowController.java View File

@@ -10,6 +10,7 @@ import javafx.animation.FadeTransition;
10 10
 import javafx.application.Platform;
11 11
 import javafx.collections.FXCollections;
12 12
 import javafx.collections.ObservableList;
13
+import javafx.event.ActionEvent;
13 14
 import javafx.fxml.FXML;
14 15
 import javafx.fxml.FXMLLoader;
15 16
 import javafx.fxml.Initializable;
@@ -83,6 +84,11 @@ public class MainWindowController implements PropertyChangeListener, Initializab
83 84
      */
84 85
     private ObservableList<String> listUsers;
85 86
 
87
+
88
+    @FXML
89
+    private MenuItem openChatButton;
90
+
91
+
86 92
     /**
87 93
      * Contructeur. Il crée lui même l'UI (plus tard on mettra quel type de fenetre en argument)
88 94
      */
@@ -155,4 +161,10 @@ public class MainWindowController implements PropertyChangeListener, Initializab
155 161
         }
156 162
     }
157 163
 
164
+
165
+    @FXML
166
+    void openChat(ActionEvent event) {
167
+        System.out.println("Dans le hanlder bouton chat, pseudo demandé : " + userListView.getFocusModel().getFocusedItem());
168
+        model.createChatFromLocalRequest(userListView.getFocusModel().getFocusedItem());
169
+    }
158 170
 }

+ 30
- 0
src/main/java/app/insa/clav/UISubStages/ChatStage.java View File

@@ -0,0 +1,30 @@
1
+package app.insa.clav.UISubStages;
2
+
3
+import app.insa.clav.Core.Model;
4
+import app.insa.clav.Reseau.TCPChatConnection;
5
+import app.insa.clav.UIControllers.ChatWindowController;
6
+import javafx.fxml.FXMLLoader;
7
+import javafx.scene.Parent;
8
+import javafx.scene.Scene;
9
+import javafx.stage.Stage;
10
+
11
+import java.io.IOException;
12
+
13
+public class ChatStage extends Stage {
14
+
15
+    public ChatStage(TCPChatConnection tcpCo){
16
+        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/chatWindow.fxml"));
17
+        try {
18
+            Parent rootChat = fxmlLoader.load();
19
+            ChatWindowController ctrl = fxmlLoader.getController();
20
+            ctrl.setTCPCo(tcpCo);
21
+            this.setTitle("Chat Room");
22
+            this.setScene(new Scene(rootChat, 500, 400));
23
+            this.setMinHeight(400);
24
+            this.setMinWidth(500);
25
+            this.show();
26
+        } catch (IOException e) {
27
+            e.printStackTrace();
28
+        }
29
+    }
30
+}

+ 1
- 1
src/main/java/app/insa/clav/UISubStages/PseudoStage.java View File

@@ -14,7 +14,7 @@ import java.io.IOException;
14 14
  */
15 15
 public class PseudoStage extends Stage {
16 16
 
17
-    public PseudoStage(Model model){
17
+    public PseudoStage(){
18 18
         FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/pseudoWindow.fxml"));
19 19
         try {
20 20
             Parent rootPseudo = fxmlLoader.load();

+ 19
- 0
src/main/resources/fxml/chatWindow.fxml View File

@@ -0,0 +1,19 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+
3
+<?import com.jfoenix.controls.JFXButton?>
4
+<?import javafx.scene.control.ListView?>
5
+<?import javafx.scene.control.TextField?>
6
+<?import javafx.scene.layout.AnchorPane?>
7
+<?import org.kordamp.ikonli.javafx.FontIcon?>
8
+
9
+<AnchorPane fx:id="rootAnchor" prefHeight="400.0" prefWidth="500.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="app.insa.clav.UIControllers.ChatWindowController">
10
+   <children>
11
+      <ListView fx:id="messageList" layoutX="20.0" layoutY="22.0" prefHeight="287.0" prefWidth="448.0" />
12
+      <TextField fx:id="messageInput" layoutX="31.0" layoutY="334.0" prefHeight="26.0" prefWidth="293.0" promptText="Message..." />
13
+      <JFXButton onAction="#buttonSendMessageClicked" fx:id="sendButton" buttonType="RAISED" layoutX="373.0" layoutY="334.0" ripplerFill="#36b90e" style="-fx-background-color: fc8c03;" text="Send">
14
+         <graphic>
15
+            <FontIcon iconLiteral="fa-send" wrappingWidth="16.0" />
16
+         </graphic>
17
+      </JFXButton>
18
+   </children>
19
+</AnchorPane>

+ 10
- 1
src/main/resources/fxml/mainWindow.fxml View File

@@ -3,7 +3,9 @@
3 3
 <?import com.jfoenix.controls.JFXDrawer?>
4 4
 <?import com.jfoenix.controls.JFXHamburger?>
5 5
 <?import com.jfoenix.controls.JFXListView?>
6
+<?import javafx.scene.control.ContextMenu?>
6 7
 <?import javafx.scene.control.Label?>
8
+<?import javafx.scene.control.MenuItem?>
7 9
 <?import javafx.scene.effect.Shadow?>
8 10
 <?import javafx.scene.layout.AnchorPane?>
9 11
 <?import javafx.scene.text.Font?>
@@ -15,7 +17,14 @@
15 17
             <Shadow color="#b103ff" height="0.0" radius="0.0" width="0.0" />
16 18
          </effect></JFXHamburger>
17 19
       <JFXDrawer fx:id="mainDrawer" defaultDrawerSize="120.0" direction="RIGHT" layoutX="460.0" prefHeight="400.0" prefWidth="150.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="460.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
18
-      <JFXListView fx:id="userListView" depth="10" layoutX="40.0" layoutY="96.0" prefHeight="304.0" prefWidth="200.0" style="-fx-background-color: a1c3f7;" verticalGap="1.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="40.0" AnchorPane.rightAnchor="360.0" AnchorPane.topAnchor="96.0" />
20
+      <JFXListView fx:id="userListView" depth="10" layoutX="40.0" layoutY="96.0" prefHeight="304.0" prefWidth="200.0" style="-fx-background-color: a1c3f7;" verticalGap="1.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="40.0" AnchorPane.rightAnchor="360.0" AnchorPane.topAnchor="96.0">
21
+         <contextMenu>
22
+            <ContextMenu>
23
+              <items>
24
+                <MenuItem fx:id="openChatButton" mnemonicParsing="false" onAction="#openChat" text="Open Chat" />
25
+              </items>
26
+            </ContextMenu>
27
+         </contextMenu></JFXListView>
19 28
       <Label fx:id="mainLabel" layoutX="74.0" layoutY="16.0" prefHeight="30.0" prefWidth="302.0" style="-fx-font-weight: bold;" text="Welcome, please choose a pseudo" textAlignment="CENTER" textFill="#ed0e7f" wrapText="true">
20 29
          <font>
21 30
             <Font name="Ubuntu" size="17.0" />

Loading…
Cancel
Save