⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 quickftpdialog.java

📁 JavaExplorer是一个独立于平台的浏览器
💻 JAVA
字号:
/**  * File and FTP Explorer  * Copyright 2002  * BOESCH Vincent  *  * This program is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License  * as published by the Free Software Foundation; either version 2  * of the License, or (at your option) any later version.  *  * This program is distributed in the hope that it will be useful,  * but WITHOUT ANY WARRANTY; without even the implied warranty of  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  * GNU General Public License for more details.  *  * You should have received a copy of the GNU General Public License  * along with this program; if not, write to the Free Software  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */package javaexplorer.gui.dialog;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javaexplorer.Launcher;import javaexplorer.model.XFile;import javaexplorer.util.ftp.Ftp;import javax.swing.*;import javax.swing.border.*;/** *@author     BOESCH Vincent *@created    21 janvier 2002 *@version    3.3 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. * */public class QuickFtpDialog extends JDialog implements ActionListener {    private Launcher _launcher = null;    private BorderLayout borderLayout1 = new BorderLayout();    private GridLayout gridLayout1 = new GridLayout();    private JLabel jLabel1 = new JLabel();    private JLabel jLabel2 = new JLabel();    private JLabel jLabel3 = new JLabel();    private JLabel jLabel4 = new JLabel();    private JLabel jLabel5 = new JLabel();    private JPanel jPanel1 = new JPanel();    private JPanel jPanel2 = new JPanel();    private JButton jbtCancel = new JButton();    private JButton jbtConnect = new JButton();    private JCheckBox jcbPasvMode = new JCheckBox();    private JTextField jtfHost = new JTextField();    private JTextField jtfPassword = new JTextField();    private JTextField jtfPort = new JTextField();    private JTextField jtfUser = new JTextField();    private TitledBorder titledBorder1;    /**     *  Constructeur objet QuickFtpDialog     *     *@param  frame     Description of the     *      Parameter     *@param  launcher  Description of the     *      Parameter     */    public QuickFtpDialog(JFrame frame, Launcher launcher) {        super(frame, "FTP Connect...", true);        _launcher = launcher;        try {            jbInit();        } catch (Exception e) {            javaexplorer.util.Log.addError(e);        }    }    /**     *  Description de la methode     *     *@param  e  Description of the Parameter     */    public void actionPerformed(ActionEvent e) {        Object obj = e.getSource();        if (obj == jbtConnect) {            createFtp();        }        this.setVisible(false);        this.dispose();    }    /**     *  Description de la methode     */    public void createFtp() {        String host = jtfHost.getText();        if ((host == null) || (host.length() == 0)) {            host = null;        }        String user = jtfUser.getText();        if ((user == null) || (user.length() == 0)) {            user = "anonymous";        }        String password = jtfPassword.getText();        if ((password == null) || (password.length() == 0)) {            password = "guest";        }        int port = 21;        try {            port = Integer.parseInt(jtfPort.getText());        } catch (NumberFormatException nfe) {            port = 21;        }        boolean pasvMode = jcbPasvMode.isSelected();        if (host != null) {            Ftp ftp = new Ftp();            ftp.setTitle("Quick Connect");            ftp.setHost(host);            ftp.setUser(user);            ftp.setPassword(password);            ftp.setPort(port);            ftp.setUsePassiveMode(pasvMode);            XFile ef = _launcher.getXUtil().createXFile(ftp);            _launcher.getMDIModel().makeEFFrame(ef);        }    }    /**     *  Description de la methode     *     *@throws  Exception  Description of the     *      Exception     */    private void jbInit() throws Exception {        titledBorder1 = new TitledBorder("");        jtfUser.setToolTipText("");        jLabel2.setText("host");        jLabel3.setText("user");        jtfPort.setToolTipText("");        jLabel4.setText("password");        jLabel5.setText("port");        jtfPassword.setToolTipText("");        jtfHost.setToolTipText("");        this.getContentPane().setLayout(borderLayout1);        jPanel1.setLayout(gridLayout1);        gridLayout1.setRows(5);        gridLayout1.setColumns(2);        gridLayout1.setHgap(10);        gridLayout1.setVgap(5);        borderLayout1.setHgap(10);        jPanel1.setBorder(titledBorder1);        jbtConnect.setText("Connect");        jbtConnect.setToolTipText("");        jbtConnect.addActionListener(this);        jbtCancel.setText("Cancel");        jbtCancel.setToolTipText("");        jbtCancel.addActionListener(this);        this.setResizable(false);        jLabel1.setText("use passive mode");        this.getContentPane().add(jPanel1, BorderLayout.CENTER);        jPanel1.add(jLabel2, null);        jPanel1.add(jtfHost, null);        jPanel1.add(jLabel3, null);        jPanel1.add(jtfUser, null);        jPanel1.add(jLabel4, null);        jPanel1.add(jtfPassword, null);        jPanel1.add(jLabel5, null);        jPanel1.add(jtfPort, null);        jPanel1.add(jLabel1, null);        jPanel1.add(jcbPasvMode, null);        this.getContentPane().add(jPanel2, BorderLayout.SOUTH);        jPanel2.add(jbtConnect, null);        jPanel2.add(jbtCancel, null);        jtfHost.requestFocus();    }    /**     *  Sets the launcher attribute of the     *  QuickFtpDialog object     *     *@param  launcher  The new launcher value     */    public void setLauncher(Launcher launcher) {        _launcher = launcher;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -