我已经搜索了很多,但我无法使用java从Socket接收字节我也有一个jprogressbar我无法更新它同时接收字节来设置值 所以我试过这段代码:
private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_ENTER){
String az = jTextField1.getText();
if(az.contains("1")){
String hh = WorkSpace.jTextField1.getText();
Socket so = new Socket();
InputStream is = null;
ProgressMonitorInputStream pmis = null;
int buffer;
try {
so.getInputStream();
buffer = so.getReceiveBufferSize();
WorkSpace.jProgressBar1.setValue(buffer);
WorkSpace.jEditorPane1.setPage("http://www.google.com/search?q=" + hh );
}
catch (Exception e) {
}
}
请允许任何机构在我的代码中说出错误并提前致谢