快速业务通道

基于Eclipse 3.0的SWT编程 - 编程入门网

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-06-17
ls");  group.setBounds(10, 10, 585, 355);  {   final Label label = new Label(group, SWT.NONE);   label.setBounds(10, 20, 135, 25);   label.setText("First Name:");  }  {   final Label label = new Label(group, SWT.NONE);   label.setBounds(10, 60, 135, 25);   label.setText("Last Name:");  }  {   final Label label = new Label(group, SWT.NONE);   label.setBounds(10, 100, 135, 25);   label.setText("Phone:");  }  {   final Label label = new Label(group, SWT.NONE);   label.setBounds(10, 140, 135, 25);   label.setText("Email:");  }  {   final Label label = new Label(group, SWT.NONE);   label.setBounds(10, 180, 135, 25);   label.setText("Address:");  }  {   final Label label = new Label(group, SWT.NONE);   label.setBounds(10, 255, 135, 25);   label.setText("Miscellaneous Information:");  }  {   fnameText = new Text(group, SWT.BORDER | SWT.READ_ONLY);   fnameText.setBounds(150, 15, 420, 25);  }  {   lnameText = new Text(group, SWT.BORDER | SWT.READ_ONLY);   lnameText.setBounds(150, 55, 420, 25);  }  {   phoneText = new Text(group, SWT.BORDER | SWT.READ_ONLY);   phoneText.setBounds(150, 95, 420, 25);  }  {   emailText = new Text(group, SWT.BORDER | SWT.READ_ONLY);   emailText.setBounds(150, 135, 420, 25);  }  {   addrText = new Text(group, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL);   addrText.setBounds(150, 175, 420, 60);  }  {   miscText = new Text(group, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL);   miscText.setBounds(150, 250, 420, 65);  } } setupMenu(); shell.open(); while (!shell.isDisposed()) {  if (!display.readAndDispatch())   display.sleep(); }}private void setupMenu() { //create the menu bar Menu menu = new Menu(shell, SWT.BAR); shell.setMenuBar(menu); //add the File option to it MenuItem file = new MenuItem(menu, SWT.CASCADE); file.setText("File"); //create a menu for the File option file.setMenu(new Menu(file)); //add MenuItems to the File menu MenuItem prevItem = new MenuItem(new Menu(file), SWT.NONE); prevItem.setText("Previous"); MenuItem nextItem = new MenuItem(new Menu(file), SWT.PUSH); nextItem.setText("Next"); MenuItem seperator = new MenuItem(new Menu(file), SWT.SEPARATOR); MenuItem quitItem = new MenuItem(new Menu(file), SWT.PUSH); quitItem.setText("Quit"); //add listeners for the actions prevItem.addListener(SWT.Selection, new Listener() {  public void handleEvent(Event e) {   System.out.println("Previous menu item selected.");  } }); nextItem.addListener(SWT.Selection, new Listener() {  public void handleEvent(Event e) {   System.out.println("Next menu item selected.");  } }); quitItem.addListener(SWT.Selection, new Listener() {  public void handleEvent(Event e) {   shell.dispose();  } });}private void clearText() { fnam

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号