...
Damned, you use as few words as possible!
long sendFile(DataOutputStream osw, File sp,long fromSize) throws
Exception{
FileInputStream fi=new FileInputStream(sp);
fi.skip(fromSize);
int b,maxSize=maxPost;
long curSize=fromSize;
boolean byl=false;
byte[] dane = new byte[1024];
long ofKB=(long)sp.length()/1024;
long curKB;
while ((b=fi.read(dane))!=-1){
byl=true;
int postep=(int)(100*curSize/sp.length());
curKB=(long)curSize/1024;
progress.setValue(postep);
progress.update(progress.getGraphics());
progress.repaint();
updateLabels("Wyslane: " + curSize);
osw.write(dane, 0, b);
maxSize-=b;
curSize+=b;
if(maxSize<=0) break;
if (stopFlags==1) break;
}
osw.flush();
labpostep.setText("");
System.out.println("Sending from=" + fromSize +"; to=" + curSize);
return curSize;
}
public void updateLabels(final String i) { /not working/
javax.swing.SwingUtilities.invokeLater( new Runnable() {
public void run() {
labpostep.setText(i +"");
}
});
}
public void updateLabels(final String i) { /not working/
labpostep.setText(i +"");
labpostep.repaint();
}
}
this code is running by java.awt.EventQueue.invokeLater(new Runnable()
rf