Bonjour, je suis en train de d'essayer de developper avec mvc mais j'ai un probleme, eclipse veut m'obliger à mettre mes methodes en static ce qui pose un problème pour pouvoir notifier mes observers après.
Voici le code ma view, la methode qui pose probleme est celle
Softphonecontroler.ajoutdecontact(value1,value2,value3);

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package Softphone;
 
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Observable;
import java.util.Observer;
 
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
 
public class Softphoneview extends JFrame implements Observer {
 
 
JPanel panel1 ;
 
// ajout d'un bouton	
JButton ajout = new JButton ("Ajouter un contact");
private JPanel pan = new JPanel();
private JTextField entree = new JTextField(20);
private JTextField entree1 = new JTextField(20);
private JTextField entree2 = new JTextField(20);
Softophone softphone ;
public Softphoneview(Softophone softphone, Softphonecontroler controler)
{
	super();
	this.softphone = softphone ;
	this.softphone.addObserver(this);
	this.setTitle("Bouton");
	this.setSize(700, 550);
	this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	this.setLocationRelativeTo(null);
	pan.setLayout(new FlowLayout());
	pan.add(ajout);
	pan.add(entree);
	pan.add(entree1);
	pan.add(entree2);
	this.setContentPane(pan);
	this.setVisible(true);
			ajout.addActionListener(new ActionListener(){
				public void actionPerformed(ActionEvent event){
					//Via cette instruction, on passe au prochain conteneur de la pile
					String value1 = entree.getText();
					String value2 = entree1.getText();
					String value3 = entree2.getText();
					Softphonecontroler.ajoutdecontact(value1,value2,value3);
      }
    });
}
 
 
 
	@Override
	public void update(Observable o, Object arg) {
		// TODO Auto-generated method stub
 
	}
 
 
}
voici le code de mon controler

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package Softphone;
 
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.JTextField;
 
public class Softphonecontroler implements ActionListener {
 
	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
 
 
 
 
	}
 
 
 
	public void ajoutdecontact(String value1, String value2,
			String value3) {
		// TODO Auto-generated method stub
 
		Softophone.createcontact(value1,value2,value3);
	}
 
 
 
 
 
 
}
Si quelqun peut m'aider à resoudre ce problème ?