hengheng123456789

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            297 Posts :: 68 Stories :: 144 Comments :: 0 Trackbacks
          分割窗(SashForm類)實例如下:

          /*
          ?*?SashForm?example?snippet:?create?a?sash?form?with?three?children
          ?*
          ?*?For?a?list?of?all?SWT?example?snippets?see
          ?*?http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/dev.html#snippets
          ?*/
          import?org.eclipse.swt.SWT;
          import?org.eclipse.swt.custom.SashForm;
          import?org.eclipse.swt.layout.FillLayout;
          import?org.eclipse.swt.widgets.Button;
          import?org.eclipse.swt.widgets.Composite;
          import?org.eclipse.swt.widgets.Display;
          import?org.eclipse.swt.widgets.Label;
          import?org.eclipse.swt.widgets.Shell;

          public?class?Snippet109?{

          ??public?static?void?main(String[]?args)?{
          ????final?Display?display?=?new?Display();
          ????Shell?shell?=?new?Shell(display);
          ????shell.setLayout(new?FillLayout());

          ????SashForm?form?=?new?SashForm(shell,?SWT.HORIZONTAL);
          ????form.setLayout(new?FillLayout());

          ????Composite?child1?=?new?Composite(form,?SWT.NONE);
          ????child1.setLayout(new?FillLayout());
          ????new?Label(child1,?SWT.NONE).setText("Label?in?pane?1");

          ????Composite?child2?=?new?Composite(form,?SWT.NONE);
          ????child2.setLayout(new?FillLayout());
          ????new?Button(child2,?SWT.PUSH).setText("Button?in?pane2");

          ????Composite?child3?=?new?Composite(form,?SWT.NONE);
          ????child3.setLayout(new?FillLayout());
          ????new?Label(child3,?SWT.PUSH).setText("Label?in?pane3");

          ????form.setWeights(new?int[]?{?30,?40,?30?});
          ????shell.open();
          ????while?(!shell.isDisposed())?{
          ??????if?(!display.readAndDispatch())
          ????????display.sleep();
          ????}
          ????display.dispose();
          ??}
          }

          posted on 2006-11-02 15:47 哼哼 閱讀(5939) 評論(0)  編輯  收藏 所屬分類: SWT
          主站蜘蛛池模板: 台安县| 元谋县| 武城县| 新绛县| 壶关县| 清镇市| 饶阳县| 柯坪县| 兖州市| 海门市| 宜君县| 岳西县| 洛浦县| 湖北省| 彭州市| 中山市| 汨罗市| 湛江市| 江川县| 应城市| 茂名市| 宜丰县| 侯马市| 贺兰县| 裕民县| 合作市| 永州市| 青田县| 元江| 云阳县| 平谷区| 贡嘎县| 黄浦区| 从江县| 西丰县| 高唐县| 桑日县| 深州市| 四平市| 海安县| 益阳市|