Bonjour tout le monde

J'ai regardé ce tuto

http://java.sun.com/docs/books/tutor...nts/table.html

Je n'arrive pas à adapter ce tuto à mon prog.

Voici la class des composant
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
 
 
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Color.*;
import javax.swing.JTable;
 
public class Elementbanque extends JPanel implements ActionListener
 
{
 
modetable mo = new modetable();
 
int i = mo.getrows();
 
JTextField pretdemand;
JTextField quotient;
JTextField sommetot;
JTextField temps;
 
JButton somme;
JButton quit;
 
JTable rembourcement;
 
public Elementbanque()
 
{
 
JLabel creditinsset = new JLabel("Crédit argon");
this.add(creditinsset);	
creditinsset.setForeground(Color.red);
 
	Font creditinssetfont = creditinsset.getFont();
	creditinssetfont = creditinssetfont.deriveFont(Font.BOLD).deriveFont(16f);
	creditinsset.setFont(creditinssetfont);
 
 
	JLabel sommedemand = new JLabel("Somme demandé");
	this.add(sommedemand);
 
	 pretdemand = new JTextField(10);
 
	this.add(pretdemand);
 
 
 
	JLabel taux = new JLabel("Taux");
	this.add(taux);
 
 
	 quotient = new JTextField(10);
 
	this.add(quotient);
 
	JLabel dette = new JLabel("Total due");
	this.add(dette);
 
	 sommetot = new JTextField(10);
	sommetot.addActionListener(this);	
 
 
 
	JLabel cal = new JLabel("calcul");
	this.add(cal);
 
	 somme = new JButton("somme");
	somme.addActionListener(this);
	this.add(somme);
 
	JLabel nbmois = new JLabel("période du pret");
	this.add(nbmois);
 
	 temps= new JTextField(10);
	this.add(temps);
 
 
 
	String[][] rowData = new String[i][2];
	String[] columnNames = new String[2];
 
	columnNames[0]="Date"; 
	columnNames[1]="Somme prélevée"; 
 
	rembourcement = new JTable(rowData,columnNames);
	JScrollPane sroll = new JScrollPane(rembourcement);
	this.add(sroll);
 
 
	 quit = new JButton("Quitter");
	quit.addActionListener(this);
	this.add(quit);
 
 
 
}
 
public void actionPerformed(ActionEvent evt) {
 
 
Calcul c = new Calcul();
 
 
 
Object source = evt.getSource();
 
 
int totalannee=0, moi=0, tempstaux=0; 
 
float totaldue=0; 
 
String riendanssommdemande="";
 
 
boolean som=false;
 
 
if(source==somme)
{
 
som=true;
 
int emprunt =  Integer.parseInt(pretdemand.getText());
 
int temp = Integer.parseInt(temps.getText());
 
 
float taux = Float.valueOf(quotient.getText());
 
 
 
 
sommetot.setText(Double.toString(c.pret(som, riendanssommdemande, taux, totalannee, tempstaux, moi, emprunt, totaldue, temp)));
 
}
 
if(source==quit)
{
 
System.exit(0);
 
}
 
	float real;
 
	real=c.getSommprelev();
 
	String paiement;
 
	paiement = String.valueOf(real);
 
rembourcement.setValueAt(paiement,i,1);
}
 
}

Voici la class de model de la table
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
 
 
import javax.swing.table.AbstractTableModel;
 
import java.util.Vector;
 
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.util.Date;
 
public class modetable extends AbstractTableModel
{
 
 
Calcul c = new Calcul();
 
GregorianCalendar calendar = new java.util.GregorianCalendar(); 
 
int ligne=0;
int j,nb;
float preleve=0;
 
 
public int getRowCount()
{
 
 
return rowData.length;
}
 
public int getColumnCount()
{
 
 
 
return 0;
}
 
public Object getValueAt(int rows, int cols)
{
 
 
 
return 0;
}
 
 
public void setValuAt(Object aValue,int row, int column)
{
 
 
 
return ;
}
 
public int getrows()
{
 
 
 
nb=c.getTemps();
 
nb=nb*12;
 
 
ligne=nb;
 
for(j=1;j<ligne;j++)
{
calendar.add(calendar.MONTH,1);
Date tempDate = calendar.getTime();
 
 
 
}
 
return j;
}
}
Je souhaiterais pouvoir afficher le résultat directement dans le tableau apres le click sur le bouton somme, ce resultat sera un plan appurement pour le rembourcement d'un prêt.

Pouvez vou m'aider.

Merci

Cordialement

A bientôt