トップ・ページの表示 注意書きの表示 掲示板に書き込む前に必ず この ”注意書き”を お読み下さい.

"伊邪那"

   
   

ページの表示順:{ 新しい順/ 古い順}.
初期・ページの表示・位置:{ 先頭ページ/ 末尾ページ}.
1ページ内のスレッド表示数:











<Number>: [0000096C]  <Date>: 2015/12/22 14:27:48
<Title>: Java2 FTP Connect 8『FTPConnect.java』
<Name>: amanojaku@管理人



今回はフォルダー単位の「アップロード、ダウンロード」(子フォルダーに対する再帰的な処理)
「ctfLocalFolder」には「絶対パス名、相対パス名」の どちらも指定可、パス名の先頭に"/"(スラシュ)が付いている場合は「絶対パス名」、パス名の先頭に"/"(スラシュ)が付いてない場合は「「相対パス名」となる(ファイル名を含める事はできない)。
「ctfHostFolder」は「絶対パス名」で指定して下さい、ファイル名を含める事も可能(ファイル名を含めた場合は「cltLocalFileList」はブランクになります)。
「ctfLocalFolder、ctfHostFolder」に対しダブル・クリックをサポート(「..」は親ディレクトリを表わしている、親ディレクトリを表示したい場合は「..」をダブル・クリックしてやる)。

《参考》
『Java2 FTP Connect 7』
http://artemis.rosx.net/sjis/smt.cgi?r+izanami/&bid+00000918&tsn+00000955.+&
『Java2 MouseDoubleClicked 1』
http://artemis.rosx.net/sjis/smt.cgi?r+izanami/&bid+00000918&tsn+0000096B.+&

クラスパスの設定
http://www.hot-surprise.org/IntroEclipse/Operation/N01/3_3.html

FTP に関するプログラムは下記ページを参照.

JavaによるFTP転送サンプル | Pa-kun plus idea
http://web.plus-idea.net/2011/06/javaftp/

> client.setControlEncoding("MS932");

↑ Host 側のキャラクター・セットを設定すれば良いと思われる。
Windows 系では「CP932」(Microsoft Windows CodePage 932)、UNIX 系では「UTF-8、EUC-JP(日本の場合)」などが大半のようだ、Android は「UTF-8」となる。
厳密に言うと Windows のキャラクター・セットは「shift_jis」と完全な互換ではない、今まで Windows のキャラクター・セットのスタンダードな表記法は「CP932」だったが、「commons-net-3.3」では「MS932」でないとエラーになるようだ.

JavaでFTPアップロードを行う。 - sinsengumi.net
http://sinsengumi.net/blog/2011/02/java%E3%81%A7ftp%E3%82%A2%E3%83%83%E3%83%97%E3%83%AD%E3%83%BC%E3%83%89%E3%82%92%E8%A1%8C%E3%81%86%E3%80%82/


(分かりやすければ他のファイル名でも良い)「MainPanelDesign」(MainPanelDesign.java)ファイルを Visual Swing for Eclipse でビジュアルに画面デザイン(GUI 部品の配置)を作成している(Java コードが自動生成される)。

「MainAppFrameObj、MainPanelImplementationObj」 からアプレット独自メソッドにアクセスしているので、「MainAppFrameObj、MainPanelImplementationObj」はアプレット・クラス内に設置している。
(アプリーケーションの初期実行用) main( ) メソッドで(MainAppFrameObjなどのような)クラス内クラスをインスタンス化したい場合(main( ) メソッド実行時には、まだアプレット自体のインスタンスが生成されておらず、通常のクラス内クラスではインスタンス化できないので) 、クラス内クラスには「static」修飾子を付与しなければならない(この場合、オブジェクトは1つだけしか作成できない)。

クリック時にマウス・カーソルが動いてしまった場合 mouseClicked イベントだとイベントが発生しない"仕様"になっているようなので、mouse イベントに関しては mouseReleased イベントを使用している。
なお、今回はダブル・クリック検出用に mousePressed イベントも使用している。

変更した部分はイベント用メソッドの「HostLogout_CbtMouseMouseReleased、HostLogin_CbtMouseMouseReleased、FTPFileList_CbtMouseMouseReleased、FTPDownload_CbtMouseMouseReleased、FTPUpload_CbtMouseMouseReleased、HostFileList_CbtNativeMouseMousePressed、HostFileList_CltNativeMouseMouseReleased、LocalFileList_CbtNativeMouseMousePressed、LocalFileList_CltNativeMouseMouseReleased、SetupFileList_HostFolder_CbtMouseMouseReleased、SetupFileList_LocalFolder_CbtMouseMouseReleased、FTPBreak_CbtMouseMouseReleased」の private 修飾子を削除。
その他、「ctfHostUserName、ctfHostName、cpfHostPassword、ctfHostFolder、ctfLocalFolder、ctfHostPortNum、ctaMessage、cltHostFileList、cltLocalFileList、ccbFTPFileDataType、ctpFileListTabs、cckHostPASVMode、ccbHostEncode」変数の private 修飾子を削除(Button など Component を直にイジる必要がなければ private 修飾子を削除しなくても良い)。


『FTPConnect.java』


import java.awt.Dimension;
//Event を使う場合は、その Event に対応する「〜Adapter、〜Event」を import しなければならない。
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.swing.DefaultListModel;
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.JScrollPane;

import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply;

@SuppressWarnings("serial")
public class FTPConnect extends JApplet {
    static FTPConnect oMainApp;
    static boolean lApplication = false; // true; //
    static MainAppFrameObj oMainAppFrame;
    MainPanelImplementationObj oMainPanelImp;

    // private final String fvsPathListType_Folder = ":+Folder:=";
    private final String fvsPathListType_File = "-<File>=";
    private final String fvsPathListType_Folder = "+<Directory>=";
    private final String fvsReg_PathListType_File = "\\-<File>=";
    private final String fvsReg_PathListType_Folder = "\\+<Directory>=";

    Matcher matcher;
    // Pattern pattern;
    // Transfer // Connect
    boolean lFTPConnection = false; // true; //
    boolean lFTPBreak = false; // true; //
    FTPClient client;
    // Binary転送Modeを利用?(true=Yes、false=No)
    // TransferFileDataType
    private static boolean lFTPTransfer_Binary = false; // true; //
    // PASV Modeを利用?(true=Yes、false=No)
    private static boolean lFTPPassiveMode = true; // false; //
    private static final String fvsFTPTransfer_Binary = "Binary";
    // 連想配列
    private HashMap<String,String> da1CharEncodeSets;
    private String vsHostEncode;
    private String vsLocalEncode;
    private String vsHostName;
    private String vsHostPortNum;
    private int iHostPortNum;
    private String vsHostUserName;
    private String vsHostPassword;
    private String vsHostCurrent;
    private String vsHostFolder;
    private String vsLocalCurrent;
    private String vsLocalFolder;

    public static void main(String[] args) {
        oMainApp = new FTPConnect( );
        lApplication = true; // false;
        oMainAppFrame =
            new MainAppFrameObj( );
        oMainAppFrame.oAppThread.start();
        try{
            oMainAppFrame.oAppThread.join();
        }
        catch(InterruptedException e){ }
        // oMainAppFrame.oAppThread = null;
        System.exit(0);
    }

    public void AppRepaint() {
        System.out.println("AppRepaint( );");

        repaint();
    }

    public void init() {
        System.out.println("init( );");

        oMainApp = this;
        oMainPanelImp = new MainPanelImplementationObj();
        getContentPane().add(oMainPanelImp,"Center");
        oMainPanelImp.setVisible(true);

        if( oMainAppFrame!=null ){
            System.out.println("if(lApplication)");
            oMainAppFrame.setPreSize(oMainPanelImp.getSize( ));
            System.out.println("MainPanelWidth="+oMainPanelImp.getSize( ).getWidth());
            System.out.println("MainPanelHeight="+oMainPanelImp.getSize( ).getHeight());
        }

        System.out.println("Hello, World!");
        // UTF8, Windows, EUC-JP, ASCII
        da1CharEncodeSets = new HashMap<String, String>(){
            {
                put("UTF-8", "utf-8");
                put("Windows", "MS932"); // Microsoft Windows CodePage 932
                // ↑厳密に言うと Windows は「shift_jis」と完全な互換ではない.
                // 今までスタンダードな表記法は「CP932」だったが、
                // 「commons-net-3.3」では「MS932」でないとエラーになるようだ.
                put("EUC-JP", "EUC-JP"); //
                put("ASCII", "ISO-8859-1"); //
            }
        };

    }
    public void start(){
        System.out.println("start( );");

        repaint();

    }
    public void stop(){
        System.out.println("stop( );");
    }
    public void destroy(){
        System.out.println("destroy( );");
    }

