⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gridlayoutdemo.java

📁 一款少见的用swt写的彩票软件
💻 JAVA
字号:
package com.dc.test;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

/**//**
 * @author HexUzHoNG Created on 2005-6-23
 * 
 */
public class GridLayoutDemo {

	public static void main(String[] args) {

		Display display = new Display();
		Shell shell = new Shell(display);

		GridLayout gridLayout = new GridLayout();
		// 设置为2列
		
		gridLayout.makeColumnsEqualWidth = true;
		shell.setLayout(gridLayout);
		

		GridData gd = new GridData(GridData.FILL_BOTH);
		//Button butOne = new Button(shell, SWT.PUSH);
		//butOne.setText("one");
		//butOne.setLayoutData(gd);

		gd = new GridData(GridData.FILL_BOTH);
		//Button butTwo = new Button(shell, SWT.PUSH);
		//butTwo.setText("two");
		//butTwo.setLayoutData(gd);

		gd = new GridData(GridData.FILL_BOTH);
		//Button butThree = new Button(shell, SWT.PUSH);
		//butThree.setText("three");
		//butThree.setLayoutData(gd);

		gd = new GridData(GridData.FILL_BOTH);
		//Button butFour = new Button(shell, SWT.PUSH);
		//butFour.setText("four");
		//butFour.setLayoutData(gd);

		shell.pack();

		final Canvas canvas = new Canvas(shell, SWT.NONE);
		canvas.setLayoutData(new GridData(285, SWT.DEFAULT));
		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}

		display.dispose();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -