Implement FTP functions in java (source code)

Source: Internet
Author: User
Import sun.net. ftp .*;
Import sun.net .*;
Import java. awt .*;
Import java. awt. event .*;
Import java. applet .*;
Import java. io .*;
Public class FtpApplet extends Applet
{
FtpClient aftp;
DataOutputStream outputs;
TelnetInputStream ins;
TelnetOutputStream outs;
TextArea lsArea;
Label LblPrompt;
Button BtnConn;
Button BtnClose;
TextField TxtUID;
TextField TxtPWD;
TextField TxtHost;
Int ch;
Public String a = "no host connected ";
String hostname = "";
Public void init (){
SetBackground (Color. white );
SetLayout (new GridBagLayout ());
GridBagConstraints GBC = new GridBagConstraints ();
LblPrompt = new Label ("no host connected ");
LblPrompt. setAlignment (Label. LEFT );
BtnConn = new Button ("connection ");
BtnClose = new Button ("disconnected ");
BtnClose. enable (false );
TxtUID = new TextField ("", 15 );
TxtPWD = new TextField ("", 15 );
TxtPWD. setEchoCharacter ('*');
TxtHost = new TextField ("", 20 );
Label LblUID = new Label ("User ID :");
Label LblPWD = new Label ("PWD :");
Label LblHost = new Label ("Host :");
LsArea = new TextArea (30, 80 );
LsArea. setEditable (false );
GBC. gridwidth = GridBagConstraints. REMAINDER;
GBC. fill = GridBagConstraints. HORIZONTAL;
(GridBagLayout) getLayout (). setConstraints (LblPrompt, GBC );
Add (LblPrompt );
GBC. gridwidth = 1;
(GridBagLayout) getLayout (). setConstraints (LblHost, GBC );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.