/* 
 * Created on 2004/11/02 
 * Author aki@www.xucker.jpn.org 
 * License Apache2.0 or Common Public License 
 */ 
package org.jpn.xucker.treetext; 
 
 
 
import org.eclipse.swt.custom.CCombo; 
import org.eclipse.swt.SWT; 
import org.eclipse.swt.events.SelectionEvent; 
import org.eclipse.swt.events.SelectionListener; 
 
import org.eclipse.swt.layout.RowData; 
import org.eclipse.swt.layout.RowLayout; 
import org.eclipse.swt.widgets.Button; 
import org.eclipse.swt.widgets.Combo; 
import org.eclipse.swt.widgets.Composite; 
import org.eclipse.swt.widgets.Display; 
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.eclipse.swt.program.Program; 
import org.eclipse.swt.widgets.MessageBox; 
 
import org.jpn.xucker.commons.swt.ui.FileDirChoicer; 
public class TreeText implements SelectionListener{ 
  /** 
   * @param shell 
   */ 
   private Text text; 
 
  Shell shell; 
private double version=0.1; 
      private String HOMEPAGE_URL="http://www.xucker.jpn.org/"; 
    private String APP_NAME="App"; 
  public TreeText(Shell shell) { 
    this.shell=shell; 
    shell.setText(""); 
    shell.setBounds(0,0,600,400); 
    RowLayout layout=new RowLayout(); 
    shell.setLayout(layout); 
    Composite composite1=new Composite(shell,SWT.NULL); 
RowLayout composite1_layout=new RowLayout(); 
composite1.setLayout(composite1_layout); 
RowData composite1_data=new RowData(); 
composite1_data.width=150; 
composite1_data.height=400; 
composite1.setLayoutData(composite1_data); 
 
text=new Text(shell,SWT.MULTI); 
text.setText("text"+text.getLineDelimiter()+"text"); 
text.addSelectionListener(this); 
RowData text_data=new RowData(); 
text_data.width=430; 
text_data.height=400; 
text.setLayoutData(text_data); 
 
 
  } 
 
  public static void main(String[] args) { 
   
    Display display=new Display(); 
    Shell shell=new Shell(display,SWT.CLOSE|SWT.MIN); 
   try { 
            TreeText main=new TreeText(shell); 
 
            shell.open(); 
 
            while (!shell.isDisposed()) { 
                if (!display.readAndDispatch()) { 
                    display.sleep(); 
                } 
            } 
            display.dispose(); 
        } catch (Exception e) { 
            e.printStackTrace(); 
        } finally { 
            if (!shell.isDisposed()) { 
                shell.close(); 
            } 
 
            display.dispose(); 
            //System.exit(0); 
        } 
 
    } 
     
     
     
   
  public void widgetSelected(SelectionEvent event) { 
  Object target=event.getSource(); 
     if(target==null){ 
       //maybe not happen. 
       System.out.println("target==null"); 
       } 
      
    } 
     
    public void widgetDefaultSelected(SelectionEvent arg0) { 
    // TODO Auto-generated method stub 
     
  } 
   
   
   
  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)AbL[  2004\r\n" 
            + HOMEPAGE_URL); 
 
    //int result=box.open(); 
    //never use result int,for PMD 
    box.open(); 
} 
}
    
    |