lien controller-view
This commit is contained in:
parent
2562a1ed3b
commit
27d44abacf
2 changed files with 14 additions and 10 deletions
|
@ -70,11 +70,7 @@ public class Controller {
|
|||
|
||||
notify_remote_users();
|
||||
|
||||
javax.swing.SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
hisView.createAndShowGUI();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -432,7 +428,9 @@ public class Controller {
|
|||
Controller ctr3 = new Controller(12224,portUDPlistening_remoteUsr3,22223,"Alice");
|
||||
Controller ctr1 = new Controller(12225,20001,22221); // Notre utilisateur local
|
||||
|
||||
|
||||
// Création de l'interface
|
||||
ctr1.hisView=Interface.createAndShowGUI(ctr1);
|
||||
|
||||
// Fonction appelé par notre utilisateur local
|
||||
ctr1.getOneActiveUser();
|
||||
ctr1.changePseudo();
|
||||
|
|
|
@ -23,6 +23,10 @@ public class Interface implements ActionListener {
|
|||
//null (use the default), "Metal", "System", "Motif", "GTK+"
|
||||
final static String LOOKANDFEEL = "System";
|
||||
|
||||
public Interface(Controller controller) {
|
||||
this.controller = controller;
|
||||
}
|
||||
|
||||
public Component createComponents() {
|
||||
PseudotextField = new JTextField(); //Pseudo setup
|
||||
PseudotextField.setColumns(10);
|
||||
|
@ -128,7 +132,7 @@ public class Interface implements ActionListener {
|
|||
* this method should be invoked from the
|
||||
* event-dispatching thread.
|
||||
*/
|
||||
public static void createAndShowGUI() {
|
||||
public static Interface createAndShowGUI(Controller controller) {
|
||||
//Set the look and feel.
|
||||
initLookAndFeel();
|
||||
|
||||
|
@ -139,15 +143,17 @@ public class Interface implements ActionListener {
|
|||
JFrame frame = new JFrame("SwingApplication");
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
Interface app = new Interface();
|
||||
Interface app = new Interface(controller);
|
||||
Component contents = app.createComponents();
|
||||
frame.getContentPane().add(contents, BorderLayout.CENTER);
|
||||
|
||||
//Display the window.
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
return app;
|
||||
}
|
||||
/*
|
||||
public static void main(String[] args) throws IOException {
|
||||
//Schedule a job for the event-dispatching thread:
|
||||
//creating and showing this application’s GUI.
|
||||
|
@ -156,6 +162,6 @@ public class Interface implements ActionListener {
|
|||
createAndShowGUI();
|
||||
}
|
||||
});
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue