资源描述:
《menu_dialog_example》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、packagedialog_main;importorg.eclipse.swt.events.*;importorg.eclipse.swt.widgets.*;importorg.eclipse.swt.graphics.*;importorg.eclipse.swt.custom.*;importorg.eclipse.swt.SWT;publicclassdialog_main{publicstaticvoidmain(String[]args){winw=newwin();Displaydisp=w.disp;Shellshell=w.shell;while(!shell.isD
2、isposed())if(!disp.readAndDispatch())disp.sleep();}}classwin{Displaydisp=newDisplay();Shellshell=newShell(disp,SWT.CLOSE);Textt1=newText(shell,SWT.MULTI
3、SWT.BORDER);Textt2=newText(shell,SWT.MULTI
4、SWT.BORDER);Textpath=newText(shell,SWT.BORDER);//filedirectoryTextfilter=newText(shell,SWT.BORDER);//f
5、ilefilterMenubar=newMenu(shell,SWT.BAR
6、SWT.BORDER);//menuBaronshell//MenuforfileMenuItemfile_head=newMenuItem(bar,SWT.CASCADE);//menuitemonbarMenufile_menu=newMenu(file_head);//DropDownMenuforfile_headMenuItemfile_new=newMenuItem(file_menu,SWT.PUSH);//menuiteminfile_menuMenuItemfile_open=newMenuIt
7、em(file_menu,SWT.PUSH);MenuItemfile_close=newMenuItem(file_menu,SWT.PUSH);MenuItemfile_p=newMenuItem(file_menu,SWT.SEPARATOR);MenuItemfile_save=newMenuItem(file_menu,SWT.PUSH);MenuItemfile_save_as=newMenuItem(file_menu,SWT.PUSH);MenuItemfile_save_all=newMenuItem(file_menu,SWT.PUSH);//Menuforconfig
8、MenuItemconfig_head=newMenuItem(bar,SWT.CASCADE);//menuitemonbarMenuconfig_menu=newMenu(config_head);//DropDownMenuforconfig_headMenuItemconfig_fcolor=newMenuItem(config_menu,SWT.PUSH);//menuiteminconfig_menuMenuItemconfig_bcolor=newMenuItem(config_menu,SWT.PUSH);MenuItemconfig_font=newMenuItem(co
9、nfig_menu,SWT.PUSH);win(){shell.setBounds(10,10,1000,700);shell.setText("ExampleforMenuandDialog");t1.setBounds(50,10,400,500);t2.setBounds(470,10,400,500);path.setBounds(10,550,500,45);filter.setBounds(520,550,200,45);shell.setMenuBar(bar);file_head.setMenu(file_menu);config_head.setMenu(config_m
10、enu);file_head.setText("File");file_new.setText("New");file_open.setText("Open");file_close.setText("Close");file_save.setText("Save");file_save_as.setText("Saveas");file_save_all.setText("Saveall");config_head.s