    public void FTPLogin() {
        System.out.println("FTPLogin( );");

        oMainPanelImp.ctaMessage.setText("");

        lFTPPassiveMode = oMainPanelImp.cckHostPASVMode.isSelected( );

        vsHostEncode =
            da1CharEncodeSets.get((String)oMainPanelImp.ccbHostEncode.getSelectedItem());

        Pattern pattern = Pattern.compile("( |\n)$");

        vsHostName = oMainPanelImp.ctfHostName.getText();
        matcher = pattern.matcher(vsHostName);
        vsHostName = matcher.replaceAll("");

        vsHostPortNum = oMainPanelImp.ctfHostPortNum.getText( );
        matcher = pattern.matcher(vsHostPortNum);
        vsHostPortNum = matcher.replaceAll("");
        if(vsHostPortNum.isEmpty( )){ vsHostPortNum = "0"; }
        iHostPortNum = Integer.parseInt(vsHostPortNum);

        vsHostUserName = oMainPanelImp.ctfHostUserName.getText();
        matcher = pattern.matcher(vsHostUserName);
        vsHostUserName = matcher.replaceAll("");

        vsHostPassword = String.valueOf(oMainPanelImp.cpfHostPassword.getPassword( ));
        matcher = pattern.matcher(vsHostPassword);
        vsHostPassword = matcher.replaceAll("");

        System.out.println("MainAppFrameObj: "+
            "vsHostEncode="+vsHostEncode+"; "+
            "vsHostName="+vsHostName+"; "+
            "iHostPortNum="+iHostPortNum+"; "+
            "vsHostUserName="+vsHostUserName+"; "+
            "vsHostPassword="+vsHostPassword+"; "+
            "");

        try {
            client = new FTPClient();
            String vsEncode = client.getControlEncoding();
            System.out.println("MainAppFrameObj: "+
                "vsEncode="+vsEncode+"; "+
            "");
            client.setControlEncoding(vsHostEncode);
            // ↑ Host 側のキャラクター・セットを設定してやれば良いようだ.
            System.out.println("Connect...");
            client.connect(vsHostName, iHostPortNum);
            System.out.println("Connected to Server:" + vsHostName + " on "+client.getRemotePort());
            System.out.println(client.getReplyString());
            client.login(vsHostUserName,vsHostPassword);
            System.out.println(client.getReplyString());

           lFTPConnection = true; // false; //
           if (FTPReply.isPositiveCompletion(client.getReplyCode())) {
                System.out.println("Success:Login.");
                oMainPanelImp.ctaMessage.append("Success:Login.\n");
            }else{
                System.out.println("Error:FTP PositiveCompletion.");
                oMainPanelImp.ctaMessage.append("Error:FTP PositiveCompletion.\n");
                FTPLogout();
                return;
            }

           if (lFTPPassiveMode) {
               client.enterLocalPassiveMode();
               System.out.println("PassiveMode = ON");
           } else {
               client.enterLocalActiveMode();
               System.out.println("PassiveMode = OFF");
           }

           HostFileList("");

        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("IOException:Login.");
            oMainPanelImp.ctaMessage.append("IOException:Login.\n");
        }

    }

     public void FTPLogout() {
        System.out.println("FTPLogout( );");

        try {
            lFTPConnection = false; // true; //
            if( client!=null && client.isConnected( ) ){
                client.disconnect( );
                System.out.println("FTP Disconnect.");
                oMainPanelImp.ctaMessage.append("FTP Disconnect.\n");
            }
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("IOException:FTPLogout.");
            oMainPanelImp.ctaMessage.append("IOException:FTPLogout.\n");
        }
    }

    public void HostFileList(String vsTargetFile){
        System.out.println("HostFileList( );");

        try {
            Pattern pattern = Pattern.compile("( |\n)$");

            vsHostFolder = oMainPanelImp.ctfHostFolder.getText();
            matcher = pattern.matcher(vsHostFolder);
            vsHostFolder = matcher.replaceAll("");

            System.out.println("vsTargetFile="+vsTargetFile+"; ");
            vsHostCurrent = "";
            if( vsTargetFile.compareTo("..")==0 ){
                System.out.println("if( vsTargetFile.compareTo(..)==0 )");
                vsTargetFile = "";
                client.changeToParentDirectory();
            }else{
                vsHostCurrent = vsHostFolder+(vsHostFolder.endsWith("/") ? "" : "/")+vsTargetFile;
                // client.doCommand("CWD", vsHostCurrent);
                client.changeWorkingDirectory(vsHostCurrent);
            }
            System.out.println(client.getReplyString());
            lFTPConnection = FTPReply.isPositiveCompletion(client.getReplyCode());
            String vsMsg = "Connection test => " + (lFTPConnection ? "OK" : "NG")+".";
            System.out.println(vsMsg);
            oMainPanelImp.ctaMessage.append(vsMsg+"\n");
            vsHostCurrent = client.printWorkingDirectory();

            oMainPanelImp.ctfHostFolder.setText(vsHostCurrent);
            System.out.println("vsHostCurrent="+vsHostCurrent+"; ");

            ((DefaultListModel)oMainPanelImp.cltHostFileList.getModel( )).removeAllElements( );

            // JScrollPane には暗黙の子 JViewport が存在するようだ。
            // つまり、この場合の JList の親は JViewport になり、
            // JList の親の親が JScrollPane となる。
            JScrollPane oTabsSelectedComponent = (JScrollPane)(oMainPanelImp.cltHostFileList.getParent( ).getParent( ));
            oMainPanelImp.ctpFileListTabs.setSelectedComponent(oTabsSelectedComponent);

            if( vsHostCurrent.compareTo("/")!=0 ){
                ((DefaultListModel)oMainPanelImp.cltHostFileList.getModel( )).addElement(
                    fvsPathListType_Folder+"..");
            }

            String vsElement = "";
            String[] d1vsHostFile =  new String[client.listFiles().length];
            int i = 0;
            for (FTPFile oFTPFile : client.listFiles()) {
                String vsHostFile = oFTPFile.getName();
                String vsHostPath = vsHostCurrent+(vsHostCurrent.endsWith("/") ? "" : "/")+vsHostFile;
                if( oFTPFile.isFile( ) ){
                    vsElement = fvsPathListType_File;
                }else if( oFTPFile.isDirectory( ) ){
                    vsElement = fvsPathListType_Folder;
                }
                d1vsHostFile[i] = vsElement+vsHostFile;
                i++;
            }
            FileSort(d1vsHostFile);
            for ( i = 0; i<d1vsHostFile.length; ++i) {
               ((DefaultListModel)oMainPanelImp.cltHostFileList.getModel( )).addElement(
                    d1vsHostFile[i]);
                System.out.println(d1vsHostFile[i]);

                char[] d1vcFileElement = d1vsHostFile[i].toCharArray();
                System.out.print("Hex = ");
                for(int j = 0; j<d1vcFileElement.length; j++){
                    int k = d1vcFileElement[j];
                    if( k<0 ){ k = 65536+k; }
                    // ↑2の補数の負の値を正の値に変換している.
                    System.out.print(Integer.toHexString(k)+"; ");
                }
                System.out.println("");
            }
            return;
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("IOException:Login.");
            oMainPanelImp.ctaMessage.append("IOException:Login.\n");
            return;
        }

    }

