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

ImageMarker.java
/*
 * Created on 2004/09/10
 * Author aki@www.xucker.jpn.org
 * License Apache2.0 or Common Public License
 */
package org.jpn.xucker.imagemarker;

import java.io.File;

import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.RGB;

import org.eclipse.swt.layout.RowData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;

import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.ColorDialog;
import org.eclipse.swt.widgets.FontDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;

import org.jpn.xucker.commons.swt.ui.FileDirChoicer;
import org.jpn.xucker.commons.swt.ui.FileStatusChangeEvent;
import org.jpn.xucker.commons.swt.ui.FileStatusChangeListener;
public class ImageMarker implements SelectionListener,FileStatusChangeListener,KeyListener{
  /**
   @param shell
   */
   private Menu menu1;
private MenuItem fileMenu;
private Group group1;
private Button outputsame;
private FileDirChoicer outputDir;
private Group group2;
private FileDirChoicer imagePath;
private Button imageLeftTopCheck;
private Button imageMiddleTopCheck;
private Button imageRightTopCheck;
private Button checkbox5;
private Text imageMargin;
private Group group3;
private Text textarea1;
private Button fontButton;
private Button colorButton;
private Button checkbox8;
private Text textMargin;

  Shell shell;
private double version=0.1;
      private String HOMEPAGE_URL="http://www.xucker.jpn.org/";
    private String APP_NAME="App";
    private MenuItem exitItem;
    private GUIProperties properties;
    private Button doBackup;
    private Button imageLeftCenterCheck;
    private Button imageMiddleCenterCheck;
    private Button imageRightCenterCheck;
    private Button imageLeftBottomCheck;
    private Button imageMiddleBottomCheck;
    private Button imageRightBottomCheck;
    private Button jpgHighOutput;
    private Button jpgMiddleOutput;
    private Button jpgLowOutput;
    private Button pngOutput;
    
    private Font currentFont;

    private ColorCanvas colorCanvas;
  public ImageMarker(Shell shell) {
    this.shell=shell;
    shell.setText("");
    shell.setBounds(0,0,500,400);
    RowLayout layout=new RowLayout();
    shell.setLayout(layout);
    
    menu1=new Menu(shell,SWT.BAR);
    
shell.setMenuBar(menu1);

fileMenu=new MenuItem(menu1,SWT.CASCADE);
fileMenu.setText("ファイル");

Menu menu2=new Menu(menu1);
fileMenu.setMenu(menu2);

exitItem = new MenuItem(menu2,SWT.PUSH);
exitItem.setText("終了");
exitItem.addSelectionListener(this);

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

outputsame=new Button(group1,SWT.NULL|SWT.CHECK);
outputsame.setText("出力先は元のファイルと同じ");
outputsame.addSelectionListener(this);
RowData outputsame_data=new RowData();
outputsame.setLayoutData(outputsame_data);

outputDir=new FileDirChoicer(group1,SWT.NULL,FileDirChoicer.DIR,null);
outputDir.addFileListChangeListener(this);
//outputDir.setPathWidth(100);

doBackup = new Button(group1,SWT.CHECK);
doBackup.setText("バックアップを取る");
doBackup.addSelectionListener(this);



Group imageTypeGroup=new Group(shell,SWT.NULL);
imageTypeGroup.setText("出力画像形式");
RowData imageTypeGroup_data=new RowData();
imageTypeGroup_data.width=480;
imageTypeGroup.setLayoutData(imageTypeGroup_data);
RowLayout imageTypeGroup_layout=new RowLayout();
imageTypeGroup.setLayout(imageTypeGroup_layout);

jpgHighOutput = new Button(imageTypeGroup,SWT.RADIO);
jpgHighOutput.setText("JPEG-高画質");
jpgHighOutput.addSelectionListener(this);

jpgMiddleOutput = new Button(imageTypeGroup,SWT.RADIO);
jpgMiddleOutput.setText("JPEG-中画質");
jpgMiddleOutput.addSelectionListener(this);

jpgLowOutput = new Button(imageTypeGroup,SWT.RADIO);
jpgLowOutput.setText("JPEG-低画質");
jpgLowOutput.addSelectionListener(this);

pngOutput = new Button(imageTypeGroup,SWT.RADIO);
pngOutput.setText("PNG-フルカラー");
pngOutput.addSelectionListener(this);
jpgHighOutput.setSelection(true);


group2=new Group(shell,SWT.NULL);
group2.setText("画像");
RowData group2_data=new RowData();
group2_data.width=235;
group2.setLayoutData(group2_data);
RowLayout group2_layout=new RowLayout();
group2.setLayout(group2_layout);

imagePath=new FileDirChoicer(group2,SWT.NULL,FileDirChoicer.FILE,null,true);
imagePath.setPathWidth(100);

imageLeftTopCheck=new Button(group2,SWT.NULL|SWT.CHECK);
imageLeftTopCheck.setText("左上");
imageLeftTopCheck.addSelectionListener(this);
RowData imageLeftTopCheck_data=new RowData();
imageLeftTopCheck.setLayoutData(imageLeftTopCheck_data);

imageMiddleTopCheck=new Button(group2,SWT.NULL|SWT.CHECK);
imageMiddleTopCheck.setText("中上");
imageMiddleTopCheck.addSelectionListener(this);
RowData checkbox3_data=new RowData();
imageMiddleTopCheck.setLayoutData(checkbox3_data);

imageRightTopCheck=new Button(group2,SWT.NULL|SWT.CHECK);
imageRightTopCheck.setText("右上");
imageRightTopCheck.addSelectionListener(this);
RowData checkbox4_data=new RowData();
imageRightTopCheck.setLayoutData(checkbox4_data);

createSpace(group2,50);



imageLeftCenterCheck=new Button(group2,SWT.NULL|SWT.CHECK);
imageLeftCenterCheck.setText("左中");
imageLeftCenterCheck.addSelectionListener(this);
RowData imageLeftCenterCheck_data=new RowData();
imageLeftCenterCheck.setLayoutData(imageLeftCenterCheck_data);

imageMiddleCenterCheck=new Button(group2,SWT.NULL|SWT.CHECK);
imageMiddleCenterCheck.setText("中央");
imageMiddleCenterCheck.addSelectionListener(this);
RowData imageMiddleCenterCheck_data=new RowData();
imageMiddleCenterCheck.setLayoutData(imageMiddleCenterCheck_data);

imageRightCenterCheck=new Button(group2,SWT.NULL|SWT.CHECK);
imageRightCenterCheck.setText("右中");
imageRightCenterCheck.addSelectionListener(this);
RowData imageRightCenterCheck_data=new RowData();
imageRightCenterCheck.setLayoutData(imageRightCenterCheck_data);

createSpace(group2,50);

imageLeftBottomCheck=new Button(group2,SWT.NULL|SWT.CHECK);
imageLeftBottomCheck.setText("左下");
imageLeftBottomCheck.addSelectionListener(this);
RowData imageLeftBottomCheck_data=new RowData();
imageLeftBottomCheck.setLayoutData(imageLeftBottomCheck_data);

imageMiddleBottomCheck=new Button(group2,SWT.NULL|SWT.CHECK);
imageMiddleBottomCheck.setText("中下");
imageMiddleBottomCheck.addSelectionListener(this);
RowData imageMiddleBottomCheck_data=new RowData();
imageMiddleBottomCheck.setLayoutData(imageMiddleBottomCheck_data);

imageRightBottomCheck=new Button(group2,SWT.NULL|SWT.CHECK);
imageRightBottomCheck.setText("右下");
imageRightBottomCheck.addSelectionListener(this);
RowData imageRightBottomCheck_data=new RowData();
imageRightBottomCheck.setLayoutData(imageRightBottomCheck_data);

createSpace(group2,50);





Label marginPre=new Label(group2,SWT.NULL);
marginPre.setText("マージン");

imageMargin=new Text(group2,SWT.SINGLE);
imageMargin.setText("10");
imageMargin.addKeyListener(this);
RowData imageMargin_data=new RowData();
imageMargin_data.width=24;
imageMargin.setLayoutData(imageMargin_data);
Label marginPx=new Label(group2,SWT.NULL);
marginPx.setText("ピクセル");

group3=new Group(shell,SWT.NULL);
group3.setText("テキスト");
RowData group3_data=new RowData();
group3_data.width=235;
group3.setLayoutData(group3_data);
RowLayout group3_layout=new RowLayout();
group3.setLayout(group3_layout);

colorCanvas = new ColorCanvas(group3,SWT.NULL);

RowData colorButton_data=new RowData();
colorButton_data.width=20;
colorButton_data.height=20;
colorCanvas.setLayoutData(colorButton_data);



fontButton=new Button(group3,SWT.NULL);
fontButton.setText("fontButton");
fontButton.addSelectionListener(this);
RowData fontButton_data=new RowData();
fontButton_data.width=205;
fontButton.setLayoutData(fontButton_data);
fontButton.setText(getCurrentFontName());


checkbox8=new Button(group3,SWT.NULL|SWT.CHECK);
checkbox8.setText("null8");
checkbox8.addSelectionListener(this);
RowData checkbox8_data=new RowData();
checkbox8.setLayoutData(checkbox8_data);

//<-- how to know change.
textMargin=new Text(group3,SWT.SINGLE);
textMargin.setText("textMargin");
textMargin.addKeyListener(this);
RowData textMargin_data=new RowData();
textMargin.setLayoutData(textMargin_data);

textarea1=new Text(group3,SWT.MULTI);
textarea1.setText("textarea1"+textarea1.getLineDelimiter()+"textarea1");
textarea1.addSelectionListener(this);
RowData textarea1_data=new RowData();
textarea1.setLayoutData(textarea1_data);

initProperties();
  }

  
  public class ColorCanvas extends Canvas implements PaintListener,MouseListener{
      Color currentColor=new Color(null,0,0,0);
        /**
         @param parent
         @param style
         */
        public ColorCanvas(Composite parent, int style) {
            super(parent, style);
            // TODO Auto-generated constructor stub
            addPaintListener(this);
            addMouseListener(this);
        }

