splash update
@@ -12,5 +12,5 @@
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_45"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.diylc.DIYLCStarter"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="diylc-swing"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms256m -Xmx512m -Dorg.diylc.scriptRun=true -Ddorg.diylc.debugComponentAreas=true"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-splash:splash.png -Xms256m -Xmx512m -Dorg.diylc.scriptRun=true -Ddorg.diylc.debugComponentAreas=true"/>
|
||||
</launchConfiguration>
|
||||
|
||||
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 12 KiB |
@@ -1,17 +1,24 @@
|
||||
package org.diylc;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.SplashScreen;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.PropertyInjector;
|
||||
import org.diylc.images.IconLoader;
|
||||
import org.diylc.presenter.Presenter;
|
||||
import org.diylc.swing.gui.MainFrame;
|
||||
import org.diylc.swing.gui.TemplateDialog;
|
||||
@@ -34,6 +41,7 @@ public class DIYLCStarter {
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
URL url = DIYLCStarter.class.getResource("log4j.properties");
|
||||
Properties properties = new Properties();
|
||||
try {
|
||||
@@ -43,6 +51,45 @@ public class DIYLCStarter {
|
||||
LOG.error("Could not initialize log4j configuration", e);
|
||||
}
|
||||
|
||||
// Initialize splash screen
|
||||
final SplashScreen splash = SplashScreen.getSplashScreen();
|
||||
if (splash != null) {
|
||||
final Graphics2D g = splash.createGraphics();
|
||||
if (g != null) {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 90; i >= 0; i--) {
|
||||
if (!splash.isVisible())
|
||||
return;
|
||||
final int frame = i;
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
renderSplashFrame(splash, g, frame);
|
||||
splash.update();
|
||||
}
|
||||
});
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
}
|
||||
}
|
||||
|
||||
// try {
|
||||
// Thread.sleep(20000);
|
||||
// } catch (InterruptedException e1) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e1.printStackTrace();
|
||||
// }
|
||||
|
||||
ConfigurationManager.initialize("diylc");
|
||||
|
||||
LOG.debug("Java version: " + System.getProperty("java.runtime.version") + " by "
|
||||
@@ -96,4 +143,68 @@ public class DIYLCStarter {
|
||||
LOG.error("Could not read config.properties file", e);
|
||||
}
|
||||
}
|
||||
|
||||
// Splash screen stuff below
|
||||
|
||||
private static ImageIcon resistor = null;
|
||||
|
||||
public static ImageIcon getResistor() {
|
||||
if (resistor == null) {
|
||||
resistor = (ImageIcon)IconLoader.SplashResistor.getIcon();
|
||||
}
|
||||
return resistor;
|
||||
}
|
||||
|
||||
private static ImageIcon film = null;
|
||||
|
||||
public static ImageIcon getFilm() {
|
||||
if (film == null) {
|
||||
film = (ImageIcon)IconLoader.SplashFilm.getIcon();
|
||||
}
|
||||
return film;
|
||||
}
|
||||
|
||||
private static ImageIcon ceramic = null;
|
||||
|
||||
public static ImageIcon getCeramic() {
|
||||
if (ceramic == null) {
|
||||
ceramic = (ImageIcon)IconLoader.SplashCeramic.getIcon();
|
||||
}
|
||||
return ceramic;
|
||||
}
|
||||
|
||||
private static ImageIcon electrolytic = null;
|
||||
|
||||
public static ImageIcon getElectrolytic() {
|
||||
if (electrolytic == null) {
|
||||
electrolytic = (ImageIcon)IconLoader.SplashElectrolytic.getIcon();
|
||||
}
|
||||
return electrolytic;
|
||||
}
|
||||
|
||||
private static ImageIcon splash = null;
|
||||
|
||||
public static ImageIcon getSplash() {
|
||||
if (splash == null) {
|
||||
splash = (ImageIcon)IconLoader.Splash.getIcon();
|
||||
}
|
||||
return splash;
|
||||
}
|
||||
|
||||
private static Point resistorTarget = new Point(112, 114);
|
||||
private static Point filmTarget = new Point(233, 113);
|
||||
private static Point electrolyticTarget = new Point(261, 23);
|
||||
private static Point ceramicTarget = new Point(352, 22);
|
||||
|
||||
private static int pxPerFrame = 3;
|
||||
|
||||
static void renderSplashFrame(SplashScreen splash, Graphics2D g, int frame) {
|
||||
g.setComposite(AlphaComposite.Clear);
|
||||
getSplash().paintIcon(null, g, 0, 0);
|
||||
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f));
|
||||
getResistor().paintIcon(null, g, resistorTarget.x - pxPerFrame * frame, resistorTarget.y);
|
||||
getFilm().paintIcon(null, g, filmTarget.x, filmTarget.y + pxPerFrame * frame);
|
||||
getElectrolytic().paintIcon(null, g, electrolyticTarget.x, electrolyticTarget.y - pxPerFrame * frame);
|
||||
getCeramic().paintIcon(null, g, ceramicTarget.x + pxPerFrame * frame, ceramicTarget.y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ public enum IconLoader {
|
||||
"flip_horizontal.png"), FlipVertical("flip_vertical.png"), MagicWand("magic_wand.png"), PinGrey("pin_grey.png"), PinGreen(
|
||||
"pin_green.png"), CoffeebeanEdit("coffeebean_edit.png"), ApplicationEdit("application_edit.png"), ComponentAdd(
|
||||
"component_add.png"), History("history.png"), DocumentPlain("document_plain.png"), FitToSize("fit_to_size.png"), DocumentsGear(
|
||||
"documents_gear.png");
|
||||
"documents_gear.png"), SplashResistor("splash_resistor.png"), SplashCeramic("splash_ceramic.png"), SplashElectrolytic(
|
||||
"splash_electrolytic.png"), SplashFilm("splash_film.png"), Splash("splash.png");
|
||||
|
||||
protected String name;
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 6.5 KiB |