乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      第一個SWT程序

       印度阿三17 2019-12-19
      import org.eclipse.swt.SWT;
      import org.eclipse.swt.events.SelectionEvent;
      import org.eclipse.swt.events.SelectionListener;
      import org.eclipse.swt.widgets.Button;
      import org.eclipse.swt.widgets.Display;
      import org.eclipse.swt.widgets.Group;
      import org.eclipse.swt.widgets.Label;
      import org.eclipse.swt.widgets.List;
      import org.eclipse.swt.widgets.MessageBox;
      import org.eclipse.swt.widgets.Shell;
      import org.eclipse.swt.widgets.Text;
      
      
      public class HelloSWT extends Shell{
          
          // 這些都是在下面將要用到的控件
          private static Text text;
          private static Button swtButton;
          private static Button awtButton;
          private static Button swingButton;
          private static Group group;
          private static Button button;
          private static Label benefitOfSwtLabel;
          private static List list;
      
          public static void main(String[] args) {
      
              /**
               * 創(chuàng)建一個Display對象,并使用這個Display創(chuàng)建一個
               * 窗口Shell,并設(shè)置它的標(biāo)題和窗口初始尺寸。因?yàn)楫?dāng)
               * 前線程創(chuàng)建了Display對象,所以它是界面線程
               */
              Display display = Display.getDefault();
              final Shell shell = new Shell(display);
              shell.setText("Hello SWT");
              shell.setSize(260, 283);
              
              shell.open();
              
              /**
               * 創(chuàng)建一個Text空間并設(shè)置其中文字的內(nèi)容。然后設(shè)置了
               * 空間在窗口中的位置
               * 左上頂點(diǎn)為(10,8),寬度為230,高度為35
               */
              text = new Text(shell, SWT.BORDER);
              text.setText("SWT是Eclipse平臺使用的圖形工具箱");
              text.setBounds(10, 8, 230, 35);
              
              /**
               * List控件可以用來展示一系列的內(nèi)容。這里創(chuàng)建了4條內(nèi)容
               * 的List控件
               */
              list = new List(shell, SWT.BORDER);
              list.setItems(new String[] {
                  "使用操作系統(tǒng)本地控件",
                  "提供一套平臺無關(guān)的API",
                  "GUI程序的運(yùn)行速度快",
                  "更多更多......"
              });
              
              /**
               * Label控件可以在界面上展示不能修改的文字,通常作為
               * 標(biāo)簽來使用
               */
              benefitOfSwtLabel = new Label(shell, SWT.NONE);
              benefitOfSwtLabel.setText("SWT的優(yōu)點(diǎn):");
              benefitOfSwtLabel.setBounds(10, 49, 90, 15);
              
              /**
               * Group對象可以用來把相關(guān)的控件組成一組,在這一組控件
               * 的外面會顯示出一個邊框,將它們和其他控件隔離開來。在邊框
               * 上可以加入文字標(biāo)題以說明這一組控件的作用。
               */
              group = new Group(shell, SWT.NONE);
              group.setText("你使用過哪些圖形工具箱?");
              group.setBounds(10, 159, 230, 47);
              
              /**
               * Button類型包含普通按鈕,單選按鈕,復(fù)選按鈕等很多形式。
               * 
               */
              awtButton = new Button(group, SWT.CHECK);
              awtButton.setText("AWT");
              awtButton.setBounds(10, 20, 54, 18);
              
              swingButton = new Button(group, SWT.CHECK);
              swingButton.setText("Swing");
              swingButton.setBounds(70, 22, 60, 15);
              
              swtButton = new Button(group, SWT.CHECK);
              swtButton.setBounds(136, 22, 62, 15);
              swtButton.setText("SWT");
              
              button = new Button(shell, SWT.None);
              button.addSelectionListener(new SelectionListener() {
                  
                  @Override
                  public void widgetSelected(SelectionEvent arg0) {
                      MessageBox messageBox = 
                              new MessageBox(shell, SWT.ICON_INFORMATION);
                      messageBox.setMessage("Hello SWT");
                      messageBox.open();
                  }
                  
                  @Override
                  public void widgetDefaultSelected(SelectionEvent arg0) {
                      // TODO Auto-generated method stub
                      
                  }
              });
              
              button.setText("按一下按鈕,向SWT說Hello!");
              button.setBounds(10, 214, 227, 25);
              shell.layout();
              
              while(!shell.isDisposed()) {
                  if (!display.readAndDispatch()) {
                      display.sleep();
                  }
              }
          }
      }
      來源:https://www./content-1-599801.html

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多