Source code: com/yaftp/ftp/gui/TestFtpConnectBean.java
1 /**
2 *
3 * CopyRights Jean-Yves MENGANT 1999,2000,2001,2002
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19 package com.yaftp.ftp.gui ;
20
21 import java.awt.* ;
22 import java.awt.event.* ;
23
24 import com.yaftp.ftp.* ;
25
26 /**
27
28 Test FTP BEAN
29
30 */
31
32 public class TestFtpConnectBean
33 extends Frame {
34
35 Button _connect = new Button(" connect ") ;
36 Ftp _connection ;
37
38
39 class _CONNECT_FTP implements ActionListener {
40
41 public void actionPerformed ( ActionEvent e )
42 {
43 _connection.connect() ;
44 }
45
46 }
47
48 public TestFtpConnectBean( String srv , String userId , String passWd )
49 {
50 setTitle("Test Ftp Connect") ;
51 setLayout( new BorderLayout() ) ;
52 addWindowListener( new WL() ) ;
53 setSize(100,100) ;
54 add( _connect , BorderLayout.CENTER ) ;
55 _connect.addActionListener( new _CONNECT_FTP() ) ;
56 _connection = new Ftp() ;
57 _connection.set_ftpServerName(srv) ;
58 _connection.set_userId(userId) ;
59 _connection.set_passWord(passWd) ;
60
61 show() ;
62 }
63
64 // Exit the debug window frame
65 class WL extends WindowAdapter{
66 public void windowClosing( WindowEvent e )
67 {
68 System.exit(0) ;
69 }
70 }
71
72
73
74 public static void main( String arg [] )
75 {
76 String srvName = null ;
77 String userId = null ;
78 String psw = null ;
79
80 if ( arg.length >= 1 )
81 srvName = arg[0] ;
82
83 if ( arg.length >= 2 )
84 userId = arg[1] ;
85
86 if ( arg.length >= 3 )
87 psw = arg[2] ;
88
89 Frame f = new TestFtpConnectBean( srvName , userId , psw ) ;
90 }
91 }