diff --git a/Implementation/.classpath b/Implementation/.classpath
index b5891cf..e10c6e7 100644
--- a/Implementation/.classpath
+++ b/Implementation/.classpath
@@ -6,5 +6,6 @@
+
diff --git a/Implementation/jgoodies-forms-1.8.0-sources.jar b/Implementation/jgoodies-forms-1.8.0-sources.jar
new file mode 100644
index 0000000..b680434
Binary files /dev/null and b/Implementation/jgoodies-forms-1.8.0-sources.jar differ
diff --git a/Implementation/jgoodies-forms-1.8.0.jar b/Implementation/jgoodies-forms-1.8.0.jar
new file mode 100644
index 0000000..5e4585f
Binary files /dev/null and b/Implementation/jgoodies-forms-1.8.0.jar differ
diff --git a/Implementation/src/View_Clavardage.java b/Implementation/src/View_Clavardage.java
index e81aaad..b609d71 100644
--- a/Implementation/src/View_Clavardage.java
+++ b/Implementation/src/View_Clavardage.java
@@ -1,12 +1,28 @@
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
import javax.swing.JFrame;
+import javax.swing.JLabel;
import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.SwingConstants;
+import com.jgoodies.forms.layout.FormLayout;
+import com.jgoodies.forms.layout.ColumnSpec;
+import com.jgoodies.forms.layout.RowSpec;
+import java.awt.GridBagLayout;
+import java.awt.Font;
+import java.awt.Color;
+import java.awt.GridBagConstraints;
+import java.awt.Insets;
public class View_Clavardage {
JFrame frame ;
@@ -18,36 +34,160 @@ public class View_Clavardage {
public View_Clavardage(ChatApp app, String User2) {
this.app = app ;
this.frame = new JFrame("ChatApp-AL-NM");
- this.destination = this.app.getMe();
- this.source = Utilisateur.stringToUtilisateur(User2);
+ this.source = this.app.getMe();
+ this.destination = Utilisateur.stringToUtilisateur(User2);
this.frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); // FERME TOUTE LES FENETRES ATTENTION
// fixer les dimensions de la fenetre
this.frame.setSize(new Dimension(394, 344));
+ this.frame.setResizable(false);
+
wa = new WindowAdapter(){
public void windowClosing(WindowEvent e){
int reponse = View_Courante.showConfirmDialog();
if (reponse==0){
- try {
- app.deconnexion();
- } catch (IOException e1) {
- e1.printStackTrace();
- }
frame.dispose();
}
}};
- panel = new JPanel();
+ GridBagLayout gridBagLayout = new GridBagLayout();
+ gridBagLayout.columnWidths = new int[]{394, 0};
+ gridBagLayout.rowHeights = new int[]{16, 220, 74, 0};
+ gridBagLayout.columnWeights = new double[]{0.0, Double.MIN_VALUE};
+ gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
+ frame.getContentPane().setLayout(gridBagLayout);
+ panel = new JPanel();
+ JTextArea textAreaSaisie = new JTextArea(5,3);
+ textAreaSaisie.setForeground(Color.LIGHT_GRAY);
+ textAreaSaisie.setFont(new Font("Lucida Grande", Font.ITALIC, 11));
+ textAreaSaisie.setText("Entrer du texte ici !!!");
+ JScrollPane scrollPane = new JScrollPane(textAreaSaisie);
+ JButton send = new JButton("Envoye");
+ frame.getRootPane().setDefaultButton(send);
+ send.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent event) {
+ //UTILISER TCPENVOI
+ textAreaSaisie.setText("");
+ }});
+ JButton reset = new JButton("Vider");
+ reset.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent event) {
+ textAreaSaisie.setText("");
+ }});
+ JLabel titre = new JLabel("Chat avec "+ this.destination.getPseudo(),SwingConstants.CENTER);
+ GridBagConstraints gbc_titre = new GridBagConstraints();
+ gbc_titre.anchor = GridBagConstraints.NORTH;
+ gbc_titre.fill = GridBagConstraints.HORIZONTAL;
+ gbc_titre.insets = new Insets(0, 0, 5, 0);
+ gbc_titre.gridx = 0;
+ gbc_titre.gridy = 0;
+ frame.getContentPane().add(titre, gbc_titre);
+ JTextArea textAreaAffichage = new JTextArea(10,5);
+ textAreaAffichage.setText("");
+ JScrollPane scrollPaneAffichage = new JScrollPane(textAreaAffichage);
+ textAreaAffichage.setEditable(false);
+ GridBagConstraints gbc_textAreaAffichage = new GridBagConstraints();
+ gbc_textAreaAffichage.fill = GridBagConstraints.BOTH;
+ gbc_textAreaAffichage.insets = new Insets(0, 0, 5, 0);
+ gbc_textAreaAffichage.gridx = 0;
+ gbc_textAreaAffichage.gridy = 1;
+ frame.getContentPane().add(scrollPaneAffichage, gbc_textAreaAffichage);
+ panel.add(BorderLayout.CENTER, scrollPane);
+ //panel.add(scrollPane);
+ panel.add(BorderLayout.SOUTH,send);
+ panel.add(BorderLayout.SOUTH,reset);
+ panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
+ //Add the panel to the window.
+ GridBagConstraints gbc_panel = new GridBagConstraints();
+ gbc_panel.anchor = GridBagConstraints.NORTH;
+ gbc_panel.fill = GridBagConstraints.HORIZONTAL;
+ gbc_panel.gridx = 0;
+ gbc_panel.gridy = 2;
+ frame.getContentPane().add(panel, gbc_panel);
+ //addWidgets();
frame.addWindowListener( wa ) ;
- //Add the widgets.
- this.addWidgets();
-
- //Add the panel to the window.
- frame.getContentPane().add(this.panel, BorderLayout.CENTER);
-
- //Display the window.
- //frame.pack();
+
frame.setVisible(true);
}
- private void addWidgets() {}
+ private void addWidgets() {
+ panel = new JPanel();
+ JTextArea textAreaSaisie = new JTextArea(5,5);
+ textAreaSaisie.setForeground(Color.LIGHT_GRAY);
+ textAreaSaisie.setFont(new Font("Lucida Grande", Font.ITALIC, 11));
+ textAreaSaisie.setText("Entrer du texte ici !!!");
+ JScrollPane scrollPane = new JScrollPane(textAreaSaisie);
+ JButton send = new JButton("Envoye");
+ frame.getRootPane().setDefaultButton(send);
+ send.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent event) {
+ //UTILISER TCPENVOI
+ textAreaSaisie.setText("");
+ }});
+ JButton reset = new JButton("Vider");
+ reset.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent event) {
+ textAreaSaisie.setText("");
+ }});
+ JLabel titre = new JLabel("Chat avec "+ this.destination.getPseudo(),SwingConstants.CENTER);
+ GridBagConstraints gbc_titre = new GridBagConstraints();
+ gbc_titre.anchor = GridBagConstraints.NORTH;
+ gbc_titre.fill = GridBagConstraints.HORIZONTAL;
+ gbc_titre.insets = new Insets(0, 0, 5, 0);
+ gbc_titre.gridx = 0;
+ gbc_titre.gridy = 0;
+ frame.getContentPane().add(titre, gbc_titre);
+ JTextArea textAreaAffichage = new JTextArea(10,5);
+ textAreaAffichage.setEditable(false);
+ GridBagConstraints gbc_textAreaAffichage = new GridBagConstraints();
+ gbc_textAreaAffichage.fill = GridBagConstraints.BOTH;
+ gbc_textAreaAffichage.insets = new Insets(0, 0, 5, 0);
+ gbc_textAreaAffichage.gridx = 0;
+ gbc_textAreaAffichage.gridy = 1;
+ frame.getContentPane().add(textAreaAffichage, gbc_textAreaAffichage);
+ panel.add(BorderLayout.CENTER, scrollPane);
+ //panel.add(scrollPane);
+ panel.add(BorderLayout.SOUTH,send);
+ panel.add(BorderLayout.SOUTH,reset);
+ panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
+ //Add the panel to the window.
+ GridBagConstraints gbc_panel = new GridBagConstraints();
+ gbc_panel.anchor = GridBagConstraints.NORTH;
+ gbc_panel.fill = GridBagConstraints.HORIZONTAL;
+ gbc_panel.gridx = 0;
+ gbc_panel.gridy = 2;
+ frame.getContentPane().add(panel, gbc_panel);
+
+ /*
+ *
+ *JTextArea textAreaAffichage = new JTextArea(10,5);
+ textAreaAffichage.setEditable(false);
+ JTextArea textAreaSaisie = new JTextArea(10,5);
+ textAreaSaisie.setForeground(Color.LIGHT_GRAY);
+ textAreaSaisie.setFont(new Font("Lucida Grande", Font.ITALIC, 11));
+ textAreaSaisie.setText("Entrer du texte ici !!!");
+ JScrollPane scrollPane = new JScrollPane(textAreaSaisie);
+ JButton send = new JButton("Envoye");
+ frame.getRootPane().setDefaultButton(send);
+ send.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent event) {
+ //UTILISER TCPENVOI
+ textAreaSaisie.setText("");
+ }});
+ JButton reset = new JButton("Vider");
+ reset.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent event) {
+ textAreaSaisie.setText("");
+ }});
+ JLabel titre = new JLabel("Chat avec "+ this.destination.getPseudo(),SwingConstants.CENTER);
+ panel.add(BorderLayout.CENTER, scrollPane);
+ //panel.add(scrollPane);
+ panel.add(BorderLayout.SOUTH,send);
+ panel.add(BorderLayout.SOUTH,reset);
+ panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
+ //Add the panel to the window.
+ frame.getContentPane().add(BorderLayout.SOUTH, panel);
+ frame.getContentPane().add(BorderLayout.CENTER, textAreaAffichage);
+ frame.getContentPane().add(BorderLayout.NORTH, titre);
+ */
+ }
}
diff --git a/Implementation/src/View_Courante.java b/Implementation/src/View_Courante.java
index f082544..bf5d39c 100644
--- a/Implementation/src/View_Courante.java
+++ b/Implementation/src/View_Courante.java
@@ -129,25 +129,25 @@ public class View_Courante {
public void actionPerformed(ActionEvent event) {
JPanel panel1 = new JPanel();
JButton home = new JButton(new ImageIcon("/Users/auriane/Desktop/ChatApp-AL-NM/Implementation/src/images/Home.png"));
- panel1.add(BorderLayout.NORTH , home);
- JLabel Text = new JLabel(" Liste Utilisateurs Actifs
");
- panel1.add(Text);
+ JTextArea textArea = new JTextArea(20,20);
+ textArea.insert("Liste Utilisateurs Actifs \n",0);
+ JScrollPane scrollPane = new JScrollPane(textArea);
String utilisateurs = app.getActifUsers().afficherListeUtilisateurs();
for(String elem : utilisateurs.split("\n")) {
- JLabel Text1 = new JLabel("" + elem + "
");
- panel1.add(Text1);
+ textArea.append( " - " +Utilisateur.stringToUtilisateur(elem).getPseudo() + '\n');
}
-
+ panel1.add(textArea);
home.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event) {
frame.dispose();
new View_Courante(app);
} });
-
+ textArea.setEditable(false);
frame.getContentPane().removeAll();
- frame.getContentPane().add(panel1);
+ frame.getContentPane().add(BorderLayout.CENTER, panel1);
+ frame.getContentPane().add(BorderLayout.NORTH , home);
frame.setVisible(true);
}});