package org.multibit.hd.ui.views;

import org.multibit.hd.ui.views.components.Images;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 * <p>Java AWT Frame to provide the following to startup sequence:</p>
 * <ul>
 * <li>A quick rendering splash screen image</li>
 * </ul>
 *
 * @since 0.0.8
 *  
 */
public class SplashScreen extends Frame {

  private final transient Image image;

  public SplashScreen() throws HeadlessException {

    setLayout(new FlowLayout());
    setUndecorated(true);

    image = Images.newSplashScreenIconImage();
    setSize(image.getWidth(null), image.getHeight(null));

    setLocationRelativeTo(null);

    addWindowListener(
      new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
          System.exit(0);
        }
      });

    setVisible(true);

  }

  @Override
  public void paint(Graphics g) {
    super.paint(g);
    g.drawImage(image, 0, 0, this);
  }
}

@@ -76,24 +76,54 @@
 ts.Images;%0A%0A
+import javax.imageio.ImageIO;%0A
 import java.
@@ -129,16 +129,16 @@
 .awt.*;%0A
-
 import j
@@ -200,16 +200,72 @@
 owEvent;
+%0Aimport java.io.IOException;%0Aimport java.io.InputStream;
 %0A%0A/**%0A *
@@ -631,50 +631,394 @@
     
-image = Images.newS
+// Inline the image access to avoid a Swing EDT violation during construction%0A    try (InputStream is = Images.class.getResourceAsStream(%22/assets/images/s
 plash
-S
+-s
 creen
-IconImage();
+.png%22)) %7B%0A%0A      // Transform the mask color into the current themed text%0A      image = ImageIO.read(is);%0A%0A    %7D catch (IOException e) %7B%0A      throw new IllegalStateException(%22The splash screen image is missing%22);%0A    %7D%0A
 %0A   

Fix issue with EDT violation occurring during FEST tests