📄 shellslider.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: ShellSlider.java
package org.gudy.azureus2.ui.swt.shells;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.util.AERunnable;
public class ShellSlider
{
private final boolean DEBUG = false;
private int STEP;
private int PAUSE;
private Shell shell;
private Rectangle shellBounds;
private Rectangle endBounds;
private final int direction;
private final boolean slideIn;
public ShellSlider(final Shell shell, int direction, final Rectangle endBounds)
{
STEP = 8;
PAUSE = 30;
shellBounds = null;
this.shell = shell;
this.endBounds = endBounds;
slideIn = true;
this.direction = direction;
if (shell == null || shell.isDisposed())
{
return;
} else
{
Display display = shell.getDisplay();
display.syncExec(new Runnable() {
final Shell val$shell;
final Rectangle val$endBounds;
final ShellSlider this$0;
public void run()
{
if (shell.isDisposed())
return;
switch (direction)
{
case 128:
default:
shell.setLocation(endBounds.x, endBounds.y);
break;
}
Rectangle displayBounds = null;
try
{
boolean ok = false;
Monitor monitors[] = shell.getDisplay().getMonitors();
int i = 0;
do
{
if (i >= monitors.length)
break;
Monitor monitor = monitors[i];
displayBounds = monitor.getBounds();
if (displayBounds.contains(endBounds.x, endBounds.y))
{
ok = true;
break;
}
i++;
} while (true);
if (!ok)
displayBounds = shell.getMonitor().getBounds();
}
catch (Throwable t)
{
displayBounds = shell.getDisplay().getBounds();
}
shellBounds = new Rectangle(endBounds.x, displayBounds.y + displayBounds.height, endBounds.width, 0);
shell.setBounds(shellBounds);
shell.setVisible(true);
}
{
this$0 = ShellSlider.this;
shell = shell1;
endBounds = rectangle;
super();
}
});
return;
}
}
public ShellSlider(Shell shell, int direction)
{
STEP = 8;
PAUSE = 30;
shellBounds = null;
this.shell = shell;
slideIn = false;
this.direction = direction;
}
private boolean canContinue()
{
if (shell == null || shell.isDisposed())
return false;
if (shellBounds == null)
return true;
if (slideIn)
{
if (direction == 128)
return shellBounds.y > endBounds.y;
} else
if (direction == 0x20000)
return shellBounds.width > 10;
return false;
}
public void run()
{
while (canContinue())
{
long lStartedAt = System.currentTimeMillis();
shell.getDisplay().syncExec(new AERunnable() );
try
{
long lDrawTime = System.currentTimeMillis() - lStartedAt;
long lSleepTime = (long)PAUSE - lDrawTime;
if (lSleepTime < 15L)
{
double d = ((double)lDrawTime + 15D) / (double)PAUSE;
PAUSE *= d;
STEP *= d;
lSleepTime = 15L;
}
Thread.sleep(lSleepTime);
}
catch (Exception e) { }
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -