GBC.gridwidth=1; ((GridBagLayout)getLayout()).setConstraints(LblPWD,GBC); add(LblPWD); GBC.gridwidth=1; ((GridBagLayout)getLayout()).setConstraints(TxtPWD,GBC); add(TxtPWD); GBC.gridwidth=1; GBC.weightx=2; ((GridBagLayout)getLayout()).setConstraints(BtnConn,GBC); add(BtnConn); GBC.gridwidth=GridBagConstraints.REMAINDER; ((GridBagLayout)getLayout()).setConstraints(BtnClose,GBC); add(BtnClose); GBC.gridwidth=GridBagConstraints.REMAINDER; GBC.fill = GridBagConstraints.HORIZONTAL; ((GridBagLayout)getLayout()).setConstraints(lsArea,GBC); add(lsArea); } public boolean connect(String hostname, String uid,String pwd) { this.hostname = hostname; LblPrompt.setText("正在连接,请等待....."); try{ aftp =new FtpClient(hostname); aftp.login(uid,pwd); aftp.binary(); showFileContents(); } catch(FtpLoginException e){ a="无权限与主机:"+hostname+"连接!"; LblPrompt.setText(a); return false; } catch (IOException e){ a="连接主机:"+hostname+"失败!"; LblPrompt.setText(a); return false; } catch(SecurityException e) { a="无权限与主机:"+hostname+"连接!"; LblPrompt.setText(a); return false; } LblPrompt.setText("连接主机:"+hostname+"成功!"); return true; } |
閺€鎯版閹存劕濮�閺屻儳婀呴弨鎯版>>
正在阅读:Java实现ftp功能Java实现ftp功能
2004-04-05 14:41
出处:Javajia
责任编辑:sdq
键盘也能翻页,试试“← →”键