欢迎来到天天文库
浏览记录
ID:38364332
大小:44.00 KB
页数:5页
时间:2019-06-11
《Java书上习题》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、(1)packagech4;importorg.eclipse.swt.layout.GridLayout;importorg.eclipse.swt.graphics.Point;importorg.eclipse.swt.widgets.MessageBox;importorg.eclipse.swt.widgets.Shell;importorg.eclipse.swt.widgets.Display;importorg.eclipse.swt.layout.FillLayout;importor
2、g.eclipse.swt.widgets.Button;importorg.eclipse.swt.SWT;importorg.eclipse.swt.graphics.Rectangle;publicclassP63{privateShellsShell=null;privateButtonbutton=null;/***@paramargs*/publicstaticvoidmain(String[]args){//TODO自动生成方法存根/*Beforethisisrun,besuretoset
3、upthelaunchconfiguration(Arguments->VMArguments)*forthecorrectSWTlibrarypathinordertorunwiththeSWTdlls.*ThedllsarelocatedintheSWTpluginjar.*Forexample,onWindowstheEclipseSWT3.1pluginjaris:*installation_directorypluginsorg.eclipse.swt.win32_3.1.0.jar*/D
4、isplaydisplay=Display.getDefault();P63thisClass=newP63();thisClass.createSShell();thisClass.sShell.open();while(!thisClass.sShell.isDisposed()){if(!display.readAndDispatch())display.sleep();}display.dispose();}/***ThismethodinitializessShell*/privatevoid
5、createSShell(){sShell=newShell();sShell.setText("Shell");sShell.setSize(newPoint(300,200));sShell.setLayout(null);button=newButton(sShell,SWT.NONE);button.setBounds(newRectangle(78,54,65,33));button.setText("确定");button.addSelectionListener(neworg.eclips
6、e.swt.events.SelectionAdapter(){publicvoidwidgetSelected(org.eclipse.swt.events.SelectionEvente){MessageBoxbox=newMessageBox(sShell,SWT.ICON_INFORMATION
7、SWT.Close);box.setText("Java课堂!");int[]a=newint[100];for(intn=0;n8、tk=0;for(intn=0;n9、int;importorg.eclipse.swt.widgets.Shell;importorg.eclipse.swt.widgets.Display;importorg.eclipse.swt.widgets.Label;importorg.eclipse.swt.SWT;importorg.eclipse.swt.graphics.Rectangle;importorg.eclipse.swt.widgets.Button;publ
8、tk=0;for(intn=0;n9、int;importorg.eclipse.swt.widgets.Shell;importorg.eclipse.swt.widgets.Display;importorg.eclipse.swt.widgets.Label;importorg.eclipse.swt.SWT;importorg.eclipse.swt.graphics.Rectangle;importorg.eclipse.swt.widgets.Button;publ
9、int;importorg.eclipse.swt.widgets.Shell;importorg.eclipse.swt.widgets.Display;importorg.eclipse.swt.widgets.Label;importorg.eclipse.swt.SWT;importorg.eclipse.swt.graphics.Rectangle;importorg.eclipse.swt.widgets.Button;publ
此文档下载收益归作者所有