2005/02/21
Hi I'm aki
There are my OpenSource Java codes.(some of them are junk or not implemented)
I'm sorry ,I didn't release internatinal version software yet. one day I'd like to introduce them here.
Thank you for Java2Html. it's very easy and suitable for me.
If you can read Japanese,you can see my software here. Enjoy Java
org.jpn.xucker.audiotowma9
org.jpn.xucker.audiotowma9.AudioToWma9Executer
org.jpn.xucker.audiotowma9.AudioToWma9Wrapper
org.jpn.xucker.commons.audio
org.jpn.xucker.commons.audio.AudioClipAudioPlayer
org.jpn.xucker.commons.audio.AudioStopper
org.jpn.xucker.commons.audio.FileAudioPlayer
org.jpn.xucker.commons.audio.InputStreamAudioPlayer
org.jpn.xucker.commons.audio.JavaSoundAudioPlayer
org.jpn.xucker.commons.audio.ThreadJavaSoundAudioPlayer
org.jpn.xucker.commons.audio.TimerAudioStopper
org.jpn.xucker.commons.audio.word
org.jpn.xucker.commons.audio.word.AbstractWordPlayer
org.jpn.xucker.commons.audio.word.FreeTTSWordPlayer
org.jpn.xucker.commons.audio.word.LocalFileAlphabetDirWordFinder
org.jpn.xucker.commons.audio.word.LocalFilePlainWordFinder
org.jpn.xucker.commons.audio.word.LocalFilePlainWordPlayer
org.jpn.xucker.commons.audio.word.LocalFileWordFinder
org.jpn.xucker.commons.audio.word.LocalFileWordPlayer
org.jpn.xucker.commons.audio.word.MutchWordPlaySystem
org.jpn.xucker.commons.audio.word.WordPlayer
org.jpn.xucker.commons.audio.word.WordPlaySystem
org.jpn.xucker.commons.audio.word.ZipFileWordPlayer
org.jpn.xucker.commons.google
org.jpn.xucker.commons.google.Channel
org.jpn.xucker.commons.google.GoogleAdSenseChannelParser
org.jpn.xucker.commons.io
org.jpn.xucker.commons.io.LineSeparatorChangeInputStream
org.jpn.xucker.commons.io.LineSeparatorCountInputStream
org.jpn.xucker.commons.io.WordCountInputStream
org.jpn.xucker.commons.ipod
org.jpn.xucker.commons.ipod.DoubleLineTextPopper
org.jpn.xucker.commons.ipod.MenuMaker
org.jpn.xucker.commons.ipod.PrevNextMenu
org.jpn.xucker.commons.ipod.SrtConverter
org.jpn.xucker.commons.ipod.TextConverter
org.jpn.xucker.commons.ipod.TextConvertTest
org.jpn.xucker.commons.ipod.TextPopper
org.jpn.xucker.commons.ipod.TextUtil
org.jpn.xucker.commons.property
org.jpn.xucker.commons.property.StatusChangeListener
org.jpn.xucker.commons.property.StatusChangeMonitor
org.jpn.xucker.commons.swt.series
org.jpn.xucker.commons.swt.series.FileListTypeMenu
org.jpn.xucker.commons.swt.series.PropertyMenuListener
org.jpn.xucker.commons.swt.series.ResultData
org.jpn.xucker.commons.swt.series.ResultDialog
org.jpn.xucker.commons.swt.series.fls
org.jpn.xucker.commons.swt.series.fls.FileListStandard
org.jpn.xucker.commons.swt.series.fls.Sample
org.jpn.xucker.commons.swt.series.wfs
org.jpn.xucker.commons.swt.series.wfs.WrapperExecuter
org.jpn.xucker.commons.swt.series.wfs.WrapperFileStandard
org.jpn.xucker.commons.swt.series.wfs.WrapperFileStandardSettingDialog
org.jpn.xucker.commons.swt.ui
org.jpn.xucker.commons.swt.ui.CopyTable
org.jpn.xucker.commons.swt.ui.FileDirChoicer
org.jpn.xucker.commons.swt.ui.FileListImage
org.jpn.xucker.commons.swt.ui.FileListImageStatusChangeListener
org.jpn.xucker.commons.swt.ui.FileListTable
org.jpn.xucker.commons.swt.ui.FileStatusChangeEvent
org.jpn.xucker.commons.swt.ui.FileStatusChangeListener
org.jpn.xucker.commons.swt.ui.FileStatusChanger
org.jpn.xucker.commons.swt.ui.GroupCheckTreeContoler
org.jpn.xucker.commons.swt.ui.ImageCanvas
org.jpn.xucker.commons.swt.ui.MenuItemContainer
org.jpn.xucker.commons.swt.ui.MenuItemContainerImp
org.jpn.xucker.commons.swt.ui.OkCancelDialog
org.jpn.xucker.commons.swt.ui.OkCancelDialogListener
org.jpn.xucker.commons.swt.ui.SWTBasicFileApplication
org.jpn.xucker.commons.swt.ui.SWTFileNoFoundtAction
org.jpn.xucker.commons.swt.ui.SWTStatusChangedMonitor
org.jpn.xucker.commons.swt.ui.tree
org.jpn.xucker.commons.swt.ui.tree.TreeBuilder
org.jpn.xucker.commons.swt.ui.tree.TreeObject
org.jpn.xucker.commons.undo
org.jpn.xucker.commons.undo.AbstractCommand
org.jpn.xucker.commons.undo.Addable
org.jpn.xucker.commons.undo.AddCommand
org.jpn.xucker.commons.undo.Command
org.jpn.xucker.commons.undo.CommandControl
org.jpn.xucker.commons.undo.Deletable
org.jpn.xucker.commons.undo.DeleteCommand
org.jpn.xucker.commons.undo.UndoCommand
org.jpn.xucker.commons.util
org.jpn.xucker.commons.util.AbstractBasicFileApplication
org.jpn.xucker.commons.util.ApplicationProperties
org.jpn.xucker.commons.util.ApplicationUtil
org.jpn.xucker.commons.util.ClipboardUtil
org.jpn.xucker.commons.util.FileNotFoundAction
org.jpn.xucker.commons.util.FileProperties
org.jpn.xucker.commons.util.IOClassLoader
org.jpn.xucker.commons.util.TagUtil
org.jpn.xucker.commons.util.WildCard
org.jpn.xucker.commons.util._FilePreference
org.jpn.xucker.dualsubmit
org.jpn.xucker.dualsubmit.ClipboardTextListener
org.jpn.xucker.dualsubmit.ClipboardTextMonitor
org.jpn.xucker.dualsubmit.ClipboardTextMonitorImp
org.jpn.xucker.dualsubmit.DefaultApplication
org.jpn.xucker.dualsubmit.DualSubmit
org.jpn.xucker.dualsubmit.DualSubmitBrowser
org.jpn.xucker.dualsubmit.DualSubmitBrowserImp
org.jpn.xucker.dualsubmit.DualSubmitMenu
org.jpn.xucker.dualsubmit.DualSubmitMenuImp
org.jpn.xucker.dualsubmit.DualSubmitPlugin
org.jpn.xucker.dualsubmit.DualSubmitPluginImp
org.jpn.xucker.dualsubmit.DualSubmitPluginLoader
org.jpn.xucker.dualsubmit.DualSubmitPluginLoaderImp
org.jpn.xucker.dualsubmit.DualSubmitPreference
org.jpn.xucker.dualsubmit.LoopControler
org.jpn.xucker.dualsubmit.SimpleWindowCloser
org.jpn.xucker.dualsubmit.StringValidator
org.jpn.xucker.dualsubmit.validator
org.jpn.xucker.dualsubmit.validator.AlphabetAndHyphenValidator
org.jpn.xucker.dualsubmit.validator.AlphabetValidator
org.jpn.xucker.dualsubmit.validator.AndValidator
org.jpn.xucker.dualsubmit.validator.NoLineSeparatorValidator
org.jpn.xucker.dualsubmit.validator.NotValidator
org.jpn.xucker.dualsubmit.validator.NoWhiteSpaceValidator
org.jpn.xucker.dualsubmit.validator.OrValidator
org.jpn.xucker.english
org.jpn.xucker.english.Util
org.jpn.xucker.findsame
org.jpn.xucker.findsame.CompositeList
org.jpn.xucker.findsame.CompositeListItem
org.jpn.xucker.findsame.CompositePixelList
org.jpn.xucker.findsame.Error
org.jpn.xucker.findsame.FileUtil
org.jpn.xucker.findsame.FindSameEachOtherMain
org.jpn.xucker.findsame.FindSameFileMain
org.jpn.xucker.findsame.FindSameFolderMain
org.jpn.xucker.findsame.MD5Util
org.jpn.xucker.findsame.Result
org.jpn.xucker.findsame.ResultList
org.jpn.xucker.freemind
org.jpn.xucker.freemind.FreeMindUtils
org.jpn.xucker.freemind.Map
org.jpn.xucker.freemind.Node
org.jpn.xucker.imagemarker
org.jpn.xucker.imagemarker.GUIProperties
org.jpn.xucker.imagemarker.ImageMarker
org.jpn.xucker.linkcheck
org.jpn.xucker.linkcheck.LinkChecker
org.jpn.xucker.mp3
org.jpn.xucker.mp3.MP3JavaSoundAudioPlayer
org.jpn.xucker.optipngwrapper
org.jpn.xucker.optipngwrapper.OptiPNGExecuter
org.jpn.xucker.optipngwrapper.OptiPngWrap
org.jpn.xucker.optipngwrapper.ResultData
org.jpn.xucker.optipngwrapper.ResultDialog
org.jpn.xucker.phonixSplit
org.jpn.xucker.phonixSplit.PhonixSplit
org.jpn.xucker.phonixSplit.PhonixSplitCanvas
org.jpn.xucker.phonixSplit.QuestionControl
org.jpn.xucker.phonixSplit.QuestionFolder
org.jpn.xucker.playdict
org.jpn.xucker.playdict.DictPreference
org.jpn.xucker.playdict.PlayDictMain
org.jpn.xucker.playdict.SoundWord
org.jpn.xucker.repeatrecorder
org.jpn.xucker.repeatrecorder.ControledObject
org.jpn.xucker.repeatrecorder.RepeatRecorder
org.jpn.xucker.repeatrecorder.RepeatRecorderMenu
org.jpn.xucker.returncode
org.jpn.xucker.returncode.ReturnCodeChecker
org.jpn.xucker.returncode.ReturnCodeMain
org.jpn.xucker.rssCreator
org.jpn.xucker.rssCreator.main
org.jpn.xucker.snacksoundtoolkit
org.jpn.xucker.snacksoundtoolkit.ESPS
org.jpn.xucker.snacksoundtoolkit.ESPSParser
org.jpn.xucker.snacksoundtoolkit.PitchCanvas
org.jpn.xucker.srtipod
org.jpn.xucker.srtipod.main
org.jpn.xucker.srtipod.SrtIPodMain
org.jpn.xucker.subconverter
org.jpn.xucker.subconverter.SubConverter
org.jpn.xucker.subplayer
org.jpn.xucker.subplayer.ImageCanvas
org.jpn.xucker.subplayer.Mark
org.jpn.xucker.subplayer.MarkControler
org.jpn.xucker.subplayer.SubMainMenu
org.jpn.xucker.subplayer.SubPlayFileUpdater
org.jpn.xucker.subplayer.SubPlayFileXmlDialog
org.jpn.xucker.subplayer.SubPlayFileXmlObject
org.jpn.xucker.subplayer.SubPlayMain
org.jpn.xucker.subplayer.SubPlayPreferenceXmlObject
org.jpn.xucker.subtitle
org.jpn.xucker.subtitle.StandardSubObject
org.jpn.xucker.subtitle.SubUtils
org.jpn.xucker.subtitle.spumux
org.jpn.xucker.subtitle.spumux.Action
org.jpn.xucker.subtitle.spumux.Button
org.jpn.xucker.subtitle.spumux.Spu
org.jpn.xucker.subtitle.spumux.Spumux
org.jpn.xucker.subtitle.spumux.SpumuxParser
org.jpn.xucker.subtitle.spumux.Textsub
org.jpn.xucker.subtitle.srt
org.jpn.xucker.subtitle.srt.SRTList
org.jpn.xucker.subtitle.srt.SRTObject
org.jpn.xucker.subtitle.srt.SRTParser
org.jpn.xucker.subtitle.srt.TimeData
org.jpn.xucker.subtitle.sub
org.jpn.xucker.subtitle.sub.SUBList
org.jpn.xucker.subtitle.sub.SUBObject
org.jpn.xucker.subtitle.sub.SUBParser
org.jpn.xucker.subtitle.sub.TextObject
org.jpn.xucker.subtitle.sub2
org.jpn.xucker.subtitle.sub2.CommentObject
org.jpn.xucker.subtitle.sub2.SUBObject
org.jpn.xucker.subtitle.sub2.SUBParser
org.jpn.xucker.tab2tree
org.jpn.xucker.tab2tree.Main
org.jpn.xucker.tab2tree.StringTreeUtils
org.jpn.xucker.taiyaku
org.jpn.xucker.taiyaku.TaiyakuData
org.jpn.xucker.taiyaku.TaiyakuParser
org.jpn.xucker.treetext
org.jpn.xucker.treetext.main
org.jpn.xucker.treetext.TreeText
org.jpn.xucker.wavconvert
org.jpn.xucker.wavconvert.AudioFormat
org.jpn.xucker.wavconvert.SoxExecuter
org.jpn.xucker.wavconvert.SoxWrapper
org.jpn.xucker.wmatopcm
org.jpn.xucker.wmatopcm.WmaToPcmExecuter
org.jpn.xucker.wmatopcm.WmaToPcmWrapper
org.jpn.xucker.wordcounter
org.jpn.xucker.wordcounter.WordCountData
org.jpn.xucker.wordcounter.WordCountMain
org.jpn.xucker.wordcounter.WordCountMenu
org.jpn.xucker.xs.aegis
org.jpn.xucker.xs.aegis.Action
org.jpn.xucker.xs.aegis.Block
org.jpn.xucker.xs.aegis.Domain
org.jpn.xucker.xs.aegis.Query
org.jpn.xucker.xs.aegis.QueryList

OptiPngWrap.java
package org.jpn.xucker.optipngwrapper;/*
                 * Created on 2004/06/27
                 
                 * Author aki@www.xucker.jpn.org License Apache2.0 or Common
                 * Public License
                 */

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.net.URLDecoder;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTarget;
import org.eclipse.swt.dnd.DropTargetAdapter;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.RowData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
import org.jpn.xucker.commons.swt.ui.FileStatusChangeEvent;
import org.jpn.xucker.commons.swt.ui.FileStatusChangeListener;
import org.jpn.xucker.commons.swt.ui.FileListTable;


public class OptiPngWrap implements SelectionListener ,FileStatusChangeListener,Runnable{
    /**
     @param shell
     */
    private Group group1;

    private Button sameoutput;

    private Text outputLabel;

    private Button outputButton;

    private Group group2;

    private Button dobackup;

    private Button optimizeButton;

    private Group group3;

    private Table table1;

    private Group group4;

    private CCombo level;

    private Text optiPngLabel;

    private Button optiPngButton;

    private FileListTable listTable;

    private Shell shell;

    private Image logoImage;
    
    private double version=0.4;

    public OptiPngWrap(Shell shell) {
        this.shell = shell;
        shell.setText("OptiPngWrapper(PNG最適化) v"+version);
        shell.setBounds(00500400);
        RowLayout layout = new RowLayout();
        shell.setLayout(layout);
        group1 = new Group(shell, SWT.NULL);
        group1.setText("出力");
        RowData group1_data = new RowData();
        group1_data.width = 480;
        group1.setLayoutData(group1_data);
        RowLayout group1_layout = new RowLayout();
        group1.setLayout(group1_layout);

        sameoutput = new Button(group1, SWT.NULL | SWT.CHECK);
        sameoutput.setText("入力を上書き");
        sameoutput.addSelectionListener(this);
        RowData sameoutput_data = new RowData();
        sameoutput.setLayoutData(sameoutput_data);

        outputLabel = new Text(group1, SWT.READ_ONLY);
        outputLabel.setText("");
        outputLabel
                .setBackground(new Color(Display.getCurrent()255255255));
        RowData outputLabel_data = new RowData();
        outputLabel_data.width = 200;
        outputLabel.setLayoutData(outputLabel_data);

        Transfer[] types = new Transfer[] { FileTransfer.getInstance() };

        int operations = DND.DROP_MOVE | DND.DROP_COPY;

        DropTarget target2 = new DropTarget(outputLabel, operations);
        target2.setTransfer(types);

        target2.addDropListener(new DropMonitor());

        //出力先フォルダー
        outputButton = new Button(group1, SWT.NULL);
        outputButton.setText("出力先フォルダー");
        outputButton.addSelectionListener(this);
        RowData outputButton_data = new RowData();
        outputButton.setLayoutData(outputButton_data);

        group2 = new Group(shell, SWT.NULL);
        group2.setText("オプション");
        RowData group2_data = new RowData();
        group2_data.width = 480;
        group2.setLayoutData(group2_data);
        RowLayout group2_layout = new RowLayout();
        group2.setLayout(group2_layout);

        dobackup = new Button(group2, SWT.NULL | SWT.CHECK);
        dobackup.setText("最適化前にバックアップを取る");
        dobackup.setSelection(true);
        dobackup.addSelectionListener(this);
        RowData dobackup_data = new RowData();
        dobackup.setLayoutData(dobackup_data);

        group3 = new Group(shell, SWT.NULL);
        group3.setText("入力");
        RowData group3_data = new RowData();
        group3_data.width = 480;
        group3.setLayoutData(group3_data);
        RowLayout group3_layout = new RowLayout();
        group3.setLayout(group3_layout);

        listTable = new FileListTable(group3, SWT.NULL);
        listTable.addFileListChangeListener(this);
        String png[]={"png"};
        listTable.setFileExtension(png);
        table1 = listTable.getTable();
        table1.setLinesVisible(true);

        RowData table1_data = new RowData();
        table1_data.width = 455;
        table1_data.height = 130;
        table1.setLayoutData(table1_data);
        TableColumn table1_column = new TableColumn(table1, SWT.NULL);
        table1_column.setWidth(470);

        //最適化
        optimizeButton = new Button(shell, SWT.NULL);
        optimizeButton.setText("最適化");
        optimizeButton.setEnabled(false);
        optimizeButton.addSelectionListener(this);
        shell.setBackground(new Color(Display.getCurrent()255255255));
        RowData optimizeButton_data = new RowData();
        optimizeButton_data.width = 100;
        optimizeButton_data.height = 50;

        optimizeButton.setLayoutData(optimizeButton_data);
        logoImage = new Image(Display.getCurrent(), FileListTable.class
                .getClassLoader().getResourceAsStream(
                        "org/jpn/xucker/optipngwrapper/resource/optipng.png"));

        Label canvas = new Label(shell, SWT.NULL);
        canvas.setImage(logoImage);
        RowData canvas_data = new RowData();
        canvas_data.width = 350;
        canvas_data.height = 50;
        canvas.setLayoutData(canvas_data);

        group4 = new Group(shell, SWT.NULL);
        group4.setText("OptiPng設定");
        group4.setBackground(new Color(Display.getCurrent()60180255));

        RowData group4_data = new RowData();
        group4_data.width = 480;
        group4.setLayoutData(group4_data);
        RowLayout group4_layout = new RowLayout();
        group4.setLayout(group4_layout);

        
        Label label=new Label(group4,SWT.NULL);
        label.setText("レベル");
        level = new CCombo(group4, SWT.NULL);
        for(int i=0;i<=7;i++){
            level.add(""+i);
        }
        
        level.select(5);  //default setting is 7
        
        level.addSelectionListener(this);
        RowData level_data = new RowData();
        level.setLayoutData(level_data);

        optiPngLabel = new Text(group4, SWT.READ_ONLY);
        optiPngLabel.setText("");
        RowData optiPngLabel_data = new RowData();
        optiPngLabel_data.width = 200;
        optiPngLabel.setLayoutData(optiPngLabel_data);

        //optiPngパス
        optiPngButton = new Button(group4, SWT.NULL);
       
        optiPngButton.setText("optiPngパス");
        optiPngButton.addSelectionListener(this);
        RowData optiPngButton_data = new RowData();
        optiPngButton.setLayoutData(optiPngButton_data);

        sameoutput.setSelection(true);
        do_sameoutput();
    }