   public void LocalFileList(String vsTargetFile){
        System.out.println("LocalFileList( );");

        Pattern pattern = Pattern.compile("( |\n)$");

        vsLocalCurrent = oMainPanelImp.ctfLocalFolder.getText();
        matcher = pattern.matcher(vsLocalCurrent);
        vsLocalCurrent = matcher.replaceAll("");

        File oLocalCurrent = null;
        System.out.println("vsTargetFile="+vsTargetFile+"; ");
        vsHostCurrent = "";
        oLocalCurrent = new File(vsLocalCurrent,vsTargetFile);
        if( vsTargetFile.compareTo("..")==0 ){
            System.out.println("if( vsTargetFile.compareTo(..)==0 )");
            vsTargetFile = "";
        }

        try {
            vsLocalCurrent = oLocalCurrent.getCanonicalPath( );
            oMainPanelImp.ctfLocalFolder.setText(vsLocalCurrent);
            System.out.println("vsLocalCurrent="+vsLocalCurrent+"; ");

            ((DefaultListModel)oMainPanelImp.cltLocalFileList.getModel( )).removeAllElements( );

            // JScrollPane には暗黙の子 JViewport が存在するようだ。
            // つまり、この場合の JList の親は JViewport になり、
            // JList の親の親が JScrollPane となる。
            JScrollPane oTabsSelectedComponent = (JScrollPane)(oMainPanelImp.cltLocalFileList.getParent( ).getParent( ));
            oMainPanelImp.ctpFileListTabs.setSelectedComponent(oTabsSelectedComponent);
        } catch (IOException e) {
            // TODO 自動生成された catch ブロック
            e.printStackTrace();
            oLocalCurrent = null;
        }

        if( oLocalCurrent!=null && oLocalCurrent.isDirectory( ) ){

            pattern = Pattern.compile("^?(.:)(/|\\\\)$");
            // ↑この「\\\\」は内部的に「\\」の文字列となり、
            // 正規表現では「\」の文字と解釈される.
            matcher = pattern.matcher(vsLocalCurrent);
            System.out.println("pattern = Pattern.compile(^?(.:)(/|\\\\)$)");
            if( ! matcher.find( ) ){
                System.out.println("if( matcher.find( ) )");
                // vsLocalCurrent = matcher.replaceAll("");
                ((DefaultListModel)oMainPanelImp.cltLocalFileList.getModel( )).addElement(
                    fvsPathListType_Folder+"..");
            }

            String vsElement = "";
            String[] d1vsLocalFile =  new String[oLocalCurrent.listFiles().length];
            int i = 0;
            for (File oFile : oLocalCurrent.listFiles( )) {
                String vsLocalFile = oFile.getName();
                String vsLocalPath = vsLocalCurrent+(vsLocalCurrent.endsWith("/") ? "" : "/")+vsLocalFile;
                if(oFile.isFile()){
                    vsElement = fvsPathListType_File;
                }else if(oFile.isDirectory( )){
                    vsElement = fvsPathListType_Folder;
                }
                d1vsLocalFile[i] = vsElement+vsLocalFile;
                i++;
            }
            FileSort(d1vsLocalFile);
            for ( i = 0; i<d1vsLocalFile.length; ++i) {
                ((DefaultListModel)oMainPanelImp.cltLocalFileList.getModel( )).addElement(
                    d1vsLocalFile[i]);
                System.out.println(d1vsLocalFile[i]);

                char[] d1vcFileElement = d1vsLocalFile[i].toCharArray( );
                System.out.print("Hex = ");
                for(int j = 0; j<d1vcFileElement.length; j++){
                    int k = d1vcFileElement[j];
                    if( k<0 ){ k = 65536+k; }
                    // ↑2の補数の負の値を正の値に変換している.
                    System.out.print(Integer.toHexString(k)+"; ");
                }
                System.out.println("");
            }
        }
        return;
    }

    public void FileSort(String[] d1vsFile){
        System.out.println("Arrays.sort( );");
        Arrays.sort(d1vsFile, new Comparator<String>() {
            @Override
            public int compare(String vs0, String vs1) {
                // このソートを Windows 的な File 名のソート順にカスタマイズしている.
                String vs, vsAscTab = new String(Character.toChars(0x09));
                vs = vs0;
                vs0 = vs.toUpperCase( )+vsAscTab+vs;
                vs = vs1;
                vs1 = vs.toUpperCase( )+vsAscTab+vs;
                return vs0.compareTo(vs1);
            }
        });
    }

   public void FTPDownload( ){
        matcher = null;
        Pattern pattern = null;
        String vsTargetFile = null;
        String vsHostPath = null;

        pattern = Pattern.compile("( |\n)$");

        vsHostCurrent = oMainPanelImp.ctfHostFolder.getText();
        matcher = pattern.matcher(vsHostCurrent);
        vsHostCurrent = matcher.replaceAll("");

        vsLocalCurrent = oMainPanelImp.ctfLocalFolder.getText();
        matcher = pattern.matcher(vsLocalCurrent);
        vsLocalCurrent = matcher.replaceAll("");

        String vsLocalPath = vsLocalCurrent;
        pattern = Pattern.compile("(\\\\)");
        // ↑この「\\\\」は内部的に「\\」の文字列となり、
        // 正規表現では「\」の文字と解釈される.
        matcher = pattern.matcher(vsLocalPath);
        vsLocalPath = matcher.replaceAll("/");

        if( ! oMainPanelImp.cltHostFileList.isSelectionEmpty() ){
            vsTargetFile = (String)oMainPanelImp.cltHostFileList.getSelectedValue();
            pattern = Pattern.compile("^"+fvsPathListType_File);
            matcher = pattern.matcher(vsTargetFile);
            vsTargetFile = matcher.replaceAll("");

            pattern = Pattern.compile("^"+fvsPathListType_Folder);
            matcher = pattern.matcher(vsTargetFile);
            vsTargetFile = matcher.replaceAll("");
            if(matcher.find()){
                System.out.println("if(matcher.find( ))");
                vsHostPath = vsHostCurrent+(vsHostCurrent.endsWith("/") ? "" : "/")+vsTargetFile;
                vsTargetFile = "";
            }
        }else{
            vsTargetFile = "";
        }
        if( vsTargetFile!=null ){
            // vsLocalPath= vsLocalPath+(vsLocalPath.endsWith("/") ? "" : "/")+vsTargetFile;

            System.out.println("FTPDownload: "+
                "vsTargetFile="+vsTargetFile+"; "+
                "vsHostCurrent="+vsHostCurrent+"; "+
                "vsLocalCurrent="+vsLocalCurrent+"; "+
                "vsHostPath="+vsHostPath+"; "+
                "vsLocalPatht="+vsLocalPath+"; "+
                "");

            FTPDownloadFolder( vsTargetFile, vsHostCurrent, vsLocalCurrent );
            System.out.println("FTPDownload Completed.");
            oMainPanelImp.ctaMessage.append("FTPDownload Completed.\n");
            try {
                client.changeWorkingDirectory(vsHostCurrent);
            } catch (IOException e) {
                // TODO 自動生成された catch ブロック
                e.printStackTrace();
            }
        }

        LocalFileList("");
        lFTPBreak = false; // true; //

    }


    public void FTPDownloadFolder( String vsTargetFile, String vsHostCurrent, String vsLocalCurrent ){
        System.out.println("FTPDownloadFolder: "+
            "vsTargetFile="+vsTargetFile+"; "+
            "vsHostCurrent="+vsHostCurrent+"; "+
            "vsLocalCurrent="+vsLocalCurrent+"; "+
            "");
        if( vsTargetFile!=null && vsTargetFile.compareTo("")!=0 ){

            FTPDownloadFile( vsTargetFile, vsHostCurrent, vsLocalCurrent);
        }else{
            String vsHostPath = null;
            try {
                client.changeWorkingDirectory(vsHostCurrent);
                System.out.println("client.changeWorkingDirectory(vsHostCurrent)");
                // FTPFile[] d1oFTPFile = client.listFiles();
                for (FTPFile oFTPFile : client.listFiles()) {
                    if( lFTPBreak ){
                        break;
                    }
                    String vsHostFile = oFTPFile.getName();
                    if( oFTPFile.isFile( ) ){
                        FTPDownloadFile( vsHostFile, vsHostCurrent, vsLocalCurrent);
                    }else if( oFTPFile.isDirectory( ) ){
                        String vsLocalPath = vsLocalCurrent;
                        Pattern pattern = Pattern.compile("(\\\\)");
                        // ↑この「\\\\」は内部的に「\\」の文字列となり、
                        // 正規表現では「\」の文字と解釈される.
                        matcher = pattern.matcher(vsLocalPath);
                        vsLocalPath = matcher.replaceAll("/");

                        vsLocalPath = vsLocalPath+(vsLocalPath.endsWith("/") ? "" : "/")+vsHostFile;
                        vsHostPath = vsHostCurrent+(vsHostCurrent.endsWith("/") ? "" : "/")+vsHostFile;
                        System.out.println("FTPDownloadFolder: "+
                            "vsTargetFile="+vsTargetFile+"; "+
                            "vsHostCurrent="+vsHostCurrent+"; "+
                            "vsLocalCurrent="+vsLocalCurrent+"; "+
                            "vsHostPath="+vsHostPath+"; "+
                            "vsLocalPath="+vsLocalPath+"; "+
                            "");

                        File oLocalPath = new File(vsLocalPath);
                        if( ! oLocalPath.exists( ) ){
                            oLocalPath.mkdir();
                        }

                        FTPDownloadFolder( "", vsHostPath, vsLocalPath );
                        client.changeWorkingDirectory(vsHostCurrent);
                    }
                }
            } catch (IOException e) {
                // TODO 自動生成された catch ブロック
                e.printStackTrace();
            }
        }
    }