        /* (non-Javadoc)
         * @see org.eclipse.swt.events.PaintListener#paintControl(org.eclipse.swt.events.PaintEvent)
         */
        public void paintControl(PaintEvent e) {
           GC gc=new GC(this);
           gc.setBackground(currentColor);
           gc.fillRectangle(0,0,this.getSize().x,this.getSize().y);
           /*
           gc.setForeground(new Color(null,0,0,0));
           gc.drawLine(0,this.getSize().y,this.getSize().x,this.getSize().y);
           gc.drawLine(this.getSize().x,0,this.getSize().x,this.getSize().y);
          */
           //gc.fillRectangle(this.getBounds());
           gc.dispose();
        }
      
        public void chooseColor(){
            ColorDialog dialog=new ColorDialog(shell);
            dialog.setRGB(currentColor.getRGB());
            RGB rgb=dialog.open();
            if(rgb!=null){
                Color color=new Color(shell.getDisplay(),rgb.red,rgb.blue,rgb.green);
                currentColor=color;
                this.redraw();
            }
        }

        /* (non-Javadoc)
         * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
         */
        public void mouseDoubleClick(MouseEvent e) {
            chooseColor();
        }

        /* (non-Javadoc)
         * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
         */
        public void mouseDown(MouseEvent e) {
            // TODO Auto-generated method stub
            
        }

        /* (non-Javadoc)
         * @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
         */
        public void mouseUp(MouseEvent e) {
            // TODO Auto-generated method stub
            
        }
      
      
  }
  /**
     @param group22
     @param i
     */
    private void createSpace(Composite composite, int width) {
        Label label=new Label(composite,SWT.NULL);
        label.setText("");
        
        RowData label_data=new RowData();
        label_data.width=width;
        label.setLayoutData(label_data);
    }


    /**
     
     */
    private void initProperties() {
        properties = new GUIProperties();
        properties.add("outputsame",outputsame);
        properties.add("outputdir",outputDir);
        properties.add("dobackup",doBackup);
        
        Button outputTypeArray[]={jpgHighOutput,jpgMiddleOutput,jpgLowOutput,pngOutput};
        properties.add("outputtype",outputTypeArray);
        
        properties.add("imageOutput",imagePath);
        properties.add("imageLeftTop",imageLeftTopCheck);
        properties.add("imageMiddleTop",imageMiddleTopCheck);
        properties.add("imageRightTop",imageRightTopCheck);
        properties.add("imageLeftCenter",imageLeftCenterCheck);
        properties.add("imageMiddleCenter",imageMiddleCenterCheck);
        properties.add("imageRightCenter",imageRightCenterCheck);
        properties.add("imageLeftBottom",imageLeftBottomCheck);
        properties.add("imageMiddleBottom",imageMiddleBottomCheck);
        properties.add("imageRightBottom",imageRightBottomCheck);
        properties.add("imageMargin",imageMargin);
        properties.load(new File("c:\\tmp\\preference.txt"));
        
        uichange();
    }
    
    private void uichange(){
        if(outputsame.getSelection()){
            outputDir.setEnabled(true);
        }else{
            outputDir.setEnabled(false);
        }
    }
    private void updateUi(){
        uichange();
        properties.save();
    }

    public static void main(String[] args) {
    Display display=new Display();
    Shell shell=new Shell(display,SWT.CLOSE|SWT.MIN);
    
    
    ImageMarker main=new ImageMarker(shell);
    
    
    shell.open();
    
    while(!shell.isDisposed()){      
      if (!display.readAndDispatch ()){
          display.sleep ();
          }
    }
    display.dispose();
  }
  
  public void widgetSelected(SelectionEvent event) {
  Object target=event.getSource();
     if(target==null){
       //maybe not happen.
       System.out.println("target==null");
       }
     //null1
else if(target==exitItem){
do_exitItem();
  }
//null1
else if(target==fileMenu){
do_pushmenu1();
  }
//outputsame
else if(target==outputsame){
do_outputsame();
  }
else if(target==doBackup){
    updateUi();
}
//"outputDir"
else if(target==outputDir){
do_outputDir();
  }
//"imagePath"
else if(target==imagePath){
do_imagePath();
  }
//imageLeftTopCheck
else if(target==imageLeftTopCheck){
do_imageLeftTopCheck();
  }
//null3
else if(target==imageMiddleTopCheck){
    updateUi();
  }
//null4
else if(target==imageRightTopCheck){
    updateUi();
  }
//null5
else if(target==imageLeftCenterCheck){
    updateUi();
  }
else if(target==imageMiddleCenterCheck){
    updateUi();
  }
else if(target==imageRightCenterCheck){
    updateUi();
  }
else if(target==imageLeftBottomCheck){
    updateUi();
  }
else if(target==imageLeftBottomCheck){
    updateUi();
  }
else if(target==imageLeftBottomCheck){
    updateUi();
  }
else if(target==jpgHighOutput || target==jpgMiddleOutput || target==jpgLowOutput || target==pngOutput){
    updateUi();
  }
//fontButton
else if(target==fontButton){
do_fontButton();
  }
//colorButton
else if(target==colorButton){
do_colorButton();
  }
//null8
else if(target==checkbox8){
do_checkbox8();
  }

    }
    
    /**
     
     */
    private void do_exitItem() {
       shell.close();
    }

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

//null1
public void do_pushmenu1(){
System.out.println("pushmenu1");
  }
//outputsame
public void do_outputsame(){
    updateUi();
  }
//outputDir
public void do_outputDir(){
    System.out.println("output");
    properties.save();
  }
//imagePath
public void do_imagePath(){
System.out.println("imagePath");
  }
//imageLeftTopCheck
public void do_imageLeftTopCheck(){
System.out.println("imageLeftTopCheck");
  }
//null3
public void do_checkbox3(){
System.out.println("checkbox3");
  }
//null4
public void do_checkbox4(){
System.out.println("checkbox4");
  }
//null5
public void do_checkbox5(){
System.out.println("checkbox5");
  }
//fontButton
public void do_fontButton(){
    chooseFont();
  }
//colorButton
public void do_colorButton(){
    colorCanvas.chooseColor();
  }
//null8
public void do_checkbox8(){
System.out.println("checkbox8");
  }


public String getCurrentFontName(){
    String result="";
    if(currentFont==null){
        currentFont=fontButton.getFont();
        
    }
    FontData data[]=currentFont.getFontData();
    int style=data[0].getStyle();
    String styleText="";
    if((style & SWT.BOLD)>0){
        styleText=" BOLD";
    }else if((style & SWT.ITALIC)>0){
        if(styleText.equals("")){
            styleText=" ITALIC";
        }else{
            styleText+="/ITALIC";
        }
    }
    result=data[0].getName()+" "+data[0].getHeight()+"px"+styleText;
    
    return result;
}

public void chooseFont(){
    FontDialog dialog=new FontDialog(shell);
    FontData font =dialog.open();
    currentFont=new Font(shell.getDisplay(),font);
    fontButton.setText(getCurrentFontName());
}


  
  public void execHomepage(){
    Program program=Program.findProgram("html");
    if(program!=null){
        program.execute(HOMEPAGE_URL);
    }
   
   
}
public void execVersion() {
    MessageBox box = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
    box.setMessage(APP_NAME+" v" + version + "\r\n\r\n"
            "License CPL or Apache2.0\r\n (c)アッキー  2004\r\n"
            + HOMEPAGE_URL);

    //int result=box.open();
    //never use result int,for PMD
    box.open();
}

/* (non-Javadoc)
 * @see org.jpn.xucker.commons.swt.ui.FileStatusChangeListener#removeList(org.jpn.xucker.commons.swt.ui.FileStatusChangeEvent)
 */
public void removeList(FileStatusChangeEvent event) {
    // TODO Auto-generated method stub
    
}

/* (non-Javadoc)
 * @see org.jpn.xucker.commons.swt.ui.FileStatusChangeListener#addList(org.jpn.xucker.commons.swt.ui.FileStatusChangeEvent)
 */
public void addList(FileStatusChangeEvent event) {
    updateUi();
}


/* (non-Javadoc)
 * @see org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.KeyEvent)
 */
public void keyPressed(KeyEvent e) {
    //oh my ...code.
    updateUi();
}


/* (non-Javadoc)
 * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
 */
public void keyReleased(KeyEvent e) {
    // TODO Auto-generated method stub
    
}
}