📄 splashwindow.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: SplashWindow.java
package org.gudy.azureus2.ui.swt.mainwindow;
import com.aelitis.azureus.ui.IUIIntializer;
import com.aelitis.azureus.ui.InitializerListener;
import com.aelitis.azureus.ui.swt.imageloader.ImageLoader;
import com.aelitis.azureus.ui.swt.utils.ColorCache;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.util.AERunnable;
import org.gudy.azureus2.core3.util.Constants;
import org.gudy.azureus2.ui.swt.Utils;
// Referenced classes of package org.gudy.azureus2.ui.swt.mainwindow:
// Initializer
public class SplashWindow
implements InitializerListener
{
private static final String IMG_SPLASH = "azureus_splash";
protected static final int OFFSET_LEFT = 10;
protected static final int OFFSET_RIGHT = 139;
protected static final int OFFSET_BOTTOM = 12;
protected static final int PB_HEIGHT = 2;
protected static final boolean PB_INVERTED = true;
protected static final int PB_INVERTED_BG_HEIGHT = 2;
protected static final int PB_INVERTED_X_OFFSET = 0;
protected static final boolean DISPLAY_BORDER = true;
Display display;
IUIIntializer initializer;
Shell splash;
Canvas canvas;
Image background;
int width;
int height;
Image current;
Color progressBarColor;
Color textColor;
Color fadedGreyColor;
Font textFont;
private String task;
private int percent;
private boolean updating;
int pbX;
int pbY;
int pbWidth;
public SplashWindow(Display display)
{
this(display, null);
}
public static void main(String args[])
{
Display display = new Display();
SplashWindow splash = new SplashWindow(display);
Thread t = new Thread(splash) {
final SplashWindow val$splash;
public void run()
{
try
{
for (int percent = 0; percent <= 100;)
{
splash.reportPercent(percent++);
splash.reportCurrentTask((new StringBuilder()).append(percent).append("% Loading dbnvsudn vjksfdh fgshdu fbhsduh bvsfd fbsd fbvsdb fsuid opnum supnum boopergood haha text doot subliminal.".substring(0, (int)(1.0D + Math.random() * 110D))).toString());
Thread.sleep(100L);
}
}
catch (Exception e) { }
splash.closeSplash();
}
{
splash = splashwindow;
super();
}
};
t.start();
do
{
if (splash.splash.isDisposed())
break;
if (!display.readAndDispatch())
display.sleep();
} while (true);
display.dispose();
}
public SplashWindow(Display _display, IUIIntializer initializer)
{
GC gc;
display = _display;
this.initializer = initializer;
splash = new Shell(display, 8);
splash.setText(Constants.APP_NAME);
Utils.setShellIcon(splash);
splash.setLayout(new FillLayout());
canvas = new Canvas(splash, 0x20000000);
ImageLoader imageLoader = ImageLoader.getInstance();
background = imageLoader.getImage("azureus_splash");
if (ImageLoader.isRealImage(background))
{
width = background.getBounds().width;
height = background.getBounds().height;
break MISSING_BLOCK_LABEL_267;
}
width = 400;
height = 80;
background = new Image(display, width, height);
gc = new GC(background);
gc.setBackground(ColorCache.getColor(display, 255, 255, 255));
gc.fillRectangle(0, 0, width, height);
gc.drawRectangle(0, 0, width - 1, height - 1);
gc.drawText(Constants.APP_NAME, 5, 5, true);
gc.dispose();
break MISSING_BLOCK_LABEL_267;
Exception exception;
exception;
gc.dispose();
throw exception;
current = new Image(display, background, 0);
progressBarColor = new Color(display, 21, 92, 198);
textColor = new Color(display, 90, 90, 90);
fadedGreyColor = new Color(display, 170, 170, 170);
pbX = 10;
pbY = height - 12;
pbWidth = width - 10 - 139;
canvas.setSize(width, height);
Font font = canvas.getFont();
FontData fdata[] = font.getFontData();
fdata[0].setHeight(Constants.isOSX ? 9 : 7);
textFont = new Font(display, fdata);
canvas.addPaintListener(new PaintListener() {
final SplashWindow this$0;
public void paintControl(PaintEvent event)
{
if (current == null)
{
return;
} else
{
event.gc.drawImage(current, 0, 0);
return;
}
}
{
this$0 = SplashWindow.this;
super();
}
});
splash.setSize(width, height);
Utils.centreWindow(splash);
splash.open();
if (initializer != null)
initializer.addListener(this);
return;
}
public static void create(Display display, Initializer initializer)
{
Utils.execSWTThread(new AERunnable(display, initializer) {
final Display val$display;
final Initializer val$initializer;
public void runSupport()
{
if (display == null || display.isDisposed())
{
return;
} else
{
new SplashWindow(display, initializer);
return;
}
}
{
display = display1;
initializer = initializer1;
super();
}
});
}
public void closeSplash()
{
Utils.execSWTThread(new AERunnable() {
final SplashWindow this$0;
public void runSupport()
{
try
{
if (initializer != null)
initializer.removeListener(SplashWindow.this);
if (splash != null && !splash.isDisposed())
splash.dispose();
if (current != null && !current.isDisposed())
current.dispose();
if (progressBarColor != null && !progressBarColor.isDisposed())
progressBarColor.dispose();
if (fadedGreyColor != null && !fadedGreyColor.isDisposed())
fadedGreyColor.dispose();
if (textColor != null && !textColor.isDisposed())
textColor.dispose();
if (textFont != null && !textFont.isDisposed())
textFont.dispose();
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.releaseImage("azureus_splash");
imageLoader.collectGarbage();
}
catch (Exception e) { }
}
{
this$0 = SplashWindow.this;
super();
}
});
}
public void reportCurrentTask(String task)
{
if (display == null || display.isDisposed())
return;
if (this.task == null || this.task.compareTo(task) != 0)
{
this.task = task;
update();
}
}
private void update()
{
if (updating && !Utils.isThisThreadSWT())
{
return;
} else
{
updating = true;
Utils.execSWTThread(new AERunnable() {
final SplashWindow this$0;
public void runSupport()
{
updating = false;
if (splash == null || splash.isDisposed())
return;
Image newCurrent = new Image(display, background, 0);
GC gc = new GC(newCurrent);
try
{
gc.setAntialias(1);
gc.setTextAntialias(1);
}
catch (Exception e) { }
int y = pbY;
if (task != null)
{
gc.setFont(textFont);
gc.setForeground(textColor);
Point extent = gc.textExtent(task);
y = pbY - extent.y - 5;
gc.setClipping(10, y, width - 20, extent.y);
gc.drawText(task, 10, y, true);
gc.setClipping((Rectangle)null);
}
gc.setForeground(fadedGreyColor);
gc.setBackground(fadedGreyColor);
gc.fillRectangle(pbX - 0, pbY + Math.abs(0) / 2, pbWidth + 0, 2);
gc.setForeground(progressBarColor);
gc.setBackground(progressBarColor);
gc.fillRectangle(pbX, pbY, (percent * pbWidth) / 100, 2);
Image old = current;
current = newCurrent;
if (old != null && !old.isDisposed())
old.dispose();
gc.dispose();
canvas.redraw(0, y, width, height - y, true);
canvas.update();
}
{
this$0 = SplashWindow.this;
super();
}
});
return;
}
}
public int getPercent()
{
return percent;
}
public void reportPercent(int percent)
{
if (display == null || display.isDisposed())
return;
if (percent > 100)
{
closeSplash();
return;
}
if (this.percent != percent)
{
this.percent = percent;
update();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -