BLOG ARTICLE SWT | 5 ARTICLE FOUND

  1. 2008/01/15 Swt_Event Action + Contributions
  2. 2008/01/14 MouseKey + CompViewer
  3. 2008/01/14 SashForm + CompViewer
  4. 2008/01/13 Group + CompViewer (2)
  5. 2008/01/12 Label Test (2)

  • SWT_Event

    Action

    import org.eclipse.jface.action.*;

    import org.eclipse.jface.resource.*;



    public class Ch4_StatusAction extends Action{


    StatusLineManager statman;


    short triggercount = 0;



    public Ch4_StatusAction(StatusLineManager sm){

    super("&TRigger@Ctrl+T", AS_PUSH_BUTTON);


    statman = sm;


    setToolTipText("Triger the Action");

    setImageDescriptor(ImageDescriptor.createFromFile(this.getClass(),"eclipse.gif"));


    }



    public void run(){

    triggercount++;

    statman.setMessage("The status action has fired. Count : " + triggercount);


    }

    }



    Contributions

    import org.eclipse.swt.*;

    import org.eclipse.swt.widgets.*;

    import org.eclipse.jface.window.*;

    import org.eclipse.jface.action.*;


    public class Ch4_Contributions extends ApplicationWindow{


    StatusLineManager slm = new StatusLineManager();


    Ch4_StatusAction status_action = new Ch4_StatusAction(slm);

    ActionContributionItem aci = new ActionContributionItem(status_action);


    public Ch4_Contributions(){

    super(null);

    addStatusLine();

    addMenuBar();

    addToolBar(SWT.FLAT|SWT.WRAP);

    }


    protected Control createContents(Composite parent){

    this.getShell().setText("Action/contribution Example");

    parent.setSize(290,150);

    aci.fill(parent);

    return parent;

    }

    public static void main(String[] args) {


    Ch4_Contributions swin = new Ch4_Contributions();

    swin.setBlockOnOpen(true);

    swin.open();

    Display.getCurrent().dispose();



    }


    protected MenuManager createMenuManager(){

    MenuManager main_menu = new MenuManager(null);

    MenuManager action_menu = new MenuManager("Menu");

    main_menu.add(action_menu);

    action_menu.add(status_action);

    return main_menu;


    }


    protected ToolBarManager createToolBarManager(int style){

    ToolBarManager tool_bar_manager = new ToolBarManager(style);

    tool_bar_manager.add(status_action);

    return tool_bar_manager;

    }


    protected StatusLineManager createStatusLineManager(){

    return slm;

    }

    }





사용자 삽입 이미지





    설명 : 메뉴바에서

    메뉴를 선택하거나 그림 또는 버튼 또는 Ctrl + T 누르면

    밑에 상태표시줄에 카운트가

    증가한다

크리에이티브 커먼즈 라이선스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

MouseKey

코드보기


CompViewer

코드보기


크리에이티브 커먼즈 라이선스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

SashForm

코드보기



 CompViewer

코드보기


크리에이티브 커먼즈 라이선스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

사용자 삽입 이미지



Group

코드보기



CompViewer

코드보기



 --------------------------------
Group + CompViewer


크리에이티브 커먼즈 라이선스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

사용자 삽입 이미지


import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class Label_Test {


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

        Shell shell = new Shell(display);

        
        Label shadow_label = new Label(shell,SWT.UP);
        shadow_label.setText("SWT.SHADOW_IN");
        shadow_label.setBounds(30, 10, 110, 15);
        
        Label shadow_sep = new Label(shell, SWT.SEPARATOR|SWT.HORIZONTAL|SWT.SHADOW_IN);
        shadow_sep.setBounds(30, 35, 110, 5);
        
        
        Label shadow_label1 = new Label(shell,SWT.CENTER);
        shadow_label1.setText("SWT.SHADOW_OUT");
        shadow_label1.setBounds(30, 60, 110, 15);

        Label shadow_sep1 = new Label(shell, SWT.SEPARATOR|SWT.HORIZONTAL|SWT.SHADOW_OUT);
        shadow_sep1.setBounds(30, 85, 110, 5);
        
        Label shadow_label2 = new Label(shell,SWT.DOWN);
        shadow_label2.setText("SWT.SHADOW_NONE");
        shadow_label2.setBounds(30, 100, 110, 15);

        Label shadow_sep2 = new Label(shell, SWT.SEPARATOR|SWT.HORIZONTAL|SWT.SHADOW_NONE);
        shadow_sep2.setBounds(30, 125, 110, 5);

        shadow_label.pack();
        shadow_label1.pack();
        shadow_label2.pack();
        
        shadow_sep.pack();
        shadow_sep1.pack();
        shadow_sep2.pack();
        shell.pack();
        

        shell.open();

        while (!shell.isDisposed())
            if (!display.readAndDispatch())
                display.sleep();

        display.dispose();
        
        
        shadow_label.dispose();
        shadow_label1.dispose();
        shadow_label2.dispose();

        shadow_sep.dispose();
        shadow_sep1.dispose();
        shadow_sep2.dispose();
    }

}

----------------------------------------

Lable 3개와

구분선 을 나타내는 소스이다.



크리에이티브 커먼즈 라이선스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)