bonjour voici un autre probleme que jai rencontré avec jtable:ma table est editable avec l'utilisateur,j'ai crée mon cell editor mais ca ne fonctionne pas(ce sont des textfiels qui doit etre rempli.voici mon code:
CellEditor
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
 
public class PayoffTableEditor extends AbstractCellEditor implements TableCellEditor{
 
	    JTextField CasePayoff=null; 
	    JTable PayoffMatrice;
	    PayoffTableModel Model;
 
 
 
	    public PayoffTableEditor() {
	        this.CasePayoff=new JTextField ();
	    }
 
 
		@Override
		public Component getTableCellEditorComponent(JTable PayoffMatrice, Object aValue,boolean isSelected, int parm1, int parm2) {
			CasePayoff.setText("");
			SwingUtilities.invokeLater(new Runnable() {
				public void run() {
				CasePayoff.requestFocus();
				}});
			return CasePayoff;
		}
 
 
		@Override
		public Object getCellEditorValue() {
 
			return this.getTextField().getText();
		}
 
 
		private JTextComponent getTextField() {
			// TODO Auto-generated method stub
			return this.CasePayoff;
		}
 
}
et voicile code ajouter dans linterface
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
 
PayoffTableModel model = new PayoffTableModel(nbColonnes,nbLignes);
						// creation de la table
						PayoffMatrice.setModel(model);
						PayoffMatrice.setCellEditor(new PayoffTableEditor());
en faite l'application donne la main a lutilisateur pour saisir mais le text saisi n'est pas pris.
SVP j'ai besoin daide urgente car c le début de lapplication et me reste partie jGraph qui est plus difficile
merci