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

"伊邪那"

   
   

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











<Number>: [00000918]  <Date>: 2015/12/21 07:32:44
<Title>: Eclipse Java プログラム開発
<Name>: amanojaku@管理人



<Title>: Eclipse Java プログラム開発


Eclipse起動と環境設定
http://www.searchman.info/java_eclipse/1070.html

> ワークスペースの設定に
> スペース(空白)や全角文字を絶対入れてはいけません。
> デフォルトのままだと、
> 大抵「Documents and Settings」などが入っていて空白が入っています。
> しかし、これは後々困ることになるので、
> 絶対に空白や全角文字が入らないようにしましょう。

Pleiades - Eclipse プラグイン日本語化プラグイン MergeDoc Project
http://mergedoc.osdn.jp/

↑なぜか当方では最新の「Eclipse 4.5 Mars」が正常にインストールできなかったので、「Eclipse 4.4 Luna」をインストールした。

日本語 Eclipse 4.4 Pleiades All in One Java
http://mergedoc.osdn.jp/

Eclipseではじめるプログラミング(1):EclipseでJavaプログラミング超入門
http://www.atmarkit.co.jp/ait/articles/0405/29/news021.html

Java環境構築(Windows版) Eclipseのインストール - Tech Fun.cc
http://techfun.cc/java/windows-eclipse-install.html

Eclipse のインデント文字の設定変更 - Serendip Web Studio
http://www.serendip.ws/archives/4883

↑この設定は必須.

> メニューの『Eclipse』から『環境設定』を開き、左のツリーの『Java → Code Style → Formatter』を選択する。

↑[メニュー・バー]より[ウインドウ]→[設定]→[Java]→[コード・スタイル]→[フォーマッター].

> Formatter の設定画面から『New…』ボタンをクリックして新規プロファイルを作成する。

↑[プロファイル名]は適当に「Customize001」とかしておけば良い。

> Profile の設定画面の 『インデント』タブを選択し、『General settings』でタブの設定を行う。

↑プロファイルの設定画面の[Indentation]タブを選択し、[一般設定]パネルの[タブ・ポリシー]項目を[スペースのみ]に設定する。

Swing用Eclipseプラグインの決定版! Visual Swing for Eclipse
http://news.mynavi.jp/column/ide/060/

JavaDrive Eclipse入門 プロジェクトの作成
http://www.javadrive.jp/eclipse3/step/index1.html
JavaDrive Eclipse入門 ソースコードの作成
http://www.javadrive.jp/eclipse3/step/index2.html

GPソフト Wiki - Unicodeの基礎知識とJavaでの扱い
http://gpsoft.dip.jp/hiki/?Unicode%E3%81%AE%E5%9F%BA%E7%A4%8E%E7%9F%A5%E8%AD%98%E3%81%A8Java%E3%81%A7%E3%81%AE%E6%89%B1%E3%81%84

実行可能JARの作り方と実行の仕方 | システム開発ブログ
http://www.ilovex.co.jp/blog/system/projectandsystemdevelopment/jar.html

Thread.sleep(0) のオーバーヘッドがヤバイ件 - にょきにょきブログ
http://aoking.hatenablog.jp/entry/20130220/1361887465

↑もしかして「Thread.Sleep(0)」は「0ms」の Sleep ではないのかもしれない。

Javaで日本語1文字のバイト数- Java | 教えて!goo
http://oshiete.goo.ne.jp/qa/8247492.html

> 「Javaの内部文字コードはUTF-16」は半分誤り。
>  何を以て「内部文字コード」と表現するかにもよるのだが、物理的には変則的なUTF-8で物理メモリ上に格納されているので物理的にはUTF-16ではない。
>  論理的には、(サロゲートペアやバリエーションセレクターは例外として)Javaにおける1文字とは1つのcharに代入できる値の範囲であり、格納される各文字に割り当てられた値はUTF-16と完全に一致する。

String 型・変数の内部キャラクターセットは「変則的なUTF-8」、char 型・変数の内部キャラクターセットは「UTF-16」なので、String 型・変数の内部構造と char 型は全くの別物と言う事になる。
『「String 型・変数の内部構造」=「char 型」で、String 型・変数の内部キャラクターセットは「UTF-16」』だと勘違いしているサイトが結構 見られる。

なんと String 型関連の「getBytes( )、new String(byte[], Encode)」などで使用される「byte[]」配列のデータはプラットフォームのエンコード(キャラクター・セット)に依存するようだ(下記『Java 入門 | String クラス』参照)。
つまり「getBytes( )」で読み出したデータをプログラムで使ってはならない、「new String(byte[], Encode)」でデータを書き込んではならないと言う事を意味している。
通常は char(2バイト) 配列系の「toCharArray()、valueOf(char[])」などで処理してやれば良い(char のエンコード(キャラクター・セット) は UTF-16)。

『Java 入門 | String クラス』
http://msugai.fc2web.com/java/class/String.html

▲Eclipse を起動して「JRE or JDK が見つからない」みたいなエラー・メッセージが出たら、「eclipse.exe」と同じフォルダーにある「eclipse.ini」の最初に下記の2行の設定を追加する(<jdk〜>は実際の JDK フォルダー名を設定する)。

-vm
C:\Program Files\Java\<jdk〜>\bin\javaw.exe

▲合ってるハズなのにエラーが消えない場合は、そのファイルを一旦セーブしてみよう。
Java を実行する場合は実行したい Java が有るプロジェクトをマウスでクリックし選択状態にしてから、[メニュー・バー]より[実行]→[実行(S)]→{[アプリケーション]|[アプレット]}の どちらかを選択して起動してやる。
[メニュー・バー]より[実行]→[実行(R)]だと前に実行された方が実行されるようだ、例えば前にアプリケーションが実行されている場合はアプリケーションが実行される。

▲「Visual Swing for Eclipse」の使い方には、少々コツがいるような感じ。
チョットした操作で GUI 部品が消失してしまうバグがあるようなので、チョット変更したら こまめに([Ctrl]+[S]などで)セーブして、GUI 部品が消失してしまった場合はセーブせずに(タブの[×]ボタンとかで)タブを閉じセーブしないようにしてやる(セーブしてない変更は破棄されムダになってしまうが…)。
「Visual Swing for Eclipse」はキーボードからの[Ctrl]+[Z](元に戻す)は無効のようだが、マウスの右クリックのショートカット・メニューで「元に戻す」が実行可能なようだ。
ビジュアル画面とテキスト画面の区切りを上にあげすぎて その区切りが見えなくなると、ビジュアル画面が表示できなくなるようだ。
Visual Swing for Eclipse の Java コード画面では[Delete]キーは使えないようだ、[BackSpace]キーは使用可、マウスでテキストを選択し[BackSpace]キーで削除可能、[Ctrl]+X で「切り取り」も可能、[Ctrl]+V で「貼り付け」が可能。
場合によっては Java コードをコピーできない事もあるようで、その場合は(ウインドウ左側の)パッケージ・エクスプローラーに表示されている対象ファイルをマウスの右クリック→ショートカット・メニュー→[次で開く]→[Java エディター]とかでファイルを開いてやれば自由に編集(コピペなどが)できる。
「Visual Swing for Eclipse」で正常に変更できない場合があるようで、その場合は「Visual Swing for Eclipse」タブを一旦 閉じて[Java エディター]とかで変更してから、ふたたび「Visual Swing for Eclipse」で開いてやれば正常に変更できるようだ。
通常は Panel 上で画面デザイン(GUI 部品の配置)をしてやれば良いように思われる(その場合の"基本"は その Panel を Applet なり、Application なりに乗っけてやれば良いだけ)。
(import される)Layout パッケージは Java 標準の Layout パッケージではないので注意が必要。
どうも Visual Swing for Eclipse でビジュアルに画面デザイン(GUI 部品の配置)して自動生成された Java コードの編集には制限があるようだ、これは(Visual Swing for Eclipse によって)自動生成された Java コードの変更は最小限にした方が良いと言う事なのかもしれない、とりあえず継承により Java コードの変更は最小限にできるような感じ。
ただし、(Visual Swing for Eclipse によって)自動生成された Java コードの「変数、メソッド」は ことごとく private 修飾子が付加されているが(それでは他のクラスからの「メソッドの継承、変数へのアクセス」はできない)、private 修飾子を削除する事により同一パッケージ内(のクラス)からの「メソッドの継承、変数へのアクセス」などが可能になる(もし、他パッケージ(のクラス)からの「メソッドの継承、変数へのアクセス」などを可能にしたい場合は public 修飾子を付加しなければならない)。
メソッドをオーバーライドする場合は「@override」アノテーションを付加する事が推奨されている、ちゃんとオーバーライドできていない場合にコンパイラーがエラーを出してくれる。


<Number>: [00000955]  <Date>: 2015/12/21 12:18:00
<Title>: Java2 FTP Connect 7
<Name>: amanojaku@管理人



今回は「cltPathList」で選択された1つのファイルを FTP サーバーからダウンロードしてやる。
「cltPathList」は「絶対パス名、相対パス名」の どちらも指定可、パス名の先頭に"/"(スラシュ)が付いている場合は「絶対パス名」、パス名の先頭に"/"(スラシュ)が付いてない場合は「「相対パス名」となる。
なお、「cltPathList」はダブル・クリックには対応していません(クリックだけしか対応していません)。
「PASVMode:ON/OFF」、「HostEncode:UTF-8/Windows/EUC-JP/ASCII」、「FileDtata:Binary/ASCII」も設定可能。

/jars/commons-net-3.3.jarをダウンロード - Maple Capture
http://osdn.jp/projects/sfnet_maplecapture/downloads/jars/commons-net-3.3.jar/

クラスパスの設定
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」でないとエラーになるようだ.


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

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

クリック時にマウス・カーソルが動いてしまった場合 mouseClicked イベントだとイベントが発生しない"仕様"になっているようなので、mouse イベントに関しては mouseReleased イベントを使用している。
変更した部分はイベント用メソッドの「HostLogoutMouseMouseReleased、HostLoginMouseMouseReleased、FTPFileListMouseMouseReleased、HostEncodeVetoableChangeVetoableChange、FTPDownloadMouseMouseReleased」の private 修飾子を削除。
その他、「ccbHostEncode、ctfHostUserName、ctfHostName、cpfHostPassword、ctfHostFolder、ctfLocalFolder、ctfHostPortNum、ctaMessage、cltHostFileList、ccbFTPFileDataType、ctpFileListTabs、cckHostPASVMode」変数の 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.beans.PropertyChangeEvent;
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 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_File = ":-File:=";
    private final String fvsPathListType_Folder = ":+Folder:=";

    Matcher matcher;
    // Pattern pattern;
    // Transfer // Connect
    boolean lFTPConnection = 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 vsHostFolder;
    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){ }
        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", "us-ascii"); //
            }
        };

    }
    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: "+
            "vsHostEncodee="+vsHostEncode+"; "+
            "vsHostName="+vsHostName+"; "+
            "iHostPortNum="+iHostPortNum+"; "+
            "vsHostUserName="+vsHostUserName+"; "+
            "vsHostPassword="+vsHostPassword+"; "+
            "");

        try {
            client = new FTPClient();
            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");
           }

        } 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 FTPFile[] getFTPList(){
        System.out.println("getFTPList( );");

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

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

            // vsLocalEncode = da1CharEncodeSets.get((String)oMainPanelImp.ccbLocalEncode.getSelectedItem());

            client.doCommand("CWD", vsHostFolder);
            // String[] fileNames = client.listNames();
            FTPFile[] oFTPFile = client.listFiles();
            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");
            vsHostFolder = client.printWorkingDirectory();
            oMainPanelImp.ctfHostFolder.setText(vsHostFolder);
            System.out.println("vsHostFolder="+vsHostFolder+"; ");
            ((DefaultListModel)oMainPanelImp.cltHostFileList.getModel( )).removeAllElements( );
            String vsElement = "";
            String[] d1vsHostFile =  new String[client.listFiles().length];
            int i = 0;
            for (FTPFile oFile : client.listFiles()) {
                String vsHostFile = oFile.getName();
                String vsHostPath = vsHostFolder+(vsHostFolder.endsWith("/") ? "" : "/")+vsHostFile;
                if(oFile.isFile()){
                    System.out.print(fvsPathListType_File);
                    vsElement = fvsPathListType_File;
                }else if(oFile.isDirectory( )){
                    System.out.print(fvsPathListType_Folder);
                    vsElement = fvsPathListType_Folder;
                }
                System.out.println("Name="+vsHostPath);
                d1vsHostFile[i] = vsElement+vsHostFile;
                i++;
            }
            System.out.println("Arrays.sort( );");
            Arrays.sort(d1vsHostFile, 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);
                }
            });
            for ( i = 0; i<d1vsHostFile.length; ++i) {
                byte[] d1bFileElement = d1vsHostFile[i].getBytes();
                System.out.print("d1bFileElement="+d1bFileElement+"; ");
                System.out.print("Hex=");
                for(int j = 0; j<d1bFileElement.length; j++){
                    int k = d1bFileElement[j];
                    if( k<0 ){ k = 256+k; }
                    // ↑2の補数の負の値を正の値に変換している.
                    System.out.print(Integer.toHexString(k)+"; ");
                }
                System.out.println("");

                ((DefaultListModel)oMainPanelImp.cltHostFileList.getModel( )).addElement(
                    d1vsHostFile[i]);
                System.out.println(d1vsHostFile[i]);

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

    }

    public void FTPDownload( ){
        matcher = null;
        Pattern pattern = null;
        String vsTargetFile = null;
        if( ! oMainPanelImp.cltHostFileList.isSelectionEmpty() ){
            pattern = Pattern.compile("^"+fvsPathListType_File);
            vsTargetFile = (String)oMainPanelImp.cltHostFileList.getSelectedValue();
            matcher = pattern.matcher(vsTargetFile);
            if(matcher.find()){
                 vsTargetFile = matcher.replaceAll("");
            }else{
                vsTargetFile = null;
                oMainPanelImp.ctaMessage.append("PathList でファイルが選択せれていません.\n");
            }
        }else{
            vsTargetFile = null;
            oMainPanelImp.ctaMessage.append("PathList で項目が選択せれていません.\n");
        }
        if( vsTargetFile!=null ){
            pattern = Pattern.compile("( |\n)$");

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

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

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

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

            String vsHostPath = vsHostFolder+(vsHostFolder.endsWith("/") ? "" : "/")+vsTargetFile;
            vsLocalPath= vsLocalPath+(vsLocalPath.endsWith("/") ? "" : "/")+vsTargetFile;

            System.out.println("FTPDownload: "+
                "vsTargetFile="+vsTargetFile+"; "+
                "vsLocalFolder="+vsLocalFolder+"; "+
                "vsHostFolder="+vsHostFolder+"; "+
                "vsLocalPath="+vsLocalPath+"; "+
                "vsHostPath="+vsHostPath+"; "+
                "");

            FileOutputStream oFOS = null;
            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.");
                }
                // File Download.
                oFOS = new FileOutputStream(vsLocalPath);
                client.retrieveFile(vsHostPath, oFOS);
                oFOS.close();
                System.out.println("File Download Completed.");
                oMainPanelImp.ctaMessage.append("File Download Completed.\n");

            }catch(Exception e){
                e.printStackTrace();
                oMainPanelImp.ctaMessage.append("Exception:FTPDownload.\n");
            }
        }
    }

    class MainPanelImplementationObj extends MainPanelDesign {

        // oMainApp;

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

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

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

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

            if( lFTPConnection ){
                FTPFile  d1oPathList[] = getFTPList();
            }
        }
        @Override
        void FTPDownloadMouseMouseReleased(MouseEvent event) {
             System.out.println("MainPanelImplementationObj:MouseEvent:FTPDownloadMouseMouseReleased.");

             FTPDownload( );
       }
        @Override
        void HostEncodeVetoableChangeVetoableChange(PropertyChangeEvent event) {
            System.out.println("MainPanelImplementationObj:PropertyChangeEvent:FTPEncodeVetoableChangeVetoableChange.");

        }

    }

    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();
        }

    }

}



『MainPanelDesign.java』


import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.VetoableChangeListener;

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.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 cbtFTPFileList;
    private JButton cbtFTPUpload;
    JComboBox ccbHostEncode;
    JTextField ctfHostUserName;
    JTextField ctfHostName;
    JPasswordField cpfHostPassword;
    JTextField ctfHostFolder;
    JTextField ctfLocalFolder;
    JTextField ctfHostPortNum;
    JTextArea ctaMessage;
    JList cltHostFileList;
    JComboBox ccbFTPFileDataType;
    JTabbedPane ctpFileListTabs;
    JCheckBox cckHostPASVMode;
    private JButton cbtFTPDownload;
    private JLabel jLabel2;
    private JLabel jLabel3;
    private JLabel jLabel4;
    private JLabel jLabel6;
    private JLabel jLabel5;
    private JLabel jLabel0;
    private JLabel jLabel1;
    private JLabel jLabel7;
    private JLabel jLabel9;
    private JScrollPane jScrollPane0;
    private JScrollPane jScrollPane1;
    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(getCbtHostLogin(), new Constraints(new Leading(12, 72, 12, 12), new Leading(213, 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(getCbtFTPFileList(), new Constraints(new Leading(250, 12, 12), new Leading(11, 12, 12)));
        add(getCbtFTPDownload(), new Constraints(new Leading(315, 10, 10), new Leading(11, 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(getCbtFTPUpload(), new Constraints(new Leading(415, 10, 10), new Leading(11, 12, 12)));
        add(getCtfLocalFolder(), new Constraints(new Leading(322, 142, 12, 12), new Leading(82, 12, 12)));
        add(getJLabel4(), new Constraints(new Leading(250, 12, 12), new Leading(84, 12, 12)));
        add(getCtfHostName(), new Constraints(new Leading(89, 142, 12, 12), new Leading(82, 12, 12)));
        add(getCcbHostEncode(), new Constraints(new Leading(92, 12, 12), new Leading(47, 12, 12)));
        add(getJLabel1(), new Constraints(new Leading(12, 12, 12), new Leading(51, 12, 12)));
        add(getCtfHostPortNum(), new Constraints(new Leading(89, 142, 12, 12), new Leading(116, 12, 12)));
        add(getCtfHostUserName(), new Constraints(new Leading(89, 138, 12, 12), new Leading(151, 12, 12)));
        add(getCpfHostPassword(), new Constraints(new Leading(89, 139, 12, 12), new Leading(183, 12, 12)));
        add(getJLabel3(), new Constraints(new Leading(249, 12, 12), new Leading(119, 12, 12)));
        add(getCtfHostFolder(), new Constraints(new Leading(321, 144, 12, 12), new Leading(118, 12, 12)));
        add(getJLabel5(), new Constraints(new Leading(12, 12, 12), new Leading(85, 12, 12)));
        add(getJLabel0(), new Constraints(new Leading(12, 12, 12), new Leading(117, 12, 12)));
        add(getCbtHostLogout(), new Constraints(new Leading(94, 10, 10), new Leading(213, 12, 12)));
        add(getCtpFileListTabs(), new Constraints(new Leading(250, 217, 12, 12), new Leading(168, 218, 10, 10)));
        setSize(501, 400);
    }

    private JButton getCbtFTPUpload() {
        if (cbtFTPUpload == null) {
            cbtFTPUpload = new JButton();
            cbtFTPUpload.setText("Upload");
            cbtFTPUpload.setEnabled(false);
        }
        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 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());
        }
        return ctpFileListTabs;
    }

    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);
            ccbHostEncode.addVetoableChangeListener(new VetoableChangeListener() {

                public void vetoableChange(PropertyChangeEvent event) {
                    HostEncodeVetoableChangeVetoableChange(event);
                }
            });
        }
        return ccbHostEncode;
    }

    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) {
                    FTPDownloadMouseMouseReleased(event);
                }
            });
        }
        return cbtFTPDownload;
    }

    private JButton getCbtFTPFileList() {
        if (cbtFTPFileList == null) {
            cbtFTPFileList = new JButton();
            cbtFTPFileList.setText("List");
            cbtFTPFileList.addMouseListener(new MouseAdapter() {

                public void mouseReleased(MouseEvent event) {
                    FTPFileListMouseMouseReleased(event);
                }
            });
        }
        return cbtFTPFileList;
    }

    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);
        }
        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) {
                    HostLoginMouseMouseReleased(event);
                }
            });
        }
        return cbtHostLogin;
    }

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

    private JLabel getJLabel4() {
        if (jLabel4 == null) {
            jLabel4 = new JLabel();
            jLabel4.setText("LocalFolder");
        }
        return jLabel4;
    }

    private JLabel getJLabel3() {
        if (jLabel3 == null) {
            jLabel3 = new JLabel();
            jLabel3.setText("HostFolder");
        }
        return jLabel3;
    }

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

                public void mouseReleased(MouseEvent event) {
                    HostLogoutMouseMouseReleased(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 HostLogoutMouseMouseReleased(MouseEvent event) {
    }
    void HostLoginMouseMouseReleased(MouseEvent event) {
    }
    void FTPFileListMouseMouseReleased(MouseEvent event) {
    }
    void HostEncodeVetoableChangeVetoableChange(PropertyChangeEvent event) {
    }
    void FTPDownloadMouseMouseReleased(MouseEvent event) {
    }

}


<Number>: [0000095D]  <Date>: 2015/12/21 12:19:26
<Title>: Java2 FTP Connect 7 実行可能 JAR
<Name>: amanojaku@管理人



「Java2 FTP Connect 7」の実行可能 JAR ファイルをアップします。
「FTPConnect7.cab」を適当なフォルダーに解凍すると、「FTPConnect.jar、FTPConnect.bat」が解凍されます。
(まず Java がインストールされていないと実行できません)「FTPConnect.jar、FTPConnect.bat」は同一のフォルダーでなければ実行できません。
「FTPConnect.bat」を(ダブル・クリックして)実行して下さい(「FTPConnect.jar」だと実行できない場合があります)。
ディスクトップに(実行用のショートカット)アイコンを置きたい場合は、「FTPConnect.bat」のショートカットを自分でディスクトップにコピペして下さい(ショートカットの作成のしかたは Web で検索して下さい)。

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

実行可能 JAR 作成に関しては下記ページを参照.

実行可能JARの作り方と実行の仕方 | システム開発ブログ
http://www.ilovex.co.jp/blog/system/projectandsystemdevelopment/jar.html

Click to Download. 0000095D.1.cab:(Size=294,326Byte) Name = FTPConnect7.cab


<Number>: [0000096B]  <Date>: 2015/12/22 10:24:06
<Title>: Java2 MouseDoubleClicked 1
<Name>: amanojaku@管理人



今回はマウスのダブル・クリックを検出してみる。

《参考》
『Java2 Appletcation 3 「キャンバス(Panel)、ボタン、イベント」』
http://artemis.rosx.net/sjis/smt.cgi?r+izanami/&bid+00000918&tsn+00000928.+&

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

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

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

変更した部分はイベント用メソッドの「Test_CbtNativeMouseMouseReleased、Test_CbtNativeMouseMousePressed」の private 修飾子を削除。
その他、「jLabel0」変数の private 修飾子を削除(Button など Component を直にイジる必要がなければ private 修飾子を削除しなくても良い)。


『MouseDoubleClicked.java』


import java.awt.Dimension;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
//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 javax.swing.JApplet;
import javax.swing.JFrame;

@SuppressWarnings("serial")
public class MouseDoubleClicked extends JApplet{
    static MouseDoubleClicked oMainApp;
    static boolean lApplication = false; // true;

    static MainAppFrameObj oMainAppFrame;
    MainPanelImplementationObj oMainPanelImp;

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

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

        if( lApplication ){
            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("AppletWidth="+getSize( ).getWidth());
        System.out.println("AppletHeight="+getSize( ).getHeight());
        System.out.println("Hello, World!");
    }
    public void start(){
        System.out.println("start( );");

        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = ge.getDefaultScreenDevice();
        GraphicsConfiguration gc = gd.getDefaultConfiguration();
        System.out.println("ScreenWidth="+gc.getBounds().getWidth());
        System.out.println("ScreenHeight="+gc.getBounds().getHeight());

        repaint();

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

    class MainPanelImplementationObj extends MainPanelDesign {

        long ilDoubleClickedIntervalMax = 250; // 350; 300;

        // volatile:最適化の抑制.
        volatile byte ibCnt_Test_CbtMouseMouseDoubleClicked = 0;
        Thread oThread_Test_CbtMouseMouseDoubleClicked;
        Runnable oRunner_Test_CbtMouseMouseDoubleClicked;

        MainPanelImplementationObj(){
            super( );

            oThread_Test_CbtMouseMouseDoubleClicked = new Thread(
                oRunner_Test_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_Test_CbtMouseMouseDoubleClicked==2 ){
                                ibCnt_Test_CbtMouseMouseDoubleClicked = 0;
                                Test_CbtMouseMouseClicked( );
                            }

                        }
                    }
                }
            );
            oThread_Test_CbtMouseMouseDoubleClicked.start( );

        }

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

             jLabel0.setText("SingleClicked");
         }
         void Test_CbtMouseMouseDoubleClicked( ) {
            System.out.println("MainPanelImplementationObj:MouseEvent:Test_CbtMouseMouseDoubleClicked.");

             jLabel0.setText("DoubleClicked");
         }
        @Override
        void Test_CbtNativeMouseMousePressed(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:Test_CbtNativeMouseMousePressed.");

            System.out.println("currentTimeMillis="+System.currentTimeMillis() );

            if(oThread_Test_CbtMouseMouseDoubleClicked.getState()==Thread.State.TIMED_WAITING){
                ibCnt_Test_CbtMouseMouseDoubleClicked = 3;
                oThread_Test_CbtMouseMouseDoubleClicked.interrupt();
            }else{
                ibCnt_Test_CbtMouseMouseDoubleClicked = 1;
            }

            System.out.println("ibCnt_Test_CbtMouseMouseDoubleClicked="+ibCnt_Test_CbtMouseMouseDoubleClicked+"; ");
       }
        @Override
        public void Test_CbtNativeMouseMouseReleased(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:Test_CbtNativeMouseMouseReleased.");

            System.out.println("currentTimeMillis="+System.currentTimeMillis() );

            if(ibCnt_Test_CbtMouseMouseDoubleClicked==3){
                ibCnt_Test_CbtMouseMouseDoubleClicked = 0;
                Test_CbtMouseMouseDoubleClicked( );
            }else if(oThread_Test_CbtMouseMouseDoubleClicked.getState()==Thread.State.WAITING){
                ibCnt_Test_CbtMouseMouseDoubleClicked = 2;
                synchronized(oRunner_Test_CbtMouseMouseDoubleClicked) {
                    oRunner_Test_CbtMouseMouseDoubleClicked.notify();
                    // ↑ synchronized(自分のインスタンス) ブロックで囲わないとないと
                    // 実行時に「IllegalMonitorStateException」が発生する。
                    // ここ(this)は他人なので、ここのメソッドを synchronized 指定してもダメ。
                }
            }

            System.out.println("ibCnt_Test_CbtMouseMouseDoubleClicked="+ibCnt_Test_CbtMouseMouseDoubleClicked+"; ");
        }

    }

    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.");
                           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();
        }
    }

}



『MainPanelDesign.java』


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

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

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 jButton0;
    JLabel jLabel0;

    public MainPanelDesign() {
        initComponents();
    }

    private void initComponents() {
        setLayout(new GroupLayout());
        add(getJLabel0(), new Constraints(new Leading(12, 259, 12, 12), new Leading(36, 10, 10)));
        add(getJButton0(), new Constraints(new Leading(12, 12, 12), new Leading(83, 10, 10)));
        setSize(288, 141);
    }

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

    private JButton getJButton0() {
        if (jButton0 == null) {
            jButton0 = new JButton();
            jButton0.setText("jButton0");
            jButton0.addMouseListener(new MouseAdapter() {

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

                public void mouseReleased(MouseEvent event) {
                    Test_CbtNativeMouseMouseReleased(event);
                }
            });
        }
        return jButton0;
    }

    void Test_CbtNativeMouseMouseReleased(MouseEvent event) {
    }
    void Test_CbtNativeMouseMousePressed(MouseEvent event) {
    }

}


<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) {
    }

}


<Number>: [0000096E]  <Date>: 2015/12/22 15:50:47
<Title>: Java2 FTP Connect 8 実行可能 JAR
<Name>: amanojaku@管理人



「Java2 FTP Connect 8」の実行可能 JAR ファイルをアップします。
「FTPConnect8.cab」を適当なフォルダーに解凍すると、「FTPConnect.jar、FTPConnect.bat」が解凍されます。
(まず Java がインストールされていないと実行できません)「FTPConnect.jar、FTPConnect.bat」は同一のフォルダーでなければ実行できません。
「FTPConnect.bat」を(ダブル・クリックして)実行して下さい(「FTPConnect.jar」だと実行できない場合があります)。
ディスクトップに(実行用のショートカット)アイコンを置きたい場合は、「FTPConnect.bat」のショートカットを自分でディスクトップにコピペして下さい(ショートカットの作成のしかたは Web で検索して下さい)。

《参考》
『Java2 FTP Connect 8』
http://artemis.rosx.net/sjis/smt.cgi?r+izanami/&bid+00000918&tsn+0000096C-0000096D&

実行可能 JAR 作成に関しては下記ページを参照.

実行可能JARの作り方と実行の仕方 | システム開発ブログ
http://www.ilovex.co.jp/blog/system/projectandsystemdevelopment/jar.html

Click to Download. 0000096E.1.cab:(Size=304,028Byte) Name = FTPConnect8.cab


<Number>: [00000972]  <Date>: 2015/12/26 10:52:28
<Title>: Java2 FTP Connect 9『FTPConnect.java』
<Name>: amanojaku@管理人



今回はデータの(暗黙の)「セーブ、ロード」処理(ファイル名は「FTPConnect.sr」としている)。
また複数のフォルダーの登録と、複数のフォルダーの単位の「アップロード、ダウンロード」(子フォルダーに対する再帰的な処理)。
TransferList にデータが存在する場合は「HostFolder、LocalFolder」のデータは無視され、TransferList にデータが存在しない場合は「HostFolder、LocalFolder」のデータで処理される。

《参考》
『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.+&
『Java2 FTP Connect 8』
http://artemis.rosx.net/sjis/smt.cgi?r+izanami/&bid+00000918&tsn+0000096C-0000096D&

クラスパスの設定
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 イベントも使用している。

