From: Bill Kuker Date: Sun, 28 Nov 2010 21:28:47 +0000 (+0000) Subject: Updated Splash X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=5e49458797abc4191a2465bd38ad05ebb80db652;p=sw%2Fmotorsim Updated Splash --- diff --git a/gui/MotorSim.java b/gui/MotorSim.java index 3352311..8dd1c11 100644 --- a/gui/MotorSim.java +++ b/gui/MotorSim.java @@ -16,9 +16,9 @@ public class MotorSim { } catch (Exception e1) { e1.printStackTrace(); } - SplashWindow3 sw = new SplashWindow3("splash.png",null, 4000); + new Splash("splash.png",null, 2000); final MotorWorkbench mw = new com.billkuker.rocketry.motorsim.visual.workbench.MotorWorkbench(); - Thread.sleep(4000); + Thread.sleep(2000); SwingUtilities.invokeLater(new Runnable(){ @Override public void run() { diff --git a/gui/Splash.java b/gui/Splash.java new file mode 100644 index 0000000..37184f6 --- /dev/null +++ b/gui/Splash.java @@ -0,0 +1,56 @@ +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Toolkit; + +import javax.swing.ImageIcon; +import javax.swing.JLabel; +import javax.swing.JWindow; +import javax.swing.SwingUtilities; + +import com.billkuker.rocketry.motorsim.visual.workbench.MotorWorkbench; + +class Splash extends JWindow { + private static final long serialVersionUID = 1L; + + public Splash(String resName, Frame f, int waitTime) { + super(f); + JLabel l = new JLabel(new ImageIcon(this.getClass() + .getResource(resName))); + add(l); + pack(); + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + Dimension labelSize = l.getPreferredSize(); + setLocation(screenSize.width / 2 - (labelSize.width / 2), + screenSize.height / 2 - (labelSize.height / 2)); + final int pause = waitTime; + setVisible(true); + new Thread(new Runnable() { + public void run() { + try { + Thread.sleep(pause); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + setVisible(false); + dispose(); + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + } + }, "SplashThread").start(); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + g.setFont(new Font(Font.DIALOG, Font.BOLD, 14)); + g.drawString("Version " + MotorWorkbench.version, 140, 150); + } + + public static void main(String args[]) { + new Splash("splash.png", null, 1000); + } +} diff --git a/gui/SplashWindow3.java b/gui/SplashWindow3.java deleted file mode 100644 index 86a8a85..0000000 --- a/gui/SplashWindow3.java +++ /dev/null @@ -1,55 +0,0 @@ -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Frame; -import java.awt.Toolkit; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; - -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JWindow; -import javax.swing.SwingUtilities; -class SplashWindow3 extends JWindow { - public SplashWindow3(String resName, Frame f, int waitTime) { - super(f); - JLabel l = new JLabel(new ImageIcon(this.getClass().getResource(resName))); - getContentPane().add(l, BorderLayout.CENTER); - pack(); - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - Dimension labelSize = l.getPreferredSize(); - setLocation(screenSize.width / 2 - (labelSize.width / 2), screenSize.height / 2 - (labelSize.height / 2)); - addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { - setVisible(false); - dispose(); - } - }); - final int pause = waitTime; - final Runnable closerRunner = new Runnable() { - public void run() { - setVisible(false); - dispose(); - } - }; - Runnable waitRunner = new Runnable() { - public void run() { - try { - Thread.sleep(pause); - SwingUtilities.invokeAndWait(closerRunner); - } catch (Exception e) { - e.printStackTrace(); - // can catch InvocationTargetException - // can catch InterruptedException - } - } - }; - setVisible(true); - Thread splashThread = new Thread(waitRunner, "SplashThread"); - splashThread.start(); - } - - - public static void main(String args[]) { - SplashWindow3 sw = new SplashWindow3("splash.png",null, 4000); - } -} diff --git a/gui/com/billkuker/rocketry/motorsim/visual/workbench/MotorWorkbench.java b/gui/com/billkuker/rocketry/motorsim/visual/workbench/MotorWorkbench.java index c2c4031..e1dd52a 100644 --- a/gui/com/billkuker/rocketry/motorsim/visual/workbench/MotorWorkbench.java +++ b/gui/com/billkuker/rocketry/motorsim/visual/workbench/MotorWorkbench.java @@ -17,7 +17,8 @@ import com.billkuker.rocketry.motorsim.visual.RememberJFrame; public class MotorWorkbench extends RememberJFrame { - public static final String name = "MotorSim 2.0 BETA"; + public static final String version = "2.0 BETA"; + public static final String name = "MotorSim " + version; private static final long serialVersionUID = 1L; private MultiMotorThrustChart mb; diff --git a/gui/splash.png b/gui/splash.png index 3e627da..923eedf 100644 Binary files a/gui/splash.png and b/gui/splash.png differ diff --git a/motorsim.svg b/motorsim.svg index bbf1c56..ac677c2 100644 --- a/motorsim.svg +++ b/motorsim.svg @@ -10,12 +10,15 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="320" - height="240" - id="svg2" - version="1.1" + inkscape:export-ydpi="90" + inkscape:export-xdpi="90" + inkscape:export-filename="C:\src\BillKuker\MotorSim\gui\splash.png" + sodipodi:docname="motorsim.svg" inkscape:version="0.48.0 r9654" - sodipodi:docname="motorsim.svg"> + version="1.1" + id="svg2" + height="240" + width="320"> - + + showgrid="true" + inkscape:window-width="1490" + inkscape:window-height="1003" + inkscape:window-x="186" + inkscape:window-y="-4" + inkscape:window-maximized="1" + borderlayer="true" + objecttolerance="20" /> @@ -97,76 +101,72 @@ inkscape:groupmode="layer" id="layer1" transform="translate(0,-812.36218)"> - - - - - - - - - - - + + + + + + + + + MotorSim - 2.0 BETA (c)2010 Bill Kuker + x="234.28355" + y="1046.5485">(c)2010 Bill Kuker +