    public void FTPDownloadFile(String vsTargetFile,String vsHostCurrent,String vsLocalCurrent){
        String vsMsg;
        String vsLocalPath = null;
        String vsHostPath = null;
        FileOutputStream oFOS = null;
        try{
           Pattern pattern = Pattern.compile("(\\\\)");
            // ↑この「\\\\」は内部的に「\\」の文字列となり、
            // 正規表現では「\」の文字と解釈される.

            vsLocalPath = vsLocalCurrent;
            matcher = pattern.matcher(vsLocalPath);
            vsLocalPath = matcher.replaceAll("/");

            // client.changeWorkingDirectory(vsHostCurrent);
            vsHostPath = vsHostCurrent+(vsHostCurrent.endsWith("/") ? "" : "/")+vsTargetFile;
            vsLocalPath = vsLocalPath+(vsLocalPath.endsWith("/") ? "" : "/")+vsTargetFile;
            System.out.println("FTPDownloadFile: "+
                "vsTargetFile="+vsTargetFile+"; "+
                "vsHostCurrent="+vsHostCurrent+"; "+
                "vsLocalCurrent="+vsLocalCurrent+"; "+
                "vsHostPath="+vsHostPath+"; "+
                "vsLocalPath="+vsLocalPath+"; "+
                "");

            lFTPTransfer_Binary = false; // true; //
            if( 0==fvsFTPTransfer_Binary.compareTo(
                (String)oMainPanelImp.ccbFTPFileDataType.getSelectedItem( )) ){
                lFTPTransfer_Binary = true; // false; //
            }

            if(lFTPTransfer_Binary){
                client.setFileType(FTP.BINARY_FILE_TYPE);
                System.out.println("Transfer:Binary.");
            }else{
                client.setFileType(FTP.ASCII_FILE_TYPE);
                System.out.println("Transfer:ASCII.");
            }

            // FTP Download.
            oFOS = new FileOutputStream(vsLocalPath);
            client.retrieveFile(vsHostPath, oFOS);
            oFOS.close();
            oMainPanelImp.ctaMessage.append("vsHostPath = "+vsHostPath+";"+"\n");
            oMainPanelImp.ctaMessage.append("vsLocalPath = "+vsLocalPath+";"+"\n");
            lFTPConnection = FTPReply.isPositiveCompletion(client.getReplyCode());
            vsMsg = "FTPDownloadFile Completed:Connection => " + (lFTPConnection ? "OK" : "NG")+".";
            System.out.println(vsMsg);
            oMainPanelImp.ctaMessage.append(vsMsg+"\n");
        }catch(Exception e){
            e.printStackTrace();
            oMainPanelImp.ctaMessage.append("Exception:FTPDownload.\n");
        }
    }

    public void FTPUpload( ){
        matcher = null;
        Pattern pattern = null;
        String vsTargetFile = null;
        String vsHostPath = null;

        pattern = Pattern.compile("( |\n)$");

        vsHostCurrent = oMainPanelImp.ctfHostFolder.getText();
        matcher = pattern.matcher(vsHostCurrent);
        vsHostCurrent = matcher.replaceAll("");

        vsLocalCurrent = oMainPanelImp.ctfLocalFolder.getText();
        matcher = pattern.matcher(vsLocalCurrent);
        vsLocalCurrent = matcher.replaceAll("");

        String vsLocalPath = vsLocalCurrent;
        pattern = Pattern.compile("(\\\\)");
        // ↑この「\\\\」は内部的に「\\」の文字列となり、
        // 正規表現では「\」の文字と解釈される.
        matcher = pattern.matcher(vsLocalPath);
        vsLocalPath = matcher.replaceAll("/");

        try {
            File oLocalCurrent;
            File oLocalPath = new File(vsLocalPath);
            if( oLocalPath.isFile( ) ){
                vsTargetFile = oLocalPath.getName( );
                vsLocalCurrent = oLocalPath.getParent( );
                oLocalCurrent = new File(vsLocalCurrent);
                vsLocalCurrent = oLocalCurrent.getCanonicalPath();
            }else if( ! oMainPanelImp.cltLocalFileList.isSelectionEmpty() ){
                vsTargetFile = (String)oMainPanelImp.cltLocalFileList.getSelectedValue();
                pattern = Pattern.compile("^"+fvsPathListType_File);
                matcher = pattern.matcher(vsTargetFile);
                vsTargetFile = matcher.replaceAll("");

                pattern = Pattern.compile("^"+fvsPathListType_Folder);
                matcher = pattern.matcher(vsTargetFile);
                vsTargetFile = matcher.replaceAll("");
                if(matcher.find()){
                    System.out.println("if(matcher.find( ))");
                    vsLocalPath = vsLocalCurrent+(vsLocalCurrent.endsWith("/") ? "" : "/")+vsTargetFile;
                    vsTargetFile = "";
                }
            }else{
                vsTargetFile = "";
            }
        } catch (IOException e) {
            // TODO 自動生成された catch ブロック
            e.printStackTrace();
            vsTargetFile = null;
        }

        if( vsTargetFile!=null ){
            System.out.println("FTPUpload: "+
                "vsTargetFile="+vsTargetFile+"; "+
                "vsHostCurrent="+vsHostCurrent+"; "+
                "vsLocalCurrent="+vsLocalCurrent+"; "+
                "vsHostPath="+vsHostPath+"; "+
                "vsLocalPatht="+vsLocalPath+"; "+
                "");

            FTPUploadFolder( vsTargetFile, vsHostCurrent, vsLocalCurrent );
            System.out.println("FTPUpload Completed.");
            oMainPanelImp.ctaMessage.append("FTPUpload Completed.\n");
            try {
                client.changeWorkingDirectory(vsHostCurrent);
            } catch (IOException e) {
                // TODO 自動生成された catch ブロック
                e.printStackTrace();
            }
        }

        HostFileList("");
        lFTPBreak = false; // true; //

    }

    public void FTPUploadFolder( String vsTargetFile, String vsHostCurrent, String vsLocalCurrent ){
         System.out.println("FTPUploadFolder: "+
             "vsTargetFile="+vsTargetFile+"; "+
             "vsHostCurrent="+vsHostCurrent+"; "+
             "vsLocalCurrent="+vsLocalCurrent+"; "+
             "");
        if( vsTargetFile!=null && vsTargetFile.compareTo("")!=0 ){
            FTPUploadFile( vsTargetFile, vsHostCurrent, vsLocalCurrent);
        }else{
            String vsHostPath = null;
            try {
                File oLocalCurrent = new File(vsLocalCurrent);
                System.out.println("oLocalCurrent = new File(vsLocalCurrent)");
                for (File oFile : oLocalCurrent.listFiles()) {
                    if( lFTPBreak ){
                        break;
                    }
                    String vsLocalFile = oFile.getName();
                    if( oFile.isFile( ) ){
                        FTPUploadFile( vsLocalFile, vsHostCurrent, vsLocalCurrent);
                    }else if( oFile.isDirectory( ) ){
                        String vsLocalPath = vsLocalCurrent;
                        Pattern pattern = Pattern.compile("(\\\\)");
                        // ↑この「\\\\」は内部的に「\\」の文字列となり、
                        // 正規表現では「\」の文字と解釈される.
                        matcher = pattern.matcher(vsLocalPath);
                        vsLocalPath = matcher.replaceAll("/");

                        vsLocalPath = vsLocalPath+(vsLocalPath.endsWith("/") ? "" : "/")+vsLocalFile;
                        vsHostPath = vsHostCurrent+(vsHostCurrent.endsWith("/") ? "" : "/")+vsLocalFile;
                        System.out.println("FTPUploadFolder: "+
                            "vsTargetFile="+vsTargetFile+"; "+
                            "vsHostCurrent="+vsHostCurrent+"; "+
                            "vsLocalCurrent="+vsLocalCurrent+"; "+
                            "vsHostPath="+vsHostPath+"; "+
                            "vsLocalPath="+vsLocalPath+"; "+
                            "");

                        try {
                            // client.changeWorkingDirectory(vsHostPath);
                            System.out.println("client.makeDirectory(vsHostPath).");
                            client.makeDirectory(vsHostPath);
                        } catch (IOException e) {
                            e.printStackTrace();
                        }

                        FTPUploadFolder( "", vsHostPath, vsLocalPath );
                        client.changeWorkingDirectory(vsHostCurrent);
                    }
                }
            } catch (IOException e) {
                // TODO 自動生成された catch ブロック
                e.printStackTrace();
            }
        }
    }

    public void FTPUploadFile(String vsTargetFile,String vsHostCurrent,String vsLocalCurrent){

        String vsMsg;
        String vsLocalPath = null;
        String vsHostPath = null;
        FileInputStream oFIS = null;
        Pattern pattern = Pattern.compile("(\\\\)");
        // ↑この「\\\\」は内部的に「\\」の文字列となり、
        // 正規表現では「\」の文字と解釈される.

        vsLocalPath = vsLocalCurrent;
        matcher = pattern.matcher(vsLocalPath);
        vsLocalPath = matcher.replaceAll("/");

        vsHostPath = vsHostCurrent+(vsHostCurrent.endsWith("/") ? "" : "/")+vsTargetFile;
        vsLocalPath = vsLocalPath+(vsLocalPath.endsWith("/") ? "" : "/")+vsTargetFile;
        System.out.println("FTPUploadFile: "+
            "vsTargetFile="+vsTargetFile+"; "+
            "vsHostCurrent="+vsHostCurrent+"; "+
            "vsLocalCurrent="+vsLocalCurrent+"; "+
            "vsHostPath="+vsHostPath+"; "+
            "vsLocalPath="+vsLocalPath+"; "+
            "");

        lFTPTransfer_Binary = false; // true; //
        if( 0==fvsFTPTransfer_Binary.compareTo(
            (String)oMainPanelImp.ccbFTPFileDataType.getSelectedItem( )) ){
            lFTPTransfer_Binary = true; // false; //
        }

        try{
            if(lFTPTransfer_Binary){
                client.setFileType(FTP.BINARY_FILE_TYPE);
                System.out.println("Transfer:Binary.");
            }else{
                client.setFileType(FTP.ASCII_FILE_TYPE);
                System.out.println("Transfer:ASCII.");
            }

            // FTP Upload.
            oFIS = new FileInputStream(vsLocalPath);
            client.storeFile(vsHostPath, oFIS);
            oFIS.close();
            oMainPanelImp.ctaMessage.append("FTPUploadFile: "+
                "vsHostPath="+vsHostPath+"; "+
                "vsLocalPath="+vsLocalPath+"; "+
                "\n");
            lFTPConnection = FTPReply.isPositiveCompletion(client.getReplyCode());
            vsMsg = "FTPUploadFile Completed:Connection = " + (lFTPConnection ? "OK" : "NG")+".";
            System.out.println(vsMsg);
            oMainPanelImp.ctaMessage.append(vsMsg+"\n");
        }catch(Exception e){
            e.printStackTrace();
            oMainPanelImp.ctaMessage.append("Exception:FTPUpload.\n");
        }
    }

    class MainPanelImplementationObj extends MainPanelDesign {

        long ilDoubleClickedIntervalMax = 250; // 350; 300;

        // volatile:最適化の抑制.
        volatile byte ibCnt_HostFileList_CbtMouseMouseDoubleClicked = 0;
        Thread oThread_HostFileList_CbtMouseMouseDoubleClicked;
        Runnable oRunner_HostFileList_CbtMouseMouseDoubleClicked;

        // volatile:最適化の抑制.
        volatile byte ibCnt_LocalFileList_CbtMouseMouseDoubleClicked = 0;
        Thread oThread_LocalFileList_CbtMouseMouseDoubleClicked;
        Runnable oRunner_LocalFileList_CbtMouseMouseDoubleClicked;

        MainPanelImplementationObj(){
            super( );

            oThread_HostFileList_CbtMouseMouseDoubleClicked = new Thread(
                oRunner_HostFileList_CbtMouseMouseDoubleClicked = new Runnable( ) {
                    @Override
                    public synchronized void run() {
                        System.out.println("run.");
                        boolean lInterrupted = false; // true; //
                        while(true){
                            try {
                                wait( );
                                // ↑メソッドを synchronized 指定するか、
                                // synchronized(自分のインスタンス) ブロックで囲うかしないと
                                // 実行時に「IllegalMonitorStateException」が発生する。
                            } catch (InterruptedException e) {
                                e.printStackTrace();
                            }
                            System.out.println("wait:End.");
                            lInterrupted = false; // true; //
                            try {
                                Thread.sleep(ilDoubleClickedIntervalMax);
                            } catch (InterruptedException e) {
                                // e.printStackTrace();
                                System.out.println("sleep:InterruptedException.");
                                lInterrupted = true; // false; //
                            }
                            System.out.println("sleep:End.");
                            if( ! lInterrupted &&
                                ibCnt_HostFileList_CbtMouseMouseDoubleClicked==2 ){
                                ibCnt_HostFileList_CbtMouseMouseDoubleClicked = 0;
                                HostFileList_CbtMouseMouseClicked( );
                            }

                        }
                    }
                }
            );
            oThread_HostFileList_CbtMouseMouseDoubleClicked.start( );

            oThread_LocalFileList_CbtMouseMouseDoubleClicked = new Thread(
                oRunner_LocalFileList_CbtMouseMouseDoubleClicked = new Runnable( ) {
                    @Override
                    public synchronized void run() {
                        System.out.println("run.");
                        boolean lInterrupted = false; // true; //
                        while(true){
                            try {
                                wait( );
                                // ↑メソッドを synchronized 指定するか、
                                // synchronized(自分のインスタンス) ブロックで囲うかしないと
                                // 実行時に「IllegalMonitorStateException」が発生する。
                            } catch (InterruptedException e) {
                                e.printStackTrace();
                            }
                            System.out.println("wait:End.");
                            lInterrupted = false; // true; //
                            try {
                                Thread.sleep(ilDoubleClickedIntervalMax);
                            } catch (InterruptedException e) {
                                // e.printStackTrace();
                                System.out.println("sleep:InterruptedException.");
                                lInterrupted = true; // false; //
                            }
                            System.out.println("sleep:End.");
                            if( ! lInterrupted &&
                                ibCnt_LocalFileList_CbtMouseMouseDoubleClicked==2 ){
                                ibCnt_LocalFileList_CbtMouseMouseDoubleClicked = 0;
                                LocalFileList_CbtMouseMouseClicked( );
                            }

                        }
                    }
                }
            );
            oThread_LocalFileList_CbtMouseMouseDoubleClicked.start( );

        }
        @Override
        void HostLogin_CbtMouseMouseReleased(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:HostLogin_CbtMouseMouseReleased.");

           oMainApp.FTPLogin( );
        }
        @Override
        void HostLogout_CbtMouseMouseReleased(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:HostLogout_CbtMouseMouseReleased.");

            oMainApp.FTPLogout( );
        }
        @Override
        void FTPFileList_CbtMouseMouseReleased(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:FTPFileList_CbtMouseMouseReleased.");

            Pattern pattern = Pattern.compile("( |\n)$");
            vsHostFolder = oMainPanelImp.ctfHostFolder.getText();
            matcher = pattern.matcher(vsHostFolder);
            vsHostFolder = matcher.replaceAll("");

            JScrollPane oTabsSelectedComponent = (JScrollPane)ctpFileListTabs.getSelectedComponent( );
            System.out.println("oTabsSelectedComponent = "+oTabsSelectedComponent);
            System.out.println("oTabsSelectedComponent.getViewport() = "+oTabsSelectedComponent.getViewport());
            System.out.println("cltLocalFileList.getParent() = "+cltLocalFileList.getParent());
            System.out.println("cltLocalFileList.getParent().getParent() = "+cltLocalFileList.getParent().getParent());
            // JScrollPane には暗黙の子 JViewport が存在し、
            // 「JScrollPane.getViewport( ) 」で(暗黙の子) JViewport のインスタンスを取得できる。
            // つまり、この場合の JList の親は JViewport となる。
            // ちなみに、この場合の JList の親の親が JScrollPane となる。
            if( lFTPConnection &&
                oTabsSelectedComponent.getViewport()==cltHostFileList.getParent( ) ){

                // HostFileList0000();
            }
            if( oTabsSelectedComponent.getViewport()==cltLocalFileList.getParent( ) ){
                // LocalFileList();
            }

        }
        @Override
        void FTPDownload_CbtMouseMouseReleased(MouseEvent event) {
             System.out.println("MainPanelImplementationObj:MouseEvent:FTPDownload_CbtMouseMouseReleased.");

             FTPDownload( );
        }
        @Override
        void FTPUpload_CbtMouseMouseReleased(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:FTPUpload_CbtMouseMouseReleased.");


            FTPUpload( );
       }
       void HostFileList_CbtMouseMouseClicked( ) {
           System.out.println("MainPanelImplementationObj:MouseEvent:HostFileList_CbtMouseMouseClicked.");

       }
       void HostFileList_CbtMouseMouseDoubleClicked( ) {
           System.out.println("MainPanelImplementationObj:MouseEvent:HostFileList_CbtMouseMouseDoubleClicked.");


            Pattern pattern = null;
            String vsTargetFile = null;
            if( ! oMainPanelImp.cltHostFileList.isSelectionEmpty() ){
                vsTargetFile = (String)oMainPanelImp.cltHostFileList.getSelectedValue();
                pattern = Pattern.compile("^("+fvsReg_PathListType_Folder+")");

                matcher = pattern.matcher(vsTargetFile);
                if(matcher.find()){
                    vsTargetFile = matcher.replaceAll("");
                    System.out.println("vsTargetFile = "+vsTargetFile+"; ");
                    HostFileList(vsTargetFile);
                }
            }else{
                vsTargetFile = null;
                oMainPanelImp.ctaMessage.append("HostFileList で項目が選択せれていません.\n");
            }
        }
        @Override
        void HostFileList_CbtNativeMouseMousePressed(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:HostFileList_CbtNativeMouseMousePressed");

            if(oThread_HostFileList_CbtMouseMouseDoubleClicked.getState()==Thread.State.TIMED_WAITING){
                ibCnt_HostFileList_CbtMouseMouseDoubleClicked = 3;
                oThread_HostFileList_CbtMouseMouseDoubleClicked.interrupt();
            }else{
                ibCnt_HostFileList_CbtMouseMouseDoubleClicked = 1;
            }
            System.out.println("ibCnt_HostFileList_CbtMouseMouseDoubleClicked="+ibCnt_HostFileList_CbtMouseMouseDoubleClicked+"; ");
        }
        @Override
        void HostFileList_CltNativeMouseMouseReleased(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:HostFileList_CltNativeMouseMouseReleased.");

            if(ibCnt_HostFileList_CbtMouseMouseDoubleClicked==3){
                ibCnt_HostFileList_CbtMouseMouseDoubleClicked = 0;
                HostFileList_CbtMouseMouseDoubleClicked( );
            }else if(oThread_HostFileList_CbtMouseMouseDoubleClicked.getState()==Thread.State.WAITING){
                ibCnt_HostFileList_CbtMouseMouseDoubleClicked = 2;
                synchronized(oRunner_HostFileList_CbtMouseMouseDoubleClicked) {
                    oRunner_HostFileList_CbtMouseMouseDoubleClicked.notify();
                    // ↑ synchronized(自分のインスタンス) ブロックで囲わないとないと
                    // 実行時に「IllegalMonitorStateException」が発生する。
                    // ここ(this)は他人なので、ここのメソッドを synchronized 指定してもダメ。
                }
            }
            System.out.println("ibCnt_HostFileList_CbtMouseMouseDoubleClicked="+ibCnt_HostFileList_CbtMouseMouseDoubleClicked+"; ");
        }
       void LocalFileList_CbtMouseMouseClicked( ) {
           System.out.println("MainPanelImplementationObj:MouseEvent:LocalFileList_CbtMouseMouseClicked.");

       }
       void LocalFileList_CbtMouseMouseDoubleClicked( ) {
           System.out.println("MainPanelImplementationObj:MouseEvent:LocalFileList_CbtMouseMouseDoubleClicked.");

            Pattern pattern = null;
            String vsTargetFile = null;
            if( ! oMainPanelImp.cltLocalFileList.isSelectionEmpty() ){
                vsTargetFile = (String)oMainPanelImp.cltLocalFileList.getSelectedValue();
                pattern = Pattern.compile("^("+fvsReg_PathListType_Folder+")");

                matcher = pattern.matcher(vsTargetFile);
                if(matcher.find()){
                    vsTargetFile = matcher.replaceAll("");
                    System.out.println("vsTargetFile = "+vsTargetFile+"; ");
                    LocalFileList(vsTargetFile);
                }
            }else{
                vsTargetFile = null;
                oMainPanelImp.ctaMessage.append("LocalFileList で項目が選択せれていません.\n");
            }
        }
        @Override
        void LocalFileList_CbtNativeMouseMousePressed(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:LocalFileList_CbtNativeMouseMousePressed");

             if(oThread_LocalFileList_CbtMouseMouseDoubleClicked.getState()==Thread.State.TIMED_WAITING){
                ibCnt_LocalFileList_CbtMouseMouseDoubleClicked = 3;
                oThread_LocalFileList_CbtMouseMouseDoubleClicked.interrupt();
            }else{
                ibCnt_LocalFileList_CbtMouseMouseDoubleClicked = 1;
            }
            System.out.println("ibCnt_LocalFileList_CbtMouseMouseDoubleClicked="+ibCnt_LocalFileList_CbtMouseMouseDoubleClicked+"; ");
       }
        @Override
        void LocalFileList_CltNativeMouseMouseReleased(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:LocalFileList_CltNativeMouseMouseReleased");

            if(ibCnt_LocalFileList_CbtMouseMouseDoubleClicked==3){
                ibCnt_LocalFileList_CbtMouseMouseDoubleClicked = 0;
                LocalFileList_CbtMouseMouseDoubleClicked( );
            }else if(oThread_LocalFileList_CbtMouseMouseDoubleClicked.getState()==Thread.State.WAITING){
                ibCnt_LocalFileList_CbtMouseMouseDoubleClicked = 2;
                synchronized(oRunner_LocalFileList_CbtMouseMouseDoubleClicked) {
                    oRunner_LocalFileList_CbtMouseMouseDoubleClicked.notify();
                    // ↑ synchronized(自分のインスタンス) ブロックで囲わないとないと
                    // 実行時に「IllegalMonitorStateException」が発生する。
                    // ここ(this)は他人なので、ここのメソッドを synchronized 指定してもダメ。
                }
            }
            System.out.println("ibCnt_LocalFileList_CbtMouseMouseDoubleClicked="+ibCnt_LocalFileList_CbtMouseMouseDoubleClicked+"; ");
        }
        @Override
        void SetupFileList_HostFolder_CbtMouseMouseReleased(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:SetupFileList_HostFolder_CbtMouseMouseReleased.");

            HostFileList("");
        }
        @Override
        void SetupFileList_LocalFolder_CbtMouseMouseReleased(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:SetupFileList_LocalFolder_CbtMouseMouseReleased.");

            LocalFileList("");
        }

        void FTPBreak_CbtMouseMouseReleased(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:FTPBreak_CbtMouseMouseReleased.");

            lFTPBreak = true; // false; //
        }

    }

    static class MainAppFrameObj extends JFrame implements Runnable {
        // JApplet oApplet;
        Thread oAppThread;
        public MainAppFrameObj( ) {
           super("Application frame.");
           //setVisible(false);
           System.out.println("Construct:Application frame window.");

           // oApplet = oEntApplet; // new JAppletcation();

           addWindowListener(
               new WindowAdapter(){
                   public void windowClosing(WindowEvent event){
                       // ユーザーがウインドウを閉じようとした時].
                       Object oSource = event.getSource();
                       if (oSource == MainAppFrameObj.this){
                           System.out.println("MainAppFrameObj:WindowEvent:windowClosing.");
                           oMainApp.FTPLogout();
                           Close();
                       }
                   }
               }
           );
           addWindowListener(
               new WindowAdapter(){
                   public void windowClosed(WindowEvent event){
                       // ウインドウが閉じた時.
                       Object oSource = event.getSource();
                       if (oSource == MainAppFrameObj.this){
                           System.out.println("MainAppFrameObj:WindowEvent:windowClosed.");

                       }
                   }
               }
           );
           addWindowListener(
               new WindowAdapter(){
                   public void windowDeiconified(WindowEvent event){
                       // ウィンドウが最小化された状態から通常の状態に変更された時.
                       Object oSource = event.getSource();
                       if (oSource == MainAppFrameObj.this){
                           System.out.println("MainAppFrameObj:WindowEvent:windowDeiconified.");

                           oMainApp.repaint();
                       }
                   }
               }
           );
           addComponentListener(
               new ComponentAdapter(){
                   public void componentResized(ComponentEvent event){
                       // コンポーネントのサイズが変更された時.
                       Object oSource = event.getSource();
                       if (oSource == MainAppFrameObj.this){
                           System.out.println("ComponentEvent:componentResized.");

                           System.out.println("MainAppFrameObj: "+
                           "width="+Integer.toString(MainAppFrameObj.this.getSize( ).width)+"; "+
                           "Height="+Integer.toString(MainAppFrameObj.this.getSize( ).height)+"; "+
                               "");
                           oMainApp.repaint();
                       }
                   }
               }
           );
           getContentPane().add(oMainApp,"Center");

           oAppThread= new Thread(this);

        }
        public synchronized void setPreSize(Dimension oSize){
            // dispose();
            getContentPane().setPreferredSize(oSize);
            pack();
            setVisible(true);
            requestFocus();
        }
        public synchronized void run(){
            System.out.println("Open:Application frame window.");
            oMainApp.init();
            oMainApp.start();
            oMainApp.repaint();
            try{
                wait();
            }
            catch(InterruptedException e){
                e.printStackTrace();
            }
            oMainApp.stop();
            oMainApp.destroy();
            oAppThread = null;
        }
        public synchronized void Close(){
            System.out.println("Close:Application frame window.");
            dispose();
            notify();
        }

    }

}


<Number>: [0000096D]  <Date>: 2015/12/22 14:17:09
<Title>: Java2 FTP Connect 8『MainPanelDesign.java』
<Name>: amanojaku@管理人



『MainPanelDesign.java』


import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

import org.dyno.visual.swing.layouts.Bilateral;
import org.dyno.visual.swing.layouts.Constraints;
import org.dyno.visual.swing.layouts.GroupLayout;
import org.dyno.visual.swing.layouts.Leading;

//VS4E -- DO NOT REMOVE THIS LINE!
public class MainPanelDesign extends JPanel {

    private static final long serialVersionUID = 1L;
    private JButton cbtHostLogin;
    private JButton cbtHostLogout;
    private JButton cbtFTPUpload;
    private JButton cbtFTPBreak;
    private JButton cbtFTPDownload;
    private JButton cbtSetupFileList_HostFolder;
    private JButton cbtSetupFileList_LocalFolder;
    JTextField ctfHostUserName;
    JTextField ctfHostName;
    JPasswordField cpfHostPassword;
    JTextField ctfHostFolder;
    JTextField ctfLocalFolder;
    JTextField ctfHostPortNum;
    JTextArea ctaMessage;
    JList cltHostFileList;
    JList cltLocalFileList;
    JComboBox ccbFTPFileDataType;
    JTabbedPane ctpFileListTabs;
    JCheckBox cckHostPASVMode;
    JComboBox ccbHostEncode;
    private JLabel jLabel2;
    private JLabel jLabel6;
    private JLabel jLabel5;
    private JLabel jLabel0;
    private JLabel jLabel1;
    private JLabel jLabel7;
    private JLabel jLabel9;
    private JScrollPane jScrollPane0;
    private JScrollPane jScrollPane1;
    private JScrollPane jScrollPane2;
    public MainPanelDesign() {
        initComponents();
    }

    private void initComponents() {
        setMinimumSize(new Dimension(479, 400));
        setPreferredSize(new Dimension(479, 400));
        setLayout(new GroupLayout());
        add(getJScrollPane0(), new Constraints(new Leading(13, 219, 10, 10), new Leading(255, 131, 12, 12)));
        add(getJLabel2(), new Constraints(new Leading(14, 12, 12), new Leading(185, 12, 12)));
        add(getJLabel6(), new Constraints(new Leading(14, 12, 12), new Leading(153, 12, 12)));
        add(getJLabel7(), new Constraints(new Leading(250, 12, 12), new Leading(151, 12, 12)));
        add(getJLabel9(), new Constraints(new Leading(250, 12, 12), new Leading(51, 12, 12)));
        add(getCcbFTPFileDataType(), new Constraints(new Leading(322, 12, 12), new Leading(47, 12, 12)));
        add(getCckHostPASVMode(), new Constraints(new Leading(12, 12, 12), new Leading(12, 12, 12)));
        add(getJLabel1(), new Constraints(new Leading(12, 12, 12), new Leading(51, 12, 12)));
        add(getCtpFileListTabs(), new Constraints(new Bilateral(250, 12, 57), new Leading(169, 217, 10, 10)));
        add(getCbtSetupFileList_HostFolder(), new Constraints(new Leading(253, 12, 12), new Leading(117, 12, 12)));
        add(getJLabel5(), new Constraints(new Leading(15, 12, 12), new Leading(87, 12, 12)));
        add(getCtfHostName(), new Constraints(new Leading(92, 142, 12, 12), new Leading(85, 12, 12)));
        add(getCtfHostPortNum(), new Constraints(new Leading(92, 142, 12, 12), new Leading(119, 12, 12)));
        add(getJLabel0(), new Constraints(new Leading(13, 12, 12), new Leading(121, 12, 12)));
        add(getCtfHostUserName(), new Constraints(new Leading(92, 138, 75, 282), new Leading(151, 12, 12)));
        add(getCpfHostPassword(), new Constraints(new Leading(93, 139, 75, 282), new Leading(183, 12, 12)));
        add(getCbtHostLogin(), new Constraints(new Leading(15, 72, 75, 282), new Leading(215, 12, 12)));
        add(getCbtHostLogout(), new Constraints(new Leading(95, 10, 10), new Leading(215, 12, 12)));
        add(getCtfHostFolder(), new Constraints(new Leading(377, 144, 12, 12), new Leading(119, 12, 12)));
        add(getCtfLocalFolder(), new Constraints(new Leading(377, 144, 12, 12), new Leading(85, 12, 12)));
        add(getCbtSetupFileList_LocalFolder(), new Constraints(new Leading(253, 12, 12), new Leading(82, 12, 12)));
        add(getCcbHostEncode(), new Constraints(new Leading(93, 12, 12), new Leading(47, 12, 12)));
        add(getCbtFTPDownload(), new Constraints(new Leading(250, 12, 12), new Leading(11, 12, 12)));
        add(getCbtFTPUpload(), new Constraints(new Leading(352, 12, 12), new Leading(11, 12, 12)));
        add(getCbtFTPBreak(), new Constraints(new Leading(437, 12, 12), new Leading(11, 12, 12)));
        setSize(536, 400);
    }

    private JButton getCbtFTPBreak() {
        if (cbtFTPBreak == null) {
            cbtFTPBreak = new JButton();
            cbtFTPBreak.setText("Break");
            cbtFTPBreak.addMouseListener(new MouseAdapter() {

                public void mouseReleased(MouseEvent event) {
                    FTPBreak_CbtMouseMouseReleased(event);
                }
            });
        }
        return cbtFTPBreak;
    }

    private JComboBox getCcbHostEncode() {
        if (ccbHostEncode == null) {
            ccbHostEncode = new JComboBox();
            ccbHostEncode.setModel(new DefaultComboBoxModel(new Object[] { "UTF-8", "Windows", "EUC-JP", "ASCII" }));
            ccbHostEncode.setDoubleBuffered(false);
            ccbHostEncode.setBorder(null);
        }
        return ccbHostEncode;
    }

    private JButton getCbtSetupFileList_HostFolder() {
        if (cbtSetupFileList_HostFolder == null) {
            cbtSetupFileList_HostFolder = new JButton();
            cbtSetupFileList_HostFolder.setText("HostFolder >");
            cbtSetupFileList_HostFolder.addMouseListener(new MouseAdapter() {

                public void mouseReleased(MouseEvent event) {
                    SetupFileList_HostFolder_CbtMouseMouseReleased(event);
                }
            });
        }
        return cbtSetupFileList_HostFolder;
    }

    private JButton getCbtSetupFileList_LocalFolder() {
        if (cbtSetupFileList_LocalFolder == null) {
            cbtSetupFileList_LocalFolder = new JButton();
            cbtSetupFileList_LocalFolder.setText("LocalFolder >");
            cbtSetupFileList_LocalFolder.addMouseListener(new MouseAdapter() {

                public void mouseReleased(MouseEvent event) {
                    SetupFileList_LocalFolder_CbtMouseMouseReleased(event);
                }
            });
        }
        return cbtSetupFileList_LocalFolder;
    }

    private JButton getCbtFTPUpload() {
        if (cbtFTPUpload == null) {
            cbtFTPUpload = new JButton();
            cbtFTPUpload.setText("Upload");
            cbtFTPUpload.addMouseListener(new MouseAdapter() {

                public void mouseReleased(MouseEvent event) {
                    FTPUpload_CbtMouseMouseReleased(event);
                }
            });
        }
        return cbtFTPUpload;
    }

    private JComboBox getCcbFTPFileDataType() {
        if (ccbFTPFileDataType == null) {
            ccbFTPFileDataType = new JComboBox();
            ccbFTPFileDataType.setModel(new DefaultComboBoxModel(new Object[] { "Binary", "ASCII" }));
            ccbFTPFileDataType.setDoubleBuffered(false);
            ccbFTPFileDataType.setBorder(null);
        }
        return ccbFTPFileDataType;
    }