変更した部分はイベント用メソッドの「ctfHostUserName、ctfHostName、cpfHostPassword、ctfHostFolder、ctfLocalFolder、ctfHostPortNum、ctaMessage、cltHostFileList、cltLocalFileList、ccbFTPFileDataType、ctpFileListTabs、cckHostPASVMode、ccbHostEncode、cpnFTPSetting、ctpBaseTabs、cltHostTransferList、cltLocalTransferList、ctpTransferListTabs」の private 修飾子を削除。
その他、「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、TransferListEntry_CbtMouseMouseReleased、TransferListDelete_CbtMouseMouseReleased」変数の 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.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.SocketException;
import java.text.SimpleDateFormat;
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 {
    private static FTPConnect oMainApp;
    private static boolean lApplication = false; // true; //
    private static MainAppFrameObj oMainAppFrame;
    private MainPanelImplementationObj oMainPanelImp;
    private final String fvsSerialFile = "FTPConnect.sr";
    private final String fvsSerialVersion = "1.1";
    private final String fvsSnapShotFile = ".FTPConnect.SnapShot";

    // private final String fvsPathListTag_Folder = ":+Folder:=";
    private final String fvsPathListTag_File = "-<File>=";
    private final String fvsReg_PathListTag_File = "\\-<File>=";
    private final String fvsPathListTag_Folder = "+<Directory>=";
    private final String fvsReg_PathListTag_Folder = "\\+<Directory>=";
    private final String fvsPathListTag_TimeStamp = " <TimeStamp>=";
    private final String fvsReg_PathListTag_TimeStamp = " <TimeStamp>=";

    private Matcher matcher;
    // Pattern pattern;
    // Transfer // Connect
    private boolean lFTPConnection = false; // true; //
    private boolean lFTPBreak = false; // true; //
    private 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();
        Read( );
        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( );");

        Write( );
    }

    public void Write() {
        try {
            int iListSize;
            ObjectOutputStream oOOSSerial = new ObjectOutputStream(new FileOutputStream(fvsSerialFile));
            oOOSSerial.writeObject(fvsSerialVersion);
            oOOSSerial.writeBoolean(oMainPanelImp.cckHostPASVMode.isSelected( ));
            oOOSSerial.writeObject(oMainPanelImp.ccbHostEncode.getSelectedObjects( ));
            oOOSSerial.writeObject(oMainPanelImp.ctfHostName.getText( ));
            oOOSSerial.writeObject(oMainPanelImp.ctfHostPortNum.getText( ));
            oOOSSerial.writeObject(oMainPanelImp.ctfHostUserName.getText( ));
            oOOSSerial.writeObject(new String(oMainPanelImp.cpfHostPassword.getPassword( )));
            oOOSSerial.writeObject(oMainPanelImp.ccbFTPFileDataType.getSelectedObjects( ));
            oOOSSerial.writeObject(oMainPanelImp.ctfLocalFolder.getText( ));
            oOOSSerial.writeObject(oMainPanelImp.ctfHostFolder.getText( ));
            iListSize = ((DefaultListModel)oMainPanelImp.cltHostTransferList.getModel( )).getSize( );
            oOOSSerial.writeInt(iListSize );
            for(int i=0; i<iListSize; i++ ){
                oOOSSerial.writeObject(
                    ((DefaultListModel)oMainPanelImp.cltHostTransferList.getModel( )).getElementAt(i));
            }
            iListSize = ((DefaultListModel)oMainPanelImp.cltLocalTransferList.getModel( )).getSize( );
            oOOSSerial.writeInt(iListSize );
            for(int i=0; i<iListSize; i++ ){
                oOOSSerial.writeObject(
                    ((DefaultListModel)oMainPanelImp.cltLocalTransferList.getModel( )).getElementAt(i));
            }
            oOOSSerial.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            System.out.println("FileNotFoundException:Write.");
            PutMessage("FileNotFoundException:Write.\n");
            PutMessage("ファイルが見つかりません。\n");
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("IOException:Write.");
            PutMessage("IOException:Write.\n");
        }
    }

    public void Read() {
        try {
            ObjectInputStream oOISSerial = new ObjectInputStream(new FileInputStream(fvsSerialFile));
            String vsVersion = (String)oOISSerial.readObject( );
            if( fvsSerialVersion.compareTo("")==0){
                // Non-Operation
            }else if( fvsSerialVersion.compareTo(vsVersion)!=0){
                System.out.println("Error:SerialVersion.");
                PutMessage("Error:SerialVersion.\n");
            }else{
                int iListSize;
                oMainPanelImp.cckHostPASVMode.setSelected(oOISSerial.readBoolean( ));
                oMainPanelImp.ccbHostEncode.setSelectedItem(oOISSerial.readObject( ));
                oMainPanelImp.ctfHostName.setText((String)oOISSerial.readObject( ));
                oMainPanelImp.ctfHostPortNum.setText((String)oOISSerial.readObject( ));
                oMainPanelImp.ctfHostUserName.setText((String)oOISSerial.readObject( ));
                oMainPanelImp.cpfHostPassword.setText((String)oOISSerial.readObject( ));
                oMainPanelImp.ccbFTPFileDataType.setSelectedItem(oOISSerial.readObject( ));
                oMainPanelImp.ctfLocalFolder.setText((String)oOISSerial.readObject( ));
                oMainPanelImp.ctfHostFolder.setText((String)oOISSerial.readObject( ));
                iListSize = oOISSerial.readInt( );
                for(int i=0; i<iListSize; i++ ){
                    ((DefaultListModel)oMainPanelImp.cltHostTransferList.getModel( )).addElement(
                        oOISSerial.readObject( ));
                }
                iListSize = oOISSerial.readInt( );
                for(int i=0; i<iListSize; i++ ){
                    ((DefaultListModel)oMainPanelImp.cltLocalTransferList.getModel( )).addElement(
                        oOISSerial.readObject( ));
                }
                oOISSerial.close( );
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            System.out.println("FileNotFoundException:Read.");
            // PutMessage("FileNotFoundException:Read.\n");
            // PutMessage("ファイルが見つかりません。\n");
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("IOException:Read.");
            PutMessage("IOException:Read.\n");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            System.out.println("ClassNotFoundException:Read.");
            PutMessage("ClassNotFoundException:Read.\n");
        }
    }

    public void PutMessage(String vsMsg){
        // System.out.println("PutMessage( );");

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

        oMainPanelImp.ctaMessage.append(vsMsg);
    }

    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.");
                PutMessage("Success:Login.\n");
            }else{
                System.out.println("Error:FTP PositiveCompletion.");
                PutMessage("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 (NumberFormatException e) {
            e.printStackTrace();
            System.out.println("NumberFormatException:FTPLogin.");
            PutMessage("NumberFormatException:FTPLogin.\n");
            PutMessage("FTPポートの値が数値ではありません。\n");
        } catch (SocketException e) {
            e.printStackTrace();
            System.out.println("SocketException:FTPLogin.");
            PutMessage("SocketException:FTPLogin.\n");
            PutMessage("Socket通信に失敗しました。\n");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            System.out.println("FileNotFoundException:FTPLogin.");
            PutMessage("FileNotFoundException:FTPLogin.\n");
            PutMessage("ファイルが見つかりません。\n");
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("IOException:FTPLogin.");
            PutMessage("IOException:FTPLogin.\n");
        }

    }

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

        try {
            lFTPConnection = false; // true; //
            if( client!=null && client.isConnected( ) ){
                client.disconnect( );
                System.out.println("FTP Disconnect.");
                PutMessage("FTP Disconnect.\n");
            }
        } catch (NumberFormatException e) {
            e.printStackTrace();
            System.out.println("NumberFormatException:FTPLogout.");
            PutMessage("NumberFormatException:FTPLogout.\n");
            PutMessage("FTPポートの値が数値ではありません。\n");
        } catch (SocketException e) {
            e.printStackTrace();
            System.out.println("SocketException:FTPLogout.");
            PutMessage("SocketException:FTPLogout.\n");
            PutMessage("Socket通信に失敗しました。\n");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            System.out.println("FileNotFoundException:FTPLogout.");
            PutMessage("FileNotFoundException:FTPLogout.\n");
            PutMessage("ファイルが見つかりません。\n");
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("IOException:FTPLogout.");
            PutMessage("IOException:FTPLogout.\n");
        }
    }

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

        if( client==null || ! client.isConnected( ) ){
            oMainPanelImp.ctaMessage.append("Login されていません。\n");
            return;
        }
        try {

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

            // JScrollPane には暗黙の子 JViewport が存在するようだ。
            // つまり、この場合の JList の親は JViewport になり、
            // JList の親の親が JScrollPane となる。
            JScrollPane oTabsSelectedComponent = (JScrollPane)(oMainPanelImp.cltHostFileList.getParent( ).getParent( ));
            oMainPanelImp.ctpFileListTabs.setSelectedComponent(oTabsSelectedComponent);
            if( client==null ){
                System.out.println("if(client==null)");
                PutMessage("if(client==null)\n");
                return;
            }

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

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

            System.out.println("vsHostCurrent="+vsHostCurrent+"; ");
            System.out.println("vsTargetFile="+vsTargetFile+"; ");
            if( vsTargetFile.compareTo("..")==0 ){
                System.out.println("if( vsTargetFile.compareTo(..)==0 )");
                vsTargetFile = "";
                client.changeToParentDirectory();
            }else{
                if( vsTargetFile.compareTo("")!=0 ){
                    vsHostCurrent = vsHostCurrent+(vsHostCurrent.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);
            PutMessage(vsMsg+"\n");
            vsHostCurrent = client.printWorkingDirectory();

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

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

            SimpleDateFormat oSDF = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
            String vsElement = "";
            String[] d1vsHostFile =  new String[client.listFiles().length];
            HashMap<String, String> da1PathListSets = new HashMap<String, String>( );
            int i = 0;
            for (FTPFile oFTPFile : client.listFiles()) {
                String vsTimeStamp = fvsPathListTag_TimeStamp+oSDF.format(oFTPFile.getTimestamp().getTime());
                String vsHostFile = oFTPFile.getName();
                String vsHostPath = vsHostCurrent+(vsHostCurrent.endsWith("/") ? "" : "/")+vsHostFile;
                if( oFTPFile.isFile( ) ){
                    vsElement = fvsPathListTag_File;
                }else if( oFTPFile.isDirectory( ) ){
                    vsElement = fvsPathListTag_Folder;
                }
                d1vsHostFile[i] = vsElement+vsHostFile;
                da1PathListSets.put(d1vsHostFile[i], vsTimeStamp);
                System.out.println(d1vsHostFile[i]);
                System.out.println(vsTimeStamp);
                i++;
            }
            FileSort(d1vsHostFile);
            for ( i = 0; i<d1vsHostFile.length; ++i) {
                ((DefaultListModel)oMainPanelImp.cltHostFileList.getModel( )).addElement(
                    d1vsHostFile[i]);
                String vsTimeStamp = da1PathListSets.get(d1vsHostFile[i]);
                System.out.println(d1vsHostFile[i]);
                System.out.println(vsTimeStamp);

                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 (NumberFormatException e) {
            e.printStackTrace();
            System.out.println("NumberFormatException:HostFileList.");
            PutMessage("NumberFormatException:HostFileList.\n");
            PutMessage("FTPポートの値が数値ではありません。\n");
        } catch (SocketException e) {
            e.printStackTrace();
            System.out.println("SocketException:HostFileList.");
            PutMessage("SocketException:HostFileList.\n");
            PutMessage("Socket通信に失敗しました。\n");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            System.out.println("FileNotFoundException:HostFileList.");
            PutMessage("FileNotFoundException:HostFileList.\n");
            PutMessage("ファイルが見つかりません。\n");
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("IOException:HostFileList.");
            PutMessage("IOException:HostFileList.\n");
        }

    }

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

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

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

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

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

        File oLocalCurrent = null;
        System.out.println("vsTargetFile="+vsTargetFile+"; ");
        try {
            vsHostCurrent = "";
            oLocalCurrent = new File(vsLocalCurrent,vsTargetFile);
            vsLocalCurrent = oLocalCurrent.getCanonicalPath( );
            if( vsTargetFile.compareTo("..")==0 ){
                System.out.println("if( vsTargetFile.compareTo(..)==0 )");
                vsTargetFile = "";
            }
            oMainPanelImp.ctfLocalFolder.setText(vsLocalCurrent);
            System.out.println("vsLocalCurrent="+vsLocalCurrent+"; ");
        } catch (IOException e) {
            // TODO 自動生成された catch ブロック
            e.printStackTrace();
            System.out.println("IOException:LocalFileList.");
            PutMessage("IOException:LocalFileList.\n");
            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(
                    fvsPathListTag_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 = fvsPathListTag_File;
                }else if(oFile.isDirectory( )){
                    vsElement = fvsPathListTag_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("");
            }
        }

    }

    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 FTPDownloadTransfer( ){
        if( client==null || ! client.isConnected( ) ){
            PutMessage("Login されていません。\n");
            return;
        }
        String vsSaveBuf_HostFolder, vsSaveBuf_LocalFolder;
        String vsHostPath, vsLocalPath;
        vsSaveBuf_HostFolder = oMainPanelImp.ctfHostFolder.getText( );
        vsSaveBuf_LocalFolder = oMainPanelImp.ctfLocalFolder.getText( );
        int iListSize = ((DefaultListModel)oMainPanelImp.cltHostTransferList.getModel( )).getSize( );
        for(int i = 0; i<iListSize; i++){
            oMainPanelImp.ctfHostFolder.setText( (String)
                ((DefaultListModel)oMainPanelImp.cltHostTransferList.getModel( )).getElementAt(i));
            oMainPanelImp.ctfLocalFolder.setText( (String)
                ((DefaultListModel)oMainPanelImp.cltLocalTransferList.getModel( )).getElementAt(i));
        System.out.println("FTPDownloadTransfer( ): "+
            "oMainPanelImp.ctfHostFolder.getText="+oMainPanelImp.ctfHostFolder.getText()+"; "+
            "oMainPanelImp.ctfHostFolder.getText="+oMainPanelImp.ctfLocalFolder.getText()+"; "+
            "");

            FTPDownload( );
        }
        oMainPanelImp.ctfHostFolder.setText(vsSaveBuf_HostFolder);
        oMainPanelImp.ctfLocalFolder.setText(vsSaveBuf_LocalFolder);
        System.out.println("FTPDownloadTransfer Completed.");
    }

    public void FTPDownload( ){
        if( client==null || ! client.isConnected( ) ){
            PutMessage("Login されていません。\n");
            return;
        }
        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("^"+fvsPathListTag_File);
            matcher = pattern.matcher(vsTargetFile);
            vsTargetFile = matcher.replaceAll("");

            pattern = Pattern.compile("^"+fvsPathListTag_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.");
            PutMessage("FTPDownload Completed.\n");
            try {
                client.changeWorkingDirectory(vsHostCurrent);
            } catch (NumberFormatException e) {
                e.printStackTrace();
                System.out.println("NumberFormatException:FTPDownload.");
                PutMessage("NumberFormatException:FTPDownload.\n");
                PutMessage("FTPポートの値が数値ではありません。\n");
            } catch (SocketException e) {
                e.printStackTrace();
                System.out.println("SocketException:FTPDownload.");
                PutMessage("SocketException:FTPDownload.\n");
                PutMessage("Socket通信に失敗しました。\n");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
                System.out.println("FileNotFoundException:FTPDownload.");
                PutMessage("FileNotFoundException:FTPDownload.\n");
                PutMessage("ファイルが見つかりません。\n");
            } catch (IOException e) {
                e.printStackTrace();
                System.out.println("IOException:FTPDownload.");
                PutMessage("IOException:FTPDownload.\n");
            }
        }

        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 (NumberFormatException e) {
                e.printStackTrace();
                System.out.println("NumberFormatException:FTPDownloadFolder.");
                PutMessage("NumberFormatException:FTPDownloadFolder.\n");
                PutMessage("FTPポートの値が数値ではありません。\n");
            } catch (SocketException e) {
                e.printStackTrace();
                System.out.println("SocketException:FTPDownloadFolder.");
                PutMessage("SocketException:FTPDownloadFolder.\n");
                PutMessage("Socket通信に失敗しました。\n");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
                System.out.println("FileNotFoundException:FTPDownloadFolder.");
                PutMessage("FileNotFoundException:FTPDownloadFolder.\n");
                PutMessage("ファイルが見つかりません。\n");
            } catch (IOException e) {
                e.printStackTrace();
                System.out.println("IOException:FTPDownloadFolder.");
                PutMessage("IOException:FTPDownloadFolder.\n");
            }
        }
    }

    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();
            PutMessage("vsHostPath = "+vsHostPath+";"+"\n");
            PutMessage("vsLocalPath = "+vsLocalPath+";"+"\n");
            lFTPConnection = FTPReply.isPositiveCompletion(client.getReplyCode());
            vsMsg = "FTPDownloadFile Completed:Connection => " + (lFTPConnection ? "OK" : "NG")+".";
            System.out.println(vsMsg);
            PutMessage(vsMsg+"\n");
        } catch (NumberFormatException e) {
            e.printStackTrace();
            System.out.println("NumberFormatException:FTPDownloadFile.");
            PutMessage("NumberFormatException:FTPDownloadFile.\n");
            PutMessage("FTPポートの値が数値ではありません。\n");
        } catch (SocketException e) {
            e.printStackTrace();
            System.out.println("SocketException:FTPDownloadFile.");
            PutMessage("SocketException:FTPDownloadFile.\n");
            PutMessage("Socket通信に失敗しました。\n");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            System.out.println("FileNotFoundException:FTPDownloadFile.");
            PutMessage("FileNotFoundException:FTPDownloadFile.\n");
            PutMessage("ファイルが見つかりません。\n");
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("IOException:FTPDownloadFile.");
            PutMessage("IOException:FTPDownloadFile.\n");
        }
    }

    public void FTPUploadTransfer( ){
        if( client==null || ! client.isConnected( ) ){
            PutMessage("Login されていません。\n");
            return;
        }
        String vsSaveBuf_HostFolder, vsSaveBuf_LocalFolder;
        String vsHostPath, vsLocalPath;
        vsSaveBuf_HostFolder = oMainPanelImp.ctfHostFolder.getText( );
        vsSaveBuf_LocalFolder = oMainPanelImp.ctfLocalFolder.getText( );
        int iListSize = ((DefaultListModel)oMainPanelImp.cltHostTransferList.getModel( )).getSize( );
        for(int i = 0; i<iListSize; i++){
            oMainPanelImp.ctfHostFolder.setText( (String)
                ((DefaultListModel)oMainPanelImp.cltHostTransferList.getModel( )).getElementAt(i));
            oMainPanelImp.ctfLocalFolder.setText( (String)
                ((DefaultListModel)oMainPanelImp.cltLocalTransferList.getModel( )).getElementAt(i));
            FTPUpload( );
        }
        oMainPanelImp.ctfHostFolder.setText(vsSaveBuf_HostFolder);
        oMainPanelImp.ctfLocalFolder.setText(vsSaveBuf_LocalFolder);
        System.out.println("FTPUploadTransfer Completed.");
    }

    public void FTPUpload( ){
        if( client==null || ! client.isConnected( ) ){
            PutMessage("Login されていません。\n");
            return;
        }
        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("^"+fvsPathListTag_File);
                matcher = pattern.matcher(vsTargetFile);
                vsTargetFile = matcher.replaceAll("");

                pattern = Pattern.compile("^"+fvsPathListTag_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();
            System.out.println("IOException:FTPUpload.");
            PutMessage("IOException:FTPUpload.\n");
            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.");
            PutMessage("FTPUpload Completed.\n");
            try {
                client.changeWorkingDirectory(vsHostCurrent);
            } catch (NumberFormatException e) {
                e.printStackTrace();
                System.out.println("NumberFormatException:FTPUpload.");
                PutMessage("NumberFormatException:FTPUpload.\n");
                PutMessage("FTPポートの値が数値ではありません。\n");
            } catch (SocketException e) {
                e.printStackTrace();
                System.out.println("SocketException:FTPUpload.");
                PutMessage("SocketException:FTPUpload.\n");
                PutMessage("Socket通信に失敗しました。\n");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
                System.out.println("FileNotFoundException:FTPUpload.");
                PutMessage("FileNotFoundException:FTPUpload.\n");
                PutMessage("ファイルが見つかりません。\n");
            } catch (IOException e) {
                e.printStackTrace();
                System.out.println("IOException:FTPUpload.");
                PutMessage("IOException:FTPUpload.\n");
            }
        }

        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();
                            System.out.println("IOException:FTPUploadFolder");
                            PutMessage("IOException:FTPUploadFolder.\n");
                        }

                        FTPUploadFolder( "", vsHostPath, vsLocalPath );
                        client.changeWorkingDirectory(vsHostCurrent);
                    }
                }
            } catch (NumberFormatException e) {
                e.printStackTrace();
                System.out.println("NumberFormatException:FTPUploadFolder.");
                PutMessage("NumberFormatException:FTPUploadFolder.\n");
                PutMessage("FTPポートの値が数値ではありません。\n");
            } catch (SocketException e) {
                e.printStackTrace();
                System.out.println("SocketException:FTPUploadFolder.");
                PutMessage("SocketException:FTPUploadFolder.\n");
                PutMessage("Socket通信に失敗しました。\n");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
                System.out.println("FileNotFoundException:FTPUploadFolder.");
                PutMessage("FileNotFoundException:FTPUploadFolder.\n");
                PutMessage("ファイルが見つかりません。\n");
            } catch (IOException e) {
                e.printStackTrace();
                System.out.println("IOException:FTPUploadFolder.");
                PutMessage("IOException:FTPUploadFolder.\n");
            }
        }
    }

    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();
            PutMessage("FTPUploadFile: "+
                "vsHostPath="+vsHostPath+"; "+
                "vsLocalPath="+vsLocalPath+"; "+
                "\n");
            lFTPConnection = FTPReply.isPositiveCompletion(client.getReplyCode());
            vsMsg = "FTPUploadFile Completed:Connection = " + (lFTPConnection ? "OK" : "NG")+".";
            System.out.println(vsMsg);
            PutMessage(vsMsg+"\n");
        } catch (NumberFormatException e) {
            e.printStackTrace();
            System.out.println("NumberFormatException:FTPUploadFile.");
            PutMessage("NumberFormatException:FTPUploadFile.\n");
            PutMessage("FTPポートの値が数値ではありません。\n");
        } catch (SocketException e) {
            e.printStackTrace();
            System.out.println("SocketException:FTPUploadFile.");
            PutMessage("SocketException:FTPUploadFile.\n");
            PutMessage("Socket通信に失敗しました。\n");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            System.out.println("FileNotFoundException:FTPUploadFile.");
            PutMessage("FileNotFoundException:FTPUploadFile.\n");
            PutMessage("ファイルが見つかりません。\n");
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("IOException:FTPUploadFile.");
            PutMessage("IOException:FTPUploadFile.\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)oMainPanelImp.ctpFileListTabs.getSelectedComponent( );
            System.out.println("oTabsSelectedComponent = "+oTabsSelectedComponent);
            System.out.println("oTabsSelectedComponent.getViewport() = "+oTabsSelectedComponent.getViewport());
            System.out.println("cltLocalFileList.getParent() = "+oMainPanelImp.cltLocalFileList.getParent());
            System.out.println("cltLocalFileList.getParent().getParent() = "+oMainPanelImp.cltLocalFileList.getParent().getParent());
            // JScrollPane には暗黙の子 JViewport が存在し、
            // 「JScrollPane.getViewport( ) 」で(暗黙の子) JViewport のインスタンスを取得できる。
            // つまり、この場合の JList の親は JViewport となる。
            // ちなみに、この場合の JList の親の親が JScrollPane となる。
            if( lFTPConnection &&
                oTabsSelectedComponent.getViewport()==oMainPanelImp.cltHostFileList.getParent( ) ){
                //
            }
            if( oTabsSelectedComponent.getViewport()==oMainPanelImp.cltLocalFileList.getParent( ) ){
                //
            }

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

            if( 0==((DefaultListModel)oMainPanelImp.cltHostTransferList.getModel( )).getSize( ) ){
                FTPDownload( );
            }else{
                FTPDownloadTransfer( );
            }
        }
        @Override
        void FTPUpload_CbtMouseMouseReleased(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:FTPUpload_CbtMouseMouseReleased.");

            if( 0==((DefaultListModel)oMainPanelImp.cltHostTransferList.getModel( )).getSize( ) ){
                FTPUpload( );
            }else{
                FTPUploadTransfer( );
            }
        }
        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_PathListTag_Folder+")");

                 matcher = pattern.matcher(vsTargetFile);
                 if(matcher.find()){
                     vsTargetFile = matcher.replaceAll("");
                     System.out.println("vsTargetFile = "+vsTargetFile+"; ");
                     HostFileList(vsTargetFile);
                 }
             }else{
                 vsTargetFile = null;
                 PutMessage("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_PathListTag_Folder+")");

                 matcher = pattern.matcher(vsTargetFile);
                 if(matcher.find()){
                     vsTargetFile = matcher.replaceAll("");
                     System.out.println("vsTargetFile = "+vsTargetFile+"; ");
                     LocalFileList(vsTargetFile);
                 }
             }else{
                 vsTargetFile = null;
                 PutMessage("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("");
        }
        @Override
        void FTPBreak_CbtMouseMouseReleased(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:FTPBreak_CbtMouseMouseReleased.");

            lFTPBreak = true; // false; //
        }
        @Override
        void TransferListEntry_CbtMouseMouseReleased(MouseEvent event) {
            System.out.println("MainPanelImplementationObj:MouseEvent:TransferListEntry_CbtMouseMouseReleased.");

            ((DefaultListModel)oMainPanelImp.cltHostTransferList.getModel( )).addElement(
                ctfHostFolder.getText( ));
            ((DefaultListModel)oMainPanelImp.cltLocalTransferList.getModel( )).addElement(
                ctfLocalFolder.getText( ));

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

            int iSelectedIndex = -1;
            JScrollPane oTabsSelectedComponent = (JScrollPane)oMainPanelImp.ctpTransferListTabs.getSelectedComponent( );
            // JScrollPane には暗黙の子 JViewport が存在し、
            // 「JScrollPane.getViewport( ) 」で(暗黙の子) JViewport のインスタンスを取得できる。
            // つまり、この場合の JList の親は JViewport となる。
            // ちなみに、この場合の JList の親の親が JScrollPane となる。
            if( oTabsSelectedComponent.getViewport( )==oMainPanelImp.cltHostTransferList.getParent( ) ){
                System.out.println("if(oTabsSelectedComponent.getViewport( )==cltHostTransferList.getParent( )).");
                if( oMainPanelImp.cltHostTransferList.isSelectionEmpty( ) ){
                    PutMessage("cltHostTransferList:表示されているタブに選択されている項目がありません。\n");
                }else{
                    iSelectedIndex = oMainPanelImp.cltHostTransferList.getSelectedIndex( );
                }
            }
            if( oTabsSelectedComponent.getViewport( )==oMainPanelImp.cltLocalTransferList.getParent( ) ){
                System.out.println("(oTabsSelectedComponent.getViewport( )==cltLocalTransferList.getParent( )).");
                if( oMainPanelImp.cltLocalTransferList.isSelectionEmpty( ) ){
                    PutMessage("cltLocalTransferList:表示されているタブに選択されている項目がありません。\n");
                }else{
                    iSelectedIndex = oMainPanelImp.cltLocalTransferList.getSelectedIndex( );
                }
            }
            System.out.println("iSelectedIndex="+iSelectedIndex+"; ");
            if( 0<=iSelectedIndex ){
                System.out.println("if( 0<=iSelectedIndex )");
                ((DefaultListModel)oMainPanelImp.cltHostTransferList.getModel( )).remove(iSelectedIndex);
                ((DefaultListModel)oMainPanelImp.cltLocalTransferList.getModel( )).remove(iSelectedIndex);
            }
        }

    }

    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>: [00000973]  <Date>: 2015/12/26 10:18:56
<Title>: Java2 FTP Connect 9『MainPanelDesign.java』
<Name>: amanojaku@管理人



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;
    private JButton cbtTransferListDelete;
    private JButton cbtTransferListEntry;
    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;
    JPanel cpnFTPSetting;
    JTabbedPane ctpBaseTabs;
    JList cltHostTransferList;
    JList cltLocalTransferList;
    JTabbedPane ctpTransferListTabs;
    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;
    private JScrollPane jScrollPane3;
    private JScrollPane jScrollPane4;
    private JLabel jLabel3;

    public MainPanelDesign() {
        initComponents();
    }

    private void initComponents() {
        setMinimumSize(new Dimension(479, 400));
        setPreferredSize(new Dimension(479, 400));
        setLayout(new GroupLayout());
        add(getCbtHostLogin(), new Constraints(new Leading(10, 72, 75, 282), new Leading(254, 12, 12)));
        add(getCbtHostLogout(), new Constraints(new Leading(90, 10, 10), new Leading(254, 12, 12)));
        add(getJLabel7(), new Constraints(new Leading(289, 12, 12), new Leading(195, 12, 12)));
        add(getCtpFileListTabs(), new Constraints(new Leading(289, 266, 10, 10), new Bilateral(217, 12, 69)));
        add(getCbtFTPDownload(), new Constraints(new Leading(10, 12, 12), new Leading(292, 12, 12)));
        add(getCbtFTPBreak(), new Constraints(new Leading(191, 10, 10), new Leading(292, 12, 12)));
        add(getCbtFTPUpload(), new Constraints(new Leading(109, 10, 10), new Leading(292, 12, 12)));
        add(getCcbFTPFileDataType(), new Constraints(new Leading(135, 12, 12), new Leading(330, 12, 12)));
        add(getCtpBaseTabs(), new Constraints(new Leading(8, 271, 23, 23), new Leading(7, 237, 10, 10)));
        add(getCbtTransferListDelete(), new Constraints(new Leading(443, 10, 10), new Leading(10, 10, 10)));
        add(getCbtTransferListEntry(), new Constraints(new Leading(373, 12, 12), new Leading(10, 87, 177)));
        add(getJLabel3(), new Constraints(new Leading(289, 12, 12), new Leading(15, 87, 177)));
        add(getCtpTransferListTabs(), new Constraints(new Bilateral(289, 12, 57), new Leading(46, 139, 10, 10)));
        add(getJLabel9(), new Constraints(new Leading(10, 12, 12), new Leading(333, 18, 12, 12)));
        add(getCbtSetupFileList_HostFolder(), new Constraints(new Leading(8, 12, 12), new Leading(367, 12, 12)));
        add(getCtfHostFolder(), new Constraints(new Leading(135, 144, 12, 12), new Leading(370, 12, 12)));
        add(getCtfLocalFolder(), new Constraints(new Leading(135, 144, 12, 12), new Leading(408, 12, 12)));
        add(getCbtSetupFileList_LocalFolder(), new Constraints(new Leading(8, 12, 12), new Leading(405, 12, 12)));
        setSize(565, 487);
    }

    private JLabel getJLabel3() {
        if (jLabel3 == null) {
            jLabel3 = new JLabel();
            jLabel3.setText("TransferList");
        }
        return jLabel3;
    }

    private JScrollPane getJScrollPane4() {
        if (jScrollPane4 == null) {
            jScrollPane4 = new JScrollPane();
            jScrollPane4.setViewportView(getCltLocalTransferList());
        }
        return jScrollPane4;
    }

    private JList getCltLocalTransferList() {
        if (cltLocalTransferList == null) {
            cltLocalTransferList = new JList();
            DefaultListModel listModel = new DefaultListModel();
            cltLocalTransferList.setModel(listModel);
        }
        return cltLocalTransferList;
    }

    private JScrollPane getJScrollPane3() {
        if (jScrollPane3 == null) {
            jScrollPane3 = new JScrollPane();
            jScrollPane3.setViewportView(getCltHostTransferList());
        }
        return jScrollPane3;
    }

    private JList getCltHostTransferList() {
        if (cltHostTransferList == null) {
            cltHostTransferList = new JList();
            DefaultListModel listModel = new DefaultListModel();
            cltHostTransferList.setModel(listModel);
        }
        return cltHostTransferList;
    }

    private JButton getCbtTransferListEntry() {
        if (cbtTransferListEntry == null) {
            cbtTransferListEntry = new JButton();
            cbtTransferListEntry.setText("Entry");
            cbtTransferListEntry.addMouseListener(new MouseAdapter() {

                public void mouseReleased(MouseEvent event) {
                    TransferListEntry_CbtMouseMouseReleased(event);
                }
            });
        }
        return cbtTransferListEntry;
    }

    private JButton getCbtTransferListDelete() {
        if (cbtTransferListDelete == null) {
            cbtTransferListDelete = new JButton();
            cbtTransferListDelete.setText("Delete");
            cbtTransferListDelete.addMouseListener(new MouseAdapter() {

                public void mouseReleased(MouseEvent event) {
                    TransferListDelete_CbtMouseMouseReleased(event);
                }
            });
        }
        return cbtTransferListDelete;
    }

    private JTabbedPane getCtpTransferListTabs() {
        if (ctpTransferListTabs == null) {
            ctpTransferListTabs = new JTabbedPane();
            ctpTransferListTabs.addTab("Host", getJScrollPane3());
            ctpTransferListTabs.addTab("Local", getJScrollPane4());
        }
        return ctpTransferListTabs;
    }

    private JTabbedPane getCtpBaseTabs() {
        if (ctpBaseTabs == null) {
            ctpBaseTabs = new JTabbedPane();
            ctpBaseTabs.addTab("FTP", getCpnFTPSetting());
            ctpBaseTabs.addTab("Message", getJScrollPane0());
        }
        return ctpBaseTabs;
    }

    private JPanel getCpnFTPSetting() {
        if (cpnFTPSetting == null) {
            cpnFTPSetting = new JPanel();
            cpnFTPSetting.setLayout(new GroupLayout());
            cpnFTPSetting.add(getJLabel1(), new Constraints(new Leading(7, 12, 12), new Leading(42, 134, 134)));
            cpnFTPSetting.add(getJLabel2(), new Constraints(new Leading(7, 12, 12), new Leading(176, 12, 12)));
            cpnFTPSetting.add(getJLabel6(), new Constraints(new Leading(7, 12, 12), new Leading(140, 12, 12)));
            cpnFTPSetting.add(getJLabel5(), new Constraints(new Leading(7, 12, 12), new Leading(74, 12, 12)));
            cpnFTPSetting.add(getCckHostPASVMode(), new Constraints(new Leading(7, 12, 12), new Leading(8, 12, 12)));
            cpnFTPSetting.add(getCtfHostName(), new Constraints(new Leading(96, 142, 10, 10), new Leading(72, 12, 12)));
            cpnFTPSetting.add(getCpfHostPassword(), new Constraints(new Leading(97, 140, 12, 12), new Leading(172, 12, 12)));
            cpnFTPSetting.add(getCcbHostEncode(), new Constraints(new Leading(97, 12, 12), new Leading(38, 12, 12)));
            cpnFTPSetting.add(getCtfHostPortNum(), new Constraints(new Leading(96, 142, 12, 12), new Leading(104, 12, 12)));
            cpnFTPSetting.add(getJLabel0(), new Constraints(new Leading(7, 12, 12), new Leading(106, 12, 12)));
            cpnFTPSetting.add(getCtfHostUserName(), new Constraints(new Leading(97, 142, 12, 12), new Leading(138, 12, 12)));
        }
        return cpnFTPSetting;
    }

    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) {
    }
    void TransferListEntry_CbtMouseMouseReleased(MouseEvent event) {
    }
    void TransferListDelete_CbtMouseMouseReleased(MouseEvent event) {
    }

}


<Number>: [00000974]  <Date>: 2015/12/31 17:58:01
<Title>: Java2 FTP Connect 9 実行可能 JAR
<Name>: amanojaku@管理人



「Java2 FTP Connect 9」の実行可能 JAR ファイルをアップします。
「FTPConnect9.cab」を適当なフォルダーに解凍すると、「FTPConnect.jar、FTPConnect.bat」が解凍されます。
(まず Java がインストールされていないと実行できません)「FTPConnect.jar、FTPConnect.bat」は同一のフォルダーでなければ実行できません。
「FTPConnect.bat」を(ダブル・クリックして)実行して下さい(「FTPConnect.jar」だと実行できない場合があります)。
ディスクトップに(実行用のショートカット)アイコンを置きたい場合は、「FTPConnect.bat」のショートカットを自分でディスクトップにコピペして下さい(ショートカットの作成のしかたは Web で検索して下さい)。

《参考》
『Java2 FTP Connect 9』
http://artemis.rosx.net/sjis/smt.cgi?r+izanami/&bid+00000918&tsn+00000972-00000973&

実行可能 JAR 作成に関しては下記ページを参照.

実行可能JARの作り方と実行の仕方 | システム開発ブログ
http://www.ilovex.co.jp/blog/system/projectandsystemdevelopment/jar.html

Click to Download. 00000974.1.cab:(Size=311,135Byte) Name = FTPConnect9.cab

Block( Address 000009B0 Identity 00000918 )










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

   
   

管理者用 Password:

  




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


- Rental Orbit Space -