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

📄 animationgifclient.java

📁 SWTJFace篇项目源程序该项目包含 包含了Eclipse下构建swt的基本工程
💻 JAVA
字号:
package cn.com.chengang.jface.dialog.loopprogressdialog;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class AnimationGIFClient {
	public static void main(String[] args) {
		final Display display = Display.getDefault();
		final Shell shell = new Shell();
		shell.setSize(327, 253);
		// ---------创建窗口中的其他界面组件-------------
		shell.setLayout(new GridLayout());

		ImageLoader imageLoader = new ImageLoader();
		// imageLoader.load("icons/animation1.gif");
		// imageLoader.load("icons/animation4.gif");
		// imageLoader.load("icons/animation5.gif");
		// imageLoader.load("icons/animation2.gif");
		imageLoader.load("icons/animation3.gif");

		final AnimationGIF gif = new AnimationGIF(shell, SWT.BORDER, imageLoader);
		gif.setLayoutData(new GridData(GridData.FILL_BOTH));

		// 按钮组面板
		Composite comp = new Composite(shell, SWT.NONE);
		comp.setLayout(new RowLayout());
		final Button b1 = new Button(comp, SWT.NONE);
		b1.setText("STOP");
		b1.addSelectionListener(new SelectionAdapter() {
			private String str = "STOP";

			public void widgetSelected(SelectionEvent e) {
				if (str.equals("RUN")) {
					gif.run();
					str = "STOP";
				} else {
					gif.stop();
					str = "RUN";
				}
				b1.setText(str);
			}
		});
		// -----------------END------------------------
		shell.layout();
		shell.open();

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

⌨️ 快捷键说明

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