    private JLabel getJLabel9() {
        if (jLabel9 == null) {
            jLabel9 = new JLabel();
            jLabel9.setText("FileDtata");
        }
        return jLabel9;
    }

    private JCheckBox getCckHostPASVMode() {
        if (cckHostPASVMode == null) {
            cckHostPASVMode = new JCheckBox();
            cckHostPASVMode.setSelected(true);
            cckHostPASVMode.setText("PASVMode");
        }
        return cckHostPASVMode;
    }

    private JList getCltLocalFileList() {
        if (cltLocalFileList == null) {
            cltLocalFileList = new JList();
            cltLocalFileList.setBackground(Color.white);
            DefaultListModel listModel = new DefaultListModel();
            cltLocalFileList.setModel(listModel);
            cltLocalFileList.addMouseListener(new MouseAdapter() {

                public void mousePressed(MouseEvent event) {
                    LocalFileList_CbtNativeMouseMousePressed(event);
                }

                public void mouseReleased(MouseEvent event) {
                    LocalFileList_CltNativeMouseMouseReleased(event);
                }
            });
        }
        return cltLocalFileList;
    }

    private JLabel getJLabel7() {
        if (jLabel7 == null) {
            jLabel7 = new JLabel();
            jLabel7.setText("FileList");
        }
        return jLabel7;
    }

    private JTabbedPane getCtpFileListTabs() {
        if (ctpFileListTabs == null) {
            ctpFileListTabs = new JTabbedPane();
            ctpFileListTabs.addTab("Host", getJScrollPane1());
            ctpFileListTabs.addTab("Local", getJScrollPane2());
        }
        return ctpFileListTabs;
    }

    private JScrollPane getJScrollPane2() {
        if (jScrollPane2 == null) {
            jScrollPane2 = new JScrollPane();
            jScrollPane2.setBackground(Color.white);
            jScrollPane2.setViewportView(getCltLocalFileList());
        }
        return jScrollPane2;
    }

    private JList getJList0() {
        if (cltLocalFileList == null) {
            cltLocalFileList = new JList();
            DefaultListModel listModel = new DefaultListModel();
            listModel.addElement("item0");
            listModel.addElement("item1");
            listModel.addElement("item2");
            listModel.addElement("item3");
            cltLocalFileList.setModel(listModel);
        }
        return cltLocalFileList;
    }

    private JLabel getJLabel1() {
        if (jLabel1 == null) {
            jLabel1 = new JLabel();
            jLabel1.setText("HostEncode");
        }
        return jLabel1;
    }

    private JButton getCbtFTPDownload() {
        if (cbtFTPDownload == null) {
            cbtFTPDownload = new JButton();
            cbtFTPDownload.setText("Download");
            cbtFTPDownload.addMouseListener(new MouseAdapter() {

                public void mouseReleased(MouseEvent event) {
                    FTPDownload_CbtMouseMouseReleased(event);
                }
            });
        }
        return cbtFTPDownload;
    }

    private JScrollPane getJScrollPane1() {
        if (jScrollPane1 == null) {
            jScrollPane1 = new JScrollPane();
            jScrollPane1.setEnabled(false);
            jScrollPane1.setViewportView(getCltHostFileList());
        }
        return jScrollPane1;
    }

    private JList getCltHostFileList() {
        if (cltHostFileList == null) {
            cltHostFileList = new JList();
            DefaultListModel listModel = new DefaultListModel();
            cltHostFileList.setModel(listModel);
            cltHostFileList.addMouseListener(new MouseAdapter() {

                public void mousePressed(MouseEvent event) {
                    HostFileList_CbtNativeMouseMousePressed(event);
                }

                public void mouseReleased(MouseEvent event) {
                    HostFileList_CltNativeMouseMouseReleased(event);
                }
            });
        }
        return cltHostFileList;
    }

    private JScrollPane getJScrollPane0() {
        if (jScrollPane0 == null) {
            jScrollPane0 = new JScrollPane();
            jScrollPane0.setViewportView(getCtaMessage());
        }
        return jScrollPane0;
    }

    private JTextArea getCtaMessage() {
        if (ctaMessage == null) {
            ctaMessage = new JTextArea();
        }
        return ctaMessage;
    }

    private JTextField getCtfHostPortNum() {
        if (ctfHostPortNum == null) {
            ctfHostPortNum = new JTextField();
        }
        return ctfHostPortNum;
    }

    private JLabel getJLabel0() {
        if (jLabel0 == null) {
            jLabel0 = new JLabel();
            jLabel0.setText("PortNo");
        }
        return jLabel0;
    }

    private JLabel getJLabel5() {
        if (jLabel5 == null) {
            jLabel5 = new JLabel();
            jLabel5.setText("HostName");
        }
        return jLabel5;
    }

    private JLabel getJLabel6() {
        if (jLabel6 == null) {
            jLabel6 = new JLabel();
            jLabel6.setText("UserName");
        }
        return jLabel6;
    }

    private JTextField getCtfLocalFolder() {
        if (ctfLocalFolder == null) {
            ctfLocalFolder = new JTextField();
            ctfLocalFolder.setBackground(Color.white);
            ctfLocalFolder.setText("");
        }
        return ctfLocalFolder;
    }

    private JButton getCbtHostLogin() {
        if (cbtHostLogin == null) {
            cbtHostLogin = new JButton();
            cbtHostLogin.setText("Login");
            cbtHostLogin.addMouseListener(new MouseAdapter() {

                public void mouseReleased(MouseEvent event) {
                    HostLogin_CbtMouseMouseReleased(event);
                }
            });
        }
        return cbtHostLogin;
    }

    private JTextField getCtfHostFolder() {
        if (ctfHostFolder == null) {
            ctfHostFolder = new JTextField();
            ctfHostFolder.setBackground(Color.white);
        }
        return ctfHostFolder;
    }

    private JButton getCbtHostLogout() {
        if (cbtHostLogout == null) {
            cbtHostLogout = new JButton();
            cbtHostLogout.setText("Logout");
            cbtHostLogout.addMouseListener(new MouseAdapter() {

                public void mouseReleased(MouseEvent event) {
                    HostLogout_CbtMouseMouseReleased(event);
                }
            });
        }
        return cbtHostLogout;
    }

    private JLabel getJLabel2() {
        if (jLabel2 == null) {
            jLabel2 = new JLabel();
            jLabel2.setText("Password");
        }
        return jLabel2;
    }

    private JTextField getCtfHostUserName() {
        if (ctfHostUserName == null) {
            ctfHostUserName = new JTextField();
        }
        return ctfHostUserName;
    }

    private JTextField getCtfHostName() {
        if (ctfHostName == null) {
            ctfHostName = new JTextField();
        }
        return ctfHostName;
    }

    private JPasswordField getCpfHostPassword() {
        if (cpfHostPassword == null) {
            cpfHostPassword = new JPasswordField();
            cpfHostPassword.setEchoChar('?');
        }
        return cpfHostPassword;
    }

    void HostLogout_CbtMouseMouseReleased(MouseEvent event) {
    }
    void HostLogin_CbtMouseMouseReleased(MouseEvent event) {
    }
    void FTPFileList_CbtMouseMouseReleased(MouseEvent event) {
    }
    void FTPDownload_CbtMouseMouseReleased(MouseEvent event) {
    }
    void FTPUpload_CbtMouseMouseReleased(MouseEvent event) {
    }
    void HostFileList_CbtNativeMouseMousePressed(MouseEvent event) {
    }
    void HostFileList_CltNativeMouseMouseReleased(MouseEvent event) {
    }
    void LocalFileList_CbtNativeMouseMousePressed(MouseEvent event) {
    }
    void LocalFileList_CltNativeMouseMouseReleased(MouseEvent event) {
    }
    void SetupFileList_HostFolder_CbtMouseMouseReleased(MouseEvent event) {
    }
    void SetupFileList_LocalFolder_CbtMouseMouseReleased(MouseEvent event) {
    }
    void FTPBreak_CbtMouseMouseReleased(MouseEvent event) {
    }

}

Block( Address 000009B0 Identity 00000918 )










ページの表示順:{ 新しい順/ 古い順}.
初期・ページの表示・位置:{ 先頭ページ/ 末尾ページ}.
1ページ内のスレッド表示数:

   
   

管理者用 Password:

  




SMT Version 8.022(+A) Release M6.
Author : amanojaku.


- Rental Orbit Space -