基于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 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于基于Eclipse 3.0的SWT编程 - 编程入门网的所有评论