mam kod z timerem zakomentowanym
public SimpleTableModel getTableModel1() {
if (tableModel1 == null) {
// write pre-init user code here
tableModel1 = new SimpleTableModel(new java.lang.String[][] {
new java.lang.String[] { "", "", "", "", "" }}, null);
// write post-init user code here
this.dt.httpAddress = "http://kolos.math.uni.lodz.pl/~bart/tekstowy.txt";
final DataTransfer mt = this.dt;
///*
Timer t = new Timer();
TimerTask tt = new TimerTask() {
int count = 0;
public void run() {
//*/
String[] arrString = new String[5];
tableModel1.setValues(mt.getArrayModel());
Vector vec = new Vector();
vec = mt.getVec();
for (int i=0; i<vec.size(); i++) {
for (int j=0; j<5; j++) {
arrString = (String[])vec.elementAt(i);
tableModel1.setValue(j, i, arrString[j]);
}
}
///*
}
};
t.schedule(tt,0, 20000);
//*/
}
return tableModel1;
}
co wyswietla:
http://kolos.math.uni.lodz.pl/~bart/1.JPG
oraz timerem odkomentowanym
public SimpleTableModel getTableModel1() {
if (tableModel1 == null) {
// write pre-init user code here
tableModel1 = new SimpleTableModel(new java.lang.String[][] {
new java.lang.String[] { "", "", "", "", "" }}, null);
// write post-init user code here
this.dt.httpAddress = "http://kolos.math.uni.lodz.pl/~bart/tekstowy.txt";
final DataTransfer mt = this.dt;
/*
Timer t = new Timer();
TimerTask tt = new TimerTask() {
int count = 0;
public void run() {
*/
String[] arrString = new String[5];
tableModel1.setValues(mt.getArrayModel());
Vector vec = new Vector();
vec = mt.getVec();
for (int i=0; i<vec.size(); i++) {
for (int j=0; j<5; j++) {
arrString = (String[])vec.elementAt(i);
tableModel1.setValue(j, i, arrString[j]);
}
}
/*
}
};
t.schedule(tt,0, 20000);
*/
}
return tableModel1;
}
co wyswietla:
http://kolos.math.uni.lodz.pl/~bart/2.JPG
nie rozumiem skad takie znieksztalcenie w pierwszym przypadku, myslalem ze to przez czestosc odswiezania ale przeciez to 20 sekund...
co moze byc tego przyczyna? bo niewatpliwie timer ma na to wplyw...
z gory dzieki za pomoc!