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

📄 linearanimator.java

📁 java 文件下载器。可自定义
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   LinearAnimator.java

package org.gudy.azureus2.ui.swt.animations.shell;

import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.gudy.azureus2.core3.util.AERunnable;
import org.gudy.azureus2.ui.swt.animations.Animator;

// Referenced classes of package org.gudy.azureus2.ui.swt.animations.shell:
//			AnimableShell

public class LinearAnimator extends Animator
{

	private AnimableShell shell;
	private Display display;
	private int startX;
	private int startY;
	private int endX;
	private int endY;
	private int nbSteps;
	private int period;
	private boolean interrupted;

	public LinearAnimator(AnimableShell shell, Point start, Point end, int nbSteps, int period)
	{
		super("Linear Shell Animator");
		if (period < 20)
			period = 20;
		if (nbSteps <= 0)
			nbSteps = 1;
		this.shell = shell;
		display = shell.getShell().getDisplay();
		startX = start.x;
		startY = start.y;
		endX = end.x;
		endY = end.y;
		this.nbSteps = nbSteps;
		this.period = period;
		interrupted = false;
	}

	public void runSupport()
	{
		shell.animationStarted(this);
		for (int step = 0; step <= nbSteps && !interrupted;)
		{
			setShellAtStep(step);
			shell.reportPercent((100 * step) / nbSteps);
			step++;
			try
			{
				Thread.sleep(period);
			}
			catch (Exception e)
			{
				step = nbSteps;
			}
		}

		shell.animationEnded(this);
		break MISSING_BLOCK_LABEL_99;
		Exception exception;
		exception;
		shell.animationEnded(this);
		throw exception;
	}

	public void interrupt()
	{
		interrupted = true;
	}

	private void setShellAtStep(int step)
	{
		if (display == null || display.isDisposed())
		{
			return;
		} else
		{
			final int x = startX + ((endX - startX) * step) / nbSteps;
			final int y = startY + ((endY - startY) * step) / nbSteps;
			display.asyncExec(new AERunnable() {

				final int val$x;
				final int val$y;
				final LinearAnimator this$0;

				public void runSupport()
				{
					if (shell == null || shell.getShell() == null || shell.getShell().isDisposed())
					{
						return;
					} else
					{
						shell.getShell().setLocation(x, y);
						return;
					}
				}

			
			{
				this$0 = LinearAnimator.this;
				x = i;
				y = j;
				super();
			}
			});
			return;
		}
	}

}

⌨️ 快捷键说明

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