Create a splash screen

is there a way of implementing a splash screen without using threads
and would this be negative for ur sistem performance?

when you are using swing or awt, you are using threads and it is a good idea to be aware of that. Read the swing and awt tutorials about this topic.
However, there is no need to create additional threads for a splash screen: Just create the screen (e.g. as a JDialog) and set it visible. Then do your other initialisation work, and if you are ready to display the application, dispose the splash screen dialog. Because AWT and SWING are multithreaded (however not always thread save!), they will paint your dialog in the event handling thread while your main thread is doing more initialisation or whatever else (may be just waiting).

Similar Messages

  • Creating a splash screen for your app.

    Im trying to create a splash screen for my app but im not too sure how it's done.
    Im using the following piece of code.
    public static void main(String[] args)
              JPanel display = new JPanel();
              display.setPreferredSize(new Dimension( (300), (200) ));
              display.setBackground(Color.white);
                   // I WILL PUT AN IMAGE ICON ON A JLABEL HERE              
              display.setVisible(true);
                   // I WILL NEED A DELAY HERE
              test.instance();
    }The problem I am having is that the JPanel is not being displayed. I will also need a way to create a delay, I know that I can't just use Thread.sleep(5000); because the JPanel will require the thread to be running in order to display the panel.
    Does anyone know how I could get my JPanel to display and somehow insert a delay before test.instance();?
    Thanks.

    I made my own a few days before for a database program. It can be easily done with Threads.
    I recommend you create a new class to be used as the spalsh screen , it has to extends JFrame and implements Runnable.
    I ll give you an example. I used the spash screen to display the screen and also to laod the main GUI form so that when the spash screen dispose, the main GUI form displays instantly, making the user think that the application loads faster.
    public void run ()
            try
                 this.setVisible(true);
                 Thread.sleep(2000);
                 // sets the menu visible before disposing
                 guiMenu.setVisible(true);
                 // disposes the object and returns the resources to the OS
                 this.dispose();
            catch(InterruptedException exception)
                exception.printStackTrace();
    // this method must be implement in the class
    // that implements Runnable interface
    //MAIN
    public class Main
        public static void main(String[] args)
            Menu menu = new Menu();
            SplashScreen introScreen = new SplashScreen(menu);
            ExecutorService splashExecutor= Executors.newFixedThreadPool(1);
            splashExecutor.execute(introScreen);       
    }ExecutorService is a subinterface of Executor that declares methods for managing the threads. It also has the method execute (that provides the Executor interface) which when invoked calls the method public void run() of the argument class that must implement Runnable.
    Executors.newFixedThreadPool(1); creates a poll consisting of a 1 thread which is been used by splashExecutor to execute the Runnable.
    Hope i've been of some assistance!

  • How to create a splash screen?

    I was wondering how to create the splash screen that shows up when you just load the program. My program takes a bit to load, because it sets to change the look and feel to system dependent.
    So, I want to have a splash screen like the one that eclipse uses to begin the program. How would I do it?
    Thanks

    Did you search the forum using "splash screen" to find the other hundred threads that have asked this question before?

  • How to create custom splash screen that shows loading %?

    I'd like to add a splash screen to my app. that shows the loading as a percentage.  I have flashbuilder 4.6.  How can I do this?

    You might need to consider adding your child elements in application manually. Displatch a new event back to the application when the child is created (from creationComplete) and update progress bar.

  • How to create desktop application (AIR) splash screen FB 4.7 ?

    Hi.  I am using Flash Builder 4.7 and with the tutorials and the API documentation on Flex by Adobe I can't seem to find a good solution for creating a Splash Screen for an Adobe AIR Desktop application.  I have found some results for mobile applications but I didn't go into those because I am developing for the desktop.  However if some of the moblie results are valid for porting to desktop I will give them a shot.
    Can anyone point me in the right direction?
    Thanks in advance.
    P.S.  If I port to mobile, I will be porting to Android

    Did you try the newly released SDK from official page, rather than labs? I would also suggest running FB with Java 1.6, if you have it on Java 1.7 - FB4.7 is known to yield some quirks with new java VMs.
    Flash Builder is developed on top of Eclipse platform, which is basically a pluggable architecture - nothing wrong with that. Number of files do not really affect the overall application performance. In general you should not touch that, unless you really know what you doing and can manage all the dependencies on your own. I agree, though, that's is quite unfortunate that Adobe decided to hide the AIR SDK deep inside plugins, instead dragging it out to a top-level folder, where it's visible and available for change. It was possible with Flex SDK configured externally, so why not here?

  • Creating a fancy splash screen

    Hi
    Does anyone know how I can create a splash screen like those displayed by Adobe products, e.g.
    http://www.nationmaster.com/wikimir/images/upload.wikimedia.org/wikipedia/en/thumb/e/e0/S-comp-sw-aid-st.jpg/180px-S-comp-sw-aid-st.jpg
    If you look at the image, the butterly wings extend out into the screen.
    I'm not sure how I could add a graphic to a Swing component in order to achieve this, any ideas?
    thanks,
    BBB

    Camickr,
    I tried using the method you suggested but it doesn't seem to work. The JWindow simply gets resized to the JLayeredPane, so I end up with the Gray background of the JWindow instead of it being transparent so that you can see through to the desktop.
    Are you actually sure it's possible using the method you suggested?
    Here's my code:
    public class Splashing extends JWindow {
        public Splashing ()
            ImageIcon oIcon = new javax.swing.ImageIcon(BackgroundLayered.class.getClassLoader().getResource("images/splash_screen.gif"));
            JLabel oLabel = new JLabel(oIcon);
            oLabel.setSize( 500, 500 );
            JLayeredPane oLayer = new JLayeredPane();
            oLayer.add(oLabel, JLayeredPane.FRAME_CONTENT_LAYER, -1);
            oLayer.setPreferredSize( new Dimension(500,500) );
            oLayer.setMaximumSize( oLayer.getPreferredSize() );
            getContentPane().add(oLayer, java.awt.BorderLayout.CENTER);
        public static void main (String args [])
            Splashing oLay = new Splashing();
            oLay.pack();
            oLay.setVisible(true);
    }

  • Creating splash screen

    hi,
    i am creating a splash screen for the very first time. i found an example online i am getting err: class SplashScreen cannot be resolved
    heres the code:
    package com.devdaily.splashscreen;
    import javax.swing.UIManager;
    import javax.swing.ImageIcon;
    public class SplashScreenMain {
    SplashScreen screen;
    public SplashScreenMain() {
    // initialize the splash screen
    splashScreenInit();
    // do something here to simulate the program doing something that
    // is time consuming
    for (int i = 0; i <= 100; i++)
    for (long j=0; j<50000; ++j)
    String poop = " " + (j + i);
    // run either of these two -- not both
    screen.setProgress("Yo " + i, i); // progress bar with a message
    //screen.setProgress(i); // progress bar with no message
    splashScreenDestruct();
    System.exit(0);
    private void splashScreenDestruct() {
    screen.setScreenVisible(false);
    private void splashScreenInit() {
    ImageIcon myImage = new ImageIcon(com.devdaily.splashscreen.SplashScreenMain.class.getResource("SplashImage.gif"));
    screen = new SplashScreen(myImage);
    screen.setLocationRelativeTo(null);
    screen.setProgressMax(100);
    screen.setScreenVisible(true);
    public static void main(String[] args)
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    catch (Exception e) {
    e.printStackTrace();
    new SplashScreenMain();
    can ne body help me with this.
    thanks in advance!

    >
    is it bcoz i am using jdk 1.5...>It sure is.
    If you launch the application using webstart, you can specify a splash screen for earlier versions. There are also a number of third party classes that provide a splash screen - you'd need to search for them, they have been discussed in depth on a number of public forums over the years.

  • Useful Code of the Day:  Splash Screen & Busy Application

    So you are making an Swing application. So what are two common things to do in it?
    1) Display a splash screen.
    2) Block user input when busy.
    Enter AppFrame! It's a JFrame subclass which has a glass pane overlay option to block input (setBusy()). While "busy", it displays the system wait cursor.
    It also supports display of a splash screen. There's a default splash screen if you don't provide a component to be the splash screen, and an initializer runner which takes a Runnable object. The Runnable object can then modify the splash screen component, for example to update a progress bar or text. See the main method for example usage.
    It also has a method to center a component on another component (useful for dialogs) or center the component on the screen.
    NOTE on setBusy: I do recall issues with the setBusy option to block input. I recall it having a problem on some Unix systems, but I can't remember the details offhand (sorry).
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    * <CODE>AppFrame</CODE> is a <CODE>javax.swing.JFrame</CODE> subclass that
    * provides some convenient methods for applications.  This class implements
    * all the same constructors as <CODE>JFrame</CODE>, plus a few others. 
    * Methods exist to show the frame centered on the screen, display a splash
    * screen, run an initializer thread and set the frame as "busy" to block 
    * user input. 
    public class AppFrame extends JFrame implements KeyListener, MouseListener {
          * The splash screen window. 
         private JWindow splash = null;
          * The busy state of the frame. 
         private boolean busy = false;
          * The glass pane used when busy. 
         private Component glassPane = null;
          * The original glass pane, which is reset when not busy. 
         private Component defaultGlassPane = null;
          * Creates a new <CODE>AppFrame</CODE>. 
         public AppFrame() {
              super();
              init();
          * Creates a new <CODE>AppFrame</CODE> with the specified
          * <CODE>GraphicsConfiguration</CODE>. 
          * @param  gc  the GraphicsConfiguration of a screen device
         public AppFrame(GraphicsConfiguration gc) {
              super(gc);
              init();
          * Creates a new <CODE>AppFrame</CODE> with the specified title. 
          * @param  title  the title
         public AppFrame(String title) {
              super(title);
              init();
          * Creates a new <CODE>AppFrame</CODE> with the specified title and
          * <CODE>GraphicsConfiguration</CODE>. 
          * @param  title  the title
          * @param  gc     the GraphicsConfiguration of a screen device
         public AppFrame(String title, GraphicsConfiguration gc) {
              super(title, gc);
              init();
          * Creates a new <CODE>AppFrame</CODE> with the specified title and
          * icon image. 
          * @param  title  the title
          * @param  icon   the image icon
         public AppFrame(String title, Image icon) {
              super(title);
              setIconImage(icon);
              init();
          * Creates a new <CODE>AppFrame</CODE> with the specified title and
          * icon image. 
          * @param  title  the title
          * @param  icon  the image icon
         public AppFrame(String title, ImageIcon icon) {
              this(title, icon.getImage());
          * Initializes internal frame settings. 
         protected void init() {
              // set default close operation (which will likely be changed later)
              setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
              // set up the glass pane
              glassPane = new JPanel();
              ((JPanel)glassPane).setOpaque(false);
              glassPane.addKeyListener(this);
              glassPane.addMouseListener(this);
          * Displays a new <CODE>JWindow</CODE> as a splash screen using the
          * specified component as the content.  The default size of the
          * component will be used to size the splash screen.  See the
          * <CODE>showSplash(Component, int, int)</CODE> method description for
          * more details. 
          * @param  c  the splash screen contents
          * @return  the window object
          * @see  #showSplash(Component, int, int)
          * @see  #hideSplash()
         public JWindow showSplash(Component c) {
              return showSplash(c, -1, -1);
          * Displays a new <CODE>JWindow</CODE> as a splash screen using the
          * specified component as the content.  The component should have all
          * the content it needs to display, like borders, images, text, etc. 
          * The splash screen is centered on monitor.  If width and height are
          * <CODE><= 0</CODE>, the default size of the component will be used
          * to size the splash screen. 
          * <P>
          * The window object is returned to allow the application to manipulate
          * it, (such as move it or resize it, etc.).  However, <B>do not</B>
          * dispose the window directly.  Instead, use <CODE>hideSplash()</CODE>
          * to allow internal cleanup. 
          * <P>
          * If the component is <CODE>null</CODE>, a default component with the
          * frame title and icon will be created. 
          * <P>
          * The splash screen window will be passed the same
          * <CODE>GraphicsConfiguration</CODE> as this frame uses. 
          * @param  c  the splash screen contents
          * @param  w  the splash screen width
          * @param  h  the splash screen height
          * @return  the window object
          * @see  #showSplash(Component)
          * @see  #hideSplash()
         public JWindow showSplash(Component c, int w, int h) {
              // if a splash window was already created...
              if(splash != null) {
                   // if it's showing, leave it; else null it
                   if(splash.isShowing()) {
                        return splash;
                   } else {
                        splash = null;
              // if the component is null, then create a generic splash screen
              // based on the frame title and icon
              if(c == null) {
                   JPanel p = new JPanel();
                   p.setBorder(BorderFactory.createCompoundBorder(
                        BorderFactory.createRaisedBevelBorder(),
                        BorderFactory.createEmptyBorder(10, 10, 10, 10)
                   JLabel l = new JLabel("Loading application...");
                   if(getTitle() != null) {
                        l.setText("Loading " + getTitle() + "...");
                   if(getIconImage() != null) {
                        l.setIcon(new ImageIcon(getIconImage()));
                   p.add(l);
                   c = p;
              splash = new JWindow(this, getGraphicsConfiguration());
              splash.getContentPane().add(c);
              splash.pack();
              // set the splash screen size
              if(w > 0 && h > 0) {
                   splash.setSize(w, h);
              } else {
                   splash.setSize(c.getPreferredSize().width, c.getPreferredSize().height);
              centerComponent(splash);
              splash.show();
              return splash;
          * Disposes the splash window. 
          * @see  #showSplash(Component, int, int)
          * @see  #showSplash(Component)
         public void hideSplash() {
              if(splash != null) {
                   splash.dispose();
                   splash = null;
          * Runs an initializer <CODE>Runnable</CODE> object in a new thread. 
          * The initializer object should handle application initialization
          * steps.  A typical use would be:
          * <OL>
          *   <LI>Create the frame.
          *   <LI>Create the splash screen component.
          *   <LI>Call <CODE>showSplash()</CODE> to display splash screen.
          *   <LI>Run the initializer, in which: 
          *   <UL>
          *     <LI>Build the UI contents of the frame.
          *     <LI>Perform other initialization (load settings, data, etc.).
          *     <LI>Pack and show the frame.
          *     <LI>Call <CODE>hideSplash()</CODE>.
          *   </UL>
          * </OL>
          * <P>
          * <B>NOTE:</B>  Since this will be done in a new thread that is
          * external to the event thread, any updates to the splash screen that
          * might be done should be triggered through with
          * <CODE>SwingUtilities.invokeAndWait(Runnable)</CODE>. 
          * @param  r  the <CODE>Runnable</CODE> initializer
         public void runInitializer(Runnable r) {
              Thread t = new Thread(r);
              t.start();
          * Shows the frame centered on the screen. 
         public void showCentered() {
              centerComponent(this);
              this.show();
          * Checks the busy state.
          * @return  <CODE>true</CODE> if the frame is disabled;
          *          <CODE>false</CODE> if the frame is enabled
          * @see  #setBusy(boolean)
         public boolean isBusy() {
              return this.busy;
          * Sets the busy state.  When busy, the glasspane is shown which will
          * consume all mouse and keyboard events, and a wait cursor is
          * set for the frame. 
          * @param  busy  if <CODE>true</CODE>, disables frame;
          *               if <CODE>false</CODE>, enables frame
          * @see  #getBusy()
         public void setBusy(boolean busy) {
              // only set if changing
              if(this.busy != busy) {
                   this.busy = busy;
                   // If busy, keep current glass pane to put back when not
                   // busy.  This is done in case the application is using
                   // it's own glass pane for something special. 
                   if(busy) {
                        defaultGlassPane = getGlassPane();
                        setGlassPane(glassPane);
                   } else {
                        setGlassPane(defaultGlassPane);
                        defaultGlassPane = null;
                   glassPane.setVisible(busy);
                   glassPane.setCursor(busy ?
                        Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR) :
                        Cursor.getDefaultCursor()
                   setCursor(glassPane.getCursor());
          * Handle key typed events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  ke  the key event
         public void keyTyped(KeyEvent ke) {
              ke.consume();
          * Handle key released events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  ke  the key event
         public void keyReleased(KeyEvent ke) {
              ke.consume();
          * Handle key pressed events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  ke  the key event
         public void keyPressed(KeyEvent ke) {
              ke.consume();
          * Handle mouse clicked events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  me  the mouse event
         public void mouseClicked(MouseEvent me) {
              me.consume();
          * Handle mouse entered events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  me  the mouse event
         public void mouseEntered(MouseEvent me) {
              me.consume();
          * Handle mouse exited events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  me  the mouse event
         public void mouseExited(MouseEvent me) {
              me.consume();
          * Handle mouse pressed events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  me  the mouse event
         public void mousePressed(MouseEvent me) {
              me.consume();
          * Handle mouse released events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  me  the mouse event
         public void mouseReleased(MouseEvent me) {
              me.consume();
          * Centers the component <CODE>c</CODE> on the screen. 
          * @param  c  the component to center
          * @see  #centerComponent(Component, Component)
         public static void centerComponent(Component c) {
              centerComponent(c, null);
          * Centers the component <CODE>c</CODE> on component <CODE>p</CODE>. 
          * If <CODE>p</CODE> is null, the component <CODE>c</CODE> will be
          * centered on the screen. 
          * @param  c  the component to center
          * @param  p  the parent component to center on or null for screen
          * @see  #centerComponent(Component)
         public static void centerComponent(Component c, Component p) {
              if(c != null) {
                   Dimension d = (p != null ? p.getSize() :
                        Toolkit.getDefaultToolkit().getScreenSize()
                   c.setLocation(
                        Math.max(0, (d.getSize().width/2)  - (c.getSize().width/2)),
                        Math.max(0, (d.getSize().height/2) - (c.getSize().height/2))
          * Main method.  Used for testing.
          * @param  args  the arguments
         public static void main(String[] args) {
              final AppFrame f = new AppFrame("Test Application",
                   new ImageIcon("center.gif"));
              f.showSplash(null);
              f.runInitializer(new Runnable() {
                   public void run() {
                        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                        f.getContentPane().add(new JButton("this is a frame"));
                        f.pack();
                        f.setSize(300, 400);
                        try {
                             Thread.currentThread().sleep(3000);
                        } catch(Exception e) {}
                        f.showCentered();
                        f.setBusy(true);
                        try {
                             Thread.currentThread().sleep(100);
                        } catch(Exception e) {}
                        f.hideSplash();
                        try {
                             Thread.currentThread().sleep(3000);
                        } catch(Exception e) {}
                        f.setBusy(false);
    "Useful Code of the Day" is supplied by the person who posted this message. This code is not guaranteed by any warranty whatsoever. The code is free to use and modify as you see fit. The code was tested and worked for the author. If anyone else has some useful code, feel free to post it under this heading.

    Hi
    Thanks fo this piece of code. This one really help me
    Deepa

  • Splash screen in developer6.0

    hi everybody!
    please help me out in creating a
    splash screen as that u do in vb.is it
    possible to do it in d2k.if so hou.please let me know.thanks in advance

    how to make a transparent splash screen in VB6.0?
    Hi,
    I would remind you that VB6 issues are not supported in these forums any more, you could refer to the following thread:
    Where to post your VB 6 questions
    You could consider posting this issue in these forums below:
    These forums do not support Visual Basic 6, however there are many third-party support sites that do. If you have a VB6-related question please visit these popular forums:
    VB Forums
    VB City
    Thanks for your understanding.
    In addition, you could also mark any reply as answer which is helpful.
    And VB6 is not supported in these IDEs since VS2003, so if you just want to use the IDE to use VB.Net then you could download the Visual Studio from
    http://www.visualstudio.com/downloads/download-visual-studio-vs by choosing the one fits your requirements. And here are the resources to get start about VB.net:
    http://msdn.microsoft.com/en-us/vstudio/hh388573
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Splash screen in forms4.5

    Hi guys!.
    can i create a splash screen in forms
    as we do in visual basic.if so how.my MDI
    form should also be suppressed while my splash screen is running.
    please help out

    I have a window that is a transactions monitor, what I do is to run a hevy process stored in the database and the window's purpose is to display the process progress, well I Have a MDI application which launches the process and the monitor form, my problem is that I do not want to show the monitor's MDI window and i cannot use USESDI parameter because I have to pass parameters to it (Instead of that I use RUN_PRODUCT command)
    ?Do you have any idea of how can I use SDI with RUN_PRODUCT? (I do not use open_form or call_form because the process and the monitor have to run simultaneously)

  • How can i calculate the percentages and update the progressBar in the splash screen form ?

    I created a splash screen form:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    using System.Threading;
    namespace GetHardwareInfo
    public partial class SplashScreen : Form
    public SplashScreen()
    InitializeComponent();
    private Mutex mutex = new Mutex();
    public void SyncedClose()
    mutex.WaitOne();
    this.Close();
    mutex.ReleaseMutex();
    public void UpdateProgressBar(int percentage)
    if (this.InvokeRequired)
    mutex.WaitOne();
    if (!IsDisposed)
    this.BeginInvoke(new Action<int>(UpdateProgresPRV), percentage);
    mutex.ReleaseMutex();
    else
    UpdateProgresPRV(percentage);
    private void UpdateProgresPRV(int per)
    if (progressBar1.IsDisposed) return;
    progressBar1.Value = per;
    private void SplashScreen_Load(object sender, EventArgs e)
    The SplashScreen form have in the designer image and on the image a progressBar1.
    Then in form1 i did in the top:
    List<string> WmiClassesKeys = new List<string>();
    IEnumerable<Control> controls;
    string comboBoxesNames;
    SplashScreen splash = new SplashScreen();
    And in the constructor:
    controls = LoopOverControls.GetAll(this, typeof(ComboBox));
    string[] lines = File.ReadAllLines(@"c:\wmiclasses\wmiclasses1.txt");
    foreach (string line in lines)
    foreach (ComboBox comboBox in controls.OfType<ComboBox>())
    if (line.StartsWith("ComboBox"))
    comboBoxesNames = line.Substring(14);
    else
    if (line.StartsWith("Classes"))
    if (comboBox.Name == comboBoxesNames)
    comboBox.Items.Add(line.Substring(14));
    foreach (ComboBox comboBox in controls.OfType<ComboBox>())
    comboBox.SelectedIndex = 0;
    The method GetAll is to loop over specific controls:
    public static IEnumerable<Control> GetAll(Control control, Type type)
    var controls = control.Controls.Cast<Control>();
    return controls.SelectMany(ctrl => GetAll(ctrl, type))
    .Concat(controls)
    .Where(c => c.GetType() == type);
    When i'm running the program it's taking some time to make the foreach loops in this time i need to show the SplashScreen and update the progressBar untill the foreach loops over.

    Don't use Application.Doevents. It's not required and can cause problems.
    I do not really grasp the approach you are taking here. So let me make a different suggestion:
    SplashScreen:
    using System;
    using System.Windows.Forms;
    using System.Threading;
    namespace WindowsFormsApplication1
    public partial class SplashScreen : Form
    private static SplashScreen DefaultInstance;
    public SplashScreen()
    InitializeComponent();
    public static void ShowDefaultInstance()
    Thread t = new Thread(TMain);
    t.Name = "SplashUI";
    t.Start();
    public static void CloseDefaultInstance()
    DefaultInstance.Invoke(new Action(DefaultInstance.Close));
    private static void TMain()
    DefaultInstance = new SplashScreen();
    DefaultInstance.Show();
    Application.Run(DefaultInstance);
    public static void UpdateProgress(int Progress)
    if (DefaultInstance.InvokeRequired)
    DefaultInstance.Invoke(new Action<int>(UpdateProgress), Progress);
    else
    DefaultInstance.progressBar1.Value = Progress;
    Form1:
    using System.Windows.Forms;
    namespace WindowsFormsApplication1
    public partial class Form1 : Form
    public Form1()
    InitializeComponent();
    SplashScreen.ShowDefaultInstance();
    for (int i = 1; i<=100; i++)
    System.Threading.Thread.Sleep(20); // simulates work
    SplashScreen.UpdateProgress(i);
    SplashScreen.CloseDefaultInstance();
    EDIT: Please note that the progressbar itself is being animated by the system, so it might look slower than it really is. To workaround this, there are solutions available (you'll find them) that first set the value one higher than necessary, then
    back to the actual value.
    Edit #2: You do need a different thread, otherwise the UI is locked while the loop is running in your Form1's constructor.
    Armin

  • Removing Splash Screen using button in Movieclip

    Hi
    I have created a shooting game and I am struggling to create a splash screen at the beginning informing the user of
    the controls with a button to start the game, which removes the splash screen. I am trying to add the splash screen in the main timeline
    using addChild event. I can get the splash screen to appear on the game and remove it when the playgame button is pressed, but this
    prevents all the other event listeners so I am not able to fire or move the ship.
    In the splash screen I have the code :
    Play_btn.addEventListener(MouseEvent.CLICK,playgame)
    function playgame(e:Event):void
    Play_btn.removeEventListener(MouseEvent.CLICK,playgame)
    parent.removeChild(this);
    and in the main timeline I have :
    addChild(splashscreen);
    Can anyone give me some guidance, thanks for reading this

    Hi
    thanks for taking the time, I don't know how to upload the fla so here is my code.
    The code in the splashscreen MovieClip, which has a button called Play_btn is :
    Play_btn.addEventListener(MouseEvent.CLICK,playgame);
    function playgame(e:Event):void
    parent.removeChild(this);
    Play_btn.removeEventListener(MouseEvent.CLICK,playgame)
    and the code in the main timeline is :
    //import some important flash libraries.
    import flash.events.KeyboardEvent;
    import flash.events.Event;
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.sampler.Sample;
    var score:Number=0;
    var countCollisions:Number =0;
    var astArray:Array = new Array();
    var enemyshipArray = new Array();
    var enemybulletArray = new Array();
    var explosionArray = new Array()
    var speed:Number = 10;
    var key_left:Boolean = false;
    var key_right:Boolean = false;
    var key_up:Boolean = false;
    var key_down:Boolean = false;
    var key_space:Boolean = false;
    var shootLimiter:Number=0;
    var splashscreen:MovieClip = new Splash();
    //Play_btn.addEventListener(MouseEvent.CLICK,playgame);
    splashscreen.x = 0;
    splashscreen.y = 0;
    addChild(splashscreen);
    //removeChild(splashscreen);
    background.addEventListener(Event.ENTER_FRAME,backgroundmove);
    function backgroundmove(e:Event):void
    background.x -= 1;
    if(background.x < -200)
    background.x = 749.95;
    this is how you can comment over a number
    of different lines
    var timer:Timer = new Timer(1000, 10);
    timer.addEventListener(TimerEvent.TIMER, AddAsteroid);
    timer.start();
    var timerenemyship:Timer = new Timer(2000, 10);
    timerenemyship.addEventListener(TimerEvent.TIMER, Addenemyship);
    timerenemyship.start();
    stage.addEventListener(KeyboardEvent.KEY_DOWN,KeyDown);
    stage.addEventListener(KeyboardEvent.KEY_UP,KeyUp);
    var ship:MovieClip = new Ship()
    var enemyship:MovieClip = new EnemyShip()
    addChild(ship);
    function Addenemyship(e:TimerEvent):void
    var enemybullettimer:Timer = new Timer(2000, 10);
    enemybullettimer.addEventListener(TimerEvent.TIMER, Addenemybullet);
    var enemyship:MovieClip = new EnemyShip();   
    enemyship.x = 800;
    enemyship.y = Math.round(Math.random()*400);
    enemyshipArray.push(enemyship); 
    addChild(enemyship);
    enemybullettimer.start();
    function Addenemybullet(e:TimerEvent):void
    var enemybullet:MovieClip = new EnemyBullet();
    enemybullet.x = enemyship.x+50;
    enemybullet.y = enemyship.y+50;
    enemybulletArray.push(enemybullet);  
    addChild(enemybullet);
    enemybullet.addEventListener(Event.ENTER_FRAME,moveenemybullet);
    function moveenemybullet(e:Event):void
    enemybullet.x -=30;
        if(enemybullet.hitTestObject(ship))
       removeChild(ship);
    enemyship.addEventListener(Event.ENTER_FRAME,enemyshipmove);
    function enemyshipmove(e:Event):void
    enemyship.x -=10;
    for(var i=0; i<enemyshipArray.length; i++)
         if(enemyshipArray[i].hitTestObject(ship))
    // EXPLOSION
    var explosion:MovieClip = new Explosion();
    addChild(explosion);
    explosion.x =ship.x;
    explosion.y = ship.y;
    explosionArray.push(explosion);
    for (var l:int=0; l<explosionArray.length; l++)
    if (explosionArray[l].currentFrame == 10)
    removeChild(explosionArray[l]);
    explosionArray.splice(l,1);
    // END OF EXPLOSION  
            MovieClip(enemyshipArray[i]).removeEventListener(Event.ENTER_FRAME, enemyshipmove);
            removeChild(enemyshipArray[i]);
            enemyshipArray.splice(i, 1);
            countCollisions++;
             if(countCollisions >= 2)
             ship.gotoAndPlay(87);
       else
             ship.gotoAndPlay(6);
    function AddAsteroid(e:TimerEvent):void
    var asteroid:MovieClip = new Asteroid();   
    asteroid.x = 800;
    asteroid.y = Math.round(Math.random()*700);
    astArray.push(asteroid);  
    addChild(asteroid);
    asteroid.addEventListener(Event.ENTER_FRAME,asteroidmove);   
    function asteroidmove(e:Event):void
    asteroid.x--
    for(var i=0; i<astArray.length; i++)
         if(astArray[i].hitTestObject(ship))
            MovieClip(astArray[i]).removeEventListener(Event.ENTER_FRAME, asteroidmove);
            removeChild(astArray[i]);
            astArray.splice(i, 1);
            countCollisions++;
             if(countCollisions >= 4)
              ship.gotoAndPlay(87);
       //removeChild(ship);
       else
             ship.gotoAndPlay(6);
    addEventListener(Event.ENTER_FRAME,Main);
    function Main(event:Event)
    CheckKeys();
    function KeyDown(event:KeyboardEvent)
    if(event.keyCode == 37){  //checks if left arrowkey is pressed.
      key_left = true;
    if(event.keyCode == 39){  //checks if right arrowkey is pressed.
      key_right = true;
    if(event.keyCode == 38){  //checks if up arrowkey is pressed.
      key_up = true;
    if(event.keyCode == 40){  //checks if down arrowkey is pressed.
      key_down = true;
    if(event.keyCode == 32){  //checks if down arrowkey is pressed.
      key_space = true;
    function KeyUp(event:KeyboardEvent){
    if(event.keyCode == 37){  //checks if left arrowkey is released.
      key_left = false;
    if(event.keyCode == 39){  //checks if right arrowkey is released.
      key_right = false;
    if(event.keyCode == 38){  //checks if up arrowkey is released.
      key_up = false;
    if(event.keyCode == 40){  //checks if down arrowkey is released.
      key_down = false;
    if(event.keyCode == 32){  //checks if down arrowkey is released.
      key_space = false;
    function CheckKeys()
    shootLimiter += 1;
    if(key_left)
      setDirection(1);
      ship.x -= 5;
    if(key_right)
      setDirection(0);
      ship.x += 5;
    if(key_up){
      ship.y -= 5;
    if(key_down){
      ship.y += 5;
    if((key_space) && (shootLimiter > 8))
    shootLimiter = 0;
    var b = new Bullet();
    addChild(b);
    // ADD SOUND
    var bulletsound:Sound=new SoundEnemyShot()
        bulletsound.play();
    // END SOUND
    b.x = ship.x + 50;
    b.y = ship.y + 3;
    addEventListener(Event.ENTER_FRAME,moveBullet);
    function moveBullet(e:Event):void
    b.x +=10;
      if(b.x > 600)
       if(contains(b))
       removeChild(b);
              removeEventListener(Event.ENTER_FRAME,moveBullet);
      for(var i=0; i<astArray.length; i++)
       if(astArray[i].hitTestObject(b))
       removeChild(b);
       removeChild(astArray[i]);
          score +=10;
       score_txt.text = score.toString() ;
       removeEventListener(Event.ENTER_FRAME,moveBullet);
    for(var i=0; i<enemyshipArray.length; i++)
      if(enemyshipArray[i].hitTestObject(b))
      removeChild(b);
      removeChild(enemyshipArray[i]);
            enemyshipArray.splice(i, 1);
      MovieClip(enemyshipArray[i]).removeEventListener(Event.ENTER_FRAME, moveBullet);
    function setDirection(param) {
    if (param == 0) {
      ship.scaleX = 1;
    } else {
      ship.scaleX = -1;

  • Drop Shadow for Windows Splash Screen

    Hi,
    I need to create a splash screen for a client who is a Windows software developer.
    I'm working on a Mac with Photoshop CS3.
    It's simple enough given that I just have to create a 320x240 image and send it over to them.
    However what I'd like to do is add a drop shadow to the graphic which shows up with transparency when the splash screen appears on the Windows desktop.
    Any clues?
    Thanks.

    With what technology is the developer working? . . . Pass.
    What file formats can they accept? . . . I'll give PNG24 a go on a dummy graphic and ask them to try it.
    Thanks.
    Bob.

  • Splash screen: some doubts...

    I've read tutorial but I don't understand two things:
    1) Is possible to create a splash screen passing the image directly in the code? Without using jar o line command...
    2) How can I specify the time I want to show the splash screen before the start of the real application?
    Thanks,
    Maurizio

    Using an image for a Splash Screen without using the Manifest file
    I am posting this information, as I too (like the owner of this post and many others), were looking for an alternative to specifying the image location in a manifest file.
    Solution:
    JLabel label = new JLabel();
    label.setIcon(new ImageIcon(getClass().getResource("images/load.gif")) );Hope that helped!

  • Wifi splash screen

    Many years ago, when I first set up an Apple wireless device it allowed me to create a splash screen that displays a few words whenever a Mac connects to my wifi network. I have progressively upgraded my network and each time the Airport utility has prompted me to migrate the old settings. This has included the splash screen which still appears.
    However recent Airport apps do not have the options for creating (or deleting!) a splash screen. Is there another way (eg Terminal commands) to do this?

    My set up is a little more complicated. I have 2 time capsules at different ends of the house. With Airport Utility 5.5.1 I went to the settings of the "slave" time capsule and could not find the DHCP tab. But of course it only appears on the master time capsule (that is connected to my cable modem). Sure enough when I went to the settings for that device the DHCP tab and the DHCP Message field appeared and could be edited.
    I was hoping to be able to customise the message so I knew if I was connecting to the slave or master but that is not possible with the DHCP system. Instead I just have to hold the option key when clicking on the wifi icon and remember the BSSID for each device.
    Thank you for solving my puzzle.
    It is irritating that a simple feature like a splash screen gets drops in software upgrades.

Maybe you are looking for