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

📄 webdavhostchooser.java

📁 一个JAVA做的FTP软件,带源码的,可以很好的进行二次开发,,并带有详细说明文件的
💻 JAVA
字号:
/* * 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 net.sf.jftp.gui;import net.sf.jftp.*;import net.sf.jftp.config.*;import net.sf.jftp.gui.framework.*;import net.sf.jftp.net.*;import net.sf.jftp.util.*;import java.awt.*;import java.awt.event.*;import java.io.*;import java.net.*;import javax.swing.*;public class WebdavHostChooser extends HFrame implements ActionListener,                                                         WindowListener{    public static HTextField host = new HTextField("URL:", "http://localhost",                                                   35);    public static HTextField user = new HTextField("Username:", "guest");    //public static HTextField port = new HTextField("Port:","22");    public static HPasswordField pass = new HPasswordField("Password:",                                                           "nopasswd");    private HPanel okP = new HPanel();    private HButton ok = new HButton("Connect");    private ComponentListener listener = null;    private boolean useLocal = false;    public WebdavHostChooser(ComponentListener l, boolean local)    {        listener = l;        useLocal = local;        init();    }    public WebdavHostChooser(ComponentListener l)    {        listener = l;        init();    }    public WebdavHostChooser()    {        init();    }    public void init()    {        setSize(500, 200);        setLocation(100, 150);        setTitle("WebDAV Connection... (ALPHA STATE)");        setBackground(okP.getBackground());        host.setMinimumSize(new Dimension(500, 50));        getContentPane().setLayout(new BorderLayout(5, 5));        getContentPane().add("North", host);        HPanel p = new HPanel();        p.setLayout(new GridLayout(2, 2));        //***MY CHANGES        /*        try {                File f = new File(Settings.appHomeDir);                f.mkdir();                File f1 = new File(Settings.login);                f1.createNewFile();                File f2 = new File(Settings.login_def_sftp);                f2.createNewFile();                File f3 = new File(Settings.ls_out);                f3.createNewFile();                File f4 = new File(Settings.sortls_out);                f4.createNewFile();                File f5 = new File(Settings.sortsize_out);                f5.createNewFile();                File f6 = new File(Settings.permissions_out);                f6.createNewFile();        } catch (IOException ex) {                ex.printStackTrace();        }        LoadSet l = new LoadSet();        String login[] = l.loadSet(Settings.login_def_sftp);        if (login[0] != null) {                host.setText(login[0]);                user.setText(login[1]);        }        */        /*        else {                host.setText("localhost");                user.setText("guest");        }        */        /*        if (Settings.getStorePasswords()) {                if (login != null) {                        pass.setText(login[2]);                }        } else                pass.setText("");        */        //***end of my changes (for this section)        //getContentPane().add(host);        //getContentPane().add(new JLabel(" "));//port);        //getContentPane()        p.add(user);        //getContentPane()        p.add(pass);        //getContentPane()        p.add(new JLabel(""));        //getContentPane()        p.add(okP);        okP.add(ok);        getContentPane().add("South", p);        ok.addActionListener(this);        setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);        pass.text.addActionListener(this);        setModal(false);        setVisible(false);        addWindowListener(this);        //novell webdav test site        host.setText("http://www.planetpdf.com/planetpdf/webdavdemo/");        user.setText("guest");        pass.setText("guest");    }    public void update()    {        setVisible(true);        toFront();        host.requestFocus();    }    public void actionPerformed(ActionEvent e)    {        if((e.getSource() == ok) || (e.getSource() == pass.text))        {            setCursor(new Cursor(Cursor.WAIT_CURSOR));            String htmp = host.getText().trim();            String utmp = user.getText().trim();            String ptmp = pass.getText();            WebdavConnection con;            if(useLocal)            {                con = new WebdavConnection(htmp, utmp, ptmp,                                           (ConnectionListener) JFtp.localDir);                JFtp.statusP.jftp.addLocalConnection("Webdav", con);                con.chdir(htmp);            }            else            {                con = new WebdavConnection(htmp, utmp, ptmp,                                           (ConnectionListener) JFtp.remoteDir);                JFtp.statusP.jftp.addConnection("Webdav", con);                con.chdir(htmp);            }            setCursor(new Cursor(Cursor.DEFAULT_CURSOR));            this.dispose();            JFtp.mainFrame.setVisible(true);            JFtp.mainFrame.toFront();            if(listener != null)            {                listener.componentResized(new ComponentEvent(this, 0));            }        }    }    public void windowClosing(WindowEvent e)    {        //System.exit(0);        this.dispose();    }    public void windowClosed(WindowEvent e)    {    }    public void windowActivated(WindowEvent e)    {    }    public void windowDeactivated(WindowEvent e)    {    }    public void windowIconified(WindowEvent e)    {    }    public void windowDeiconified(WindowEvent e)    {    }    public void windowOpened(WindowEvent e)    {    }    public Insets getInsets()    {        Insets std = super.getInsets();        return new Insets(std.top + 15, std.left + 15, std.bottom + 15,                          std.right + 15);    }    public void pause(int time)    {        try        {            Thread.sleep(time);        }        catch(Exception ex)        {        }    }}

⌨️ 快捷键说明

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