    public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell(display);

        OptiPngWrap main = new OptiPngWrap(shell);
        
        shell.open();

        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
             //   System.out.println("read");
                display.sleep();
            }
        }
        display.dispose();
    }

    public void widgetSelected(SelectionEvent event) {
        Object target = event.getSource();
        
        //入力と同じ所へ
       if (target == sameoutput) {
            do_sameoutput();
        }
        //出力先フォルダー
        else if (target == outputButton) {
            do_outputButton();
        }
        //バックアップを取る
        else if (target == dobackup) {
            do_dobackup();
        }
        //最適化
        else if (target == optimizeButton) {
            do_optimizeButton();
        }
        //null1
        else if (target == table1) {
            do_table1();
        }

        //Level
        else if (target == level) {
            System.out.println(level.getSelectionIndex());
            do_level();
        }
        //optiPngパス
        else if (target == optiPngButton) {
            do_optiPngButton();
        }

    }

    /**
     
     */
    OptiPNGExecuter executer=null;
    

    
    public void run(){
       
      
       if(executer!=null){
               try {
            
            executer.execute();
        catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
    
        
           shell.getDisplay().syncExec(new CreateResultDialog(executer.getResultData()));
           executing=false;
       }
    }
    
    Thread thread=new Thread(this);

    

    public void widgetDefaultSelected(SelectionEvent arg0) {
        // TODO Auto-generated method stub

    }

    
    //入力と同じ所へ
    private void do_sameoutput() {
        if (sameoutput.getSelection()) {
            outputButton.setEnabled(false);
            outputLabel.setEnabled(false);
        else {
            outputButton.setEnabled(true);
            outputLabel.setEnabled(true);
        }

        checkOptimizeButton();
    }

    //出力先フォルダー
    public void do_outputButton() {
        DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN);
        String file = dialog.open();
        if (file != null) {
            outputLabel.setText(file);
        }
        
        checkOptimizeButton();
    }

    //バックアップを取る
    public void do_dobackup() {
        //System.out.println("dobackup");
    }


   
       
        
            public void do_optimizeButton() {
                optimizeButton.setEnabled(false);
                executing=true;
                
                String optiPngPath=optiPngLabel.getText();
                File optiPngFile=null;
                if(!optiPngPath.equals("")){
                    optiPngFile=new File(optiPngPath);
                    if(!optiPngFile.exists()){
                        optiPngFile=null;
                    }
                }
                if(optiPngFile==null){
                    //find directPath
                    
                    optiPngFile=searchFileAroundClass("optipng.exe");
                   
                }
                
                if(optiPngFile==null){
                    //alert
                    MessageBox dialog=new MessageBox(shell,SWT.ICON_ERROR);
                    dialog.setText("エラー");
                    dialog.setMessage("optipng.exe が見つかりません");
                    dialog.open();
                }else{
                    executer=new OptiPNGExecuter();
                    executer.setOptipngPath(optiPngFile.getAbsolutePath());
                    executer.setLevel(level.getText());
                    executer.setDoBackup(dobackup.getSelection());
                    executer.setBackupExtension(".bk");
                    if(outputLabel.getText().length()>&& !sameoutput.getSelection()){
                        executer.setOutput(new File(outputLabel.getText()));
                    }
                    
                    String files[]=listTable.getFiles();
                    for(int i=0;i<files.length;i++){
                        executer.addFile(files[i]);
                    }
                    
                    
                   
                    
                    thread.start();
                    
                }
                
                
            
        
    
}
           
            
            public class wakeUpper extends Thread{
                public void run(){
                    DoWake wake=new DoWake();
                    while(executing){
                    shell.getDisplay().wake();
                    //shell.getDisplay().readAndDispatch();
                    System.out.println("waveup");
                    //shell.getDisplay().readAndDispatch();
                   shell.getDisplay().asyncExec(wake);
                    try {
                        Thread.sleep(100);
                    catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    
                    }
                }
            }
            
            public class DoWake implements Runnable{
                public void run(){
                    System.out.println("read1");
                    shell.getDisplay().readAndDispatch();
                    System.out.println("read2");
                }
            }
    
    public class CreateResultDialog implements Runnable{
        private ResultData[] data;

         CreateResultDialog(ResultData[] data){
            this.data=data;
        }
        /* (non-Javadoc)
         * @see java.lang.Runnable#run()
         */
        public void run() {
            // TODO Auto-generated method stub
            Shell childShell=new Shell(shell);
            ResultDialog dialog=new ResultDialog(childShell);
            dialog.setResultData(data);
            childShell.open();
            
            optimizeButton.setEnabled(true);
        }
        
    }
    //最適化
   

    //null1
    public void do_table1() {
        System.out.println("table1");
    }

    //null1
    public void do_menu1() {
        System.out.println("menu1");
    }

    //ファイルを追加
    public void do_addFileMenu() {
        System.out.println("addFileMenu");
    }

    //フォルダーを追加
    public void do_addFolderMenu() {
        System.out.println("addFolderMenu");
    }

    //Level
    public void do_level() {
        System.out.println("level");
    }

    //optiPngパス
    public void do_optiPngButton() {
        System.out.println("op");
       FileDialog dialog=new FileDialog(shell,SWT.OPEN);
       String filename[]={"optipng.exe"};
       dialog.setFilterExtensions(filename);
       String path=dialog.open();
       if(path!=null){
           optiPngLabel.setText(path);
       }
    }

    public class DropMonitor extends DropTargetAdapter {
        public void dragEnter(DropTargetEvent event) {
            //System.out.println("drag enter:"+event.data);
        }

        public void dragOver(DropTargetEvent event) {
            //System.out.println("drag over:"+event.data);
        }

        public void drop(DropTargetEvent event) {
            //System.out.println("drop:"+event.data);

            //System.out.println(event.data.getClass().getName());
            String files[] (String[]) event.data;
            String tmpText = "";
            for (int i = 0; i < files.length; i++) {
                File file = new File(files[i]);
                if (file.isDirectory()) {
                    outputLabel.setText(files[i]);
                }

            }

        }
    }

    /* (non-Javadoc)
     * @see optipng.FileListChangeListener#removeList(optipng.FileListChangeEvent)
     */
    public void removeList(FileStatusChangeEvent event) {
        checkOptimizeButton();}

    
    /**
     
     */
    private boolean executing=false;
    private void checkOptimizeButton() {
        if(!executing){
        if(listTable.getFileCount()>&& (sameoutput.getSelection() || outputLabel.getText().length()>0)){
            optimizeButton.setEnabled(true);
        }else{
            optimizeButton.setEnabled(false);
        }
        }else{
            optimizeButton.setEnabled(false);
        }
    }

    /* (non-Javadoc)
     * @see optipng.FileListChangeListener#addList(optipng.FileListChangeEvent)
     */
    public void addList(FileStatusChangeEvent event) {
      //System.out.println("add "+event.getFilePath());
        checkOptimizeButton();
    }
    
    public  File searchFileAroundClass(String fileName) {
        ClassLoader loader = this.getClass().getClassLoader();
        String path = this.getClass().getName().replaceAll("\\.""/");
        path = path + ".class";

        URL url = loader.getResource(path);
        String classPath = url.toString();
        //System.out.println(classPath);
        if (classPath.startsWith("jar:")) {
            int last = classPath.lastIndexOf("!");
            classPath = classPath.substring("jar:".length(), last);
        }

        if (classPath.startsWith("file:/")) {
            File checkFile = new File(URLDecoder.decode(classPath
                    .substring("file:/".length()))).getParentFile();
            while (true) {
                File tmp = new File(checkFile, fileName);
                //  System.out.println(tmp.getAbsolutePath());
                if (tmp.exists()) {
                    return tmp;
                }

                else {
                    checkFile = checkFile.getParentFile();
                    if (checkFile == null) {
                        break;
                    }

                }
            }
            return null;
        else {
            return null;
        }
    }

}