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!

Similar Messages

  • Nokia Lumia: Create a start screen for your kids .

    >

    And the code for the button would be:
    EnterScreen.EnterBtn.addEventListener(MouseEvent.CLICK, enterGame);
    function enterGame(event: MouseEvent): void
                EnterScreen.PlayBtn.removeEventListener(MouseEvent.CLICK, enterGame);
                 removeChild(EnterScreen); //(or EnterScreen.visible = false)
                GameScreen.visible = true;
    where the "EnterScreen" is the name of the startup MoveiClip and the "GameScreen" is the name of the MovieClip which contains the game.

  • Getting increasingly frequent system shutdown with appearance of the apple splash screen for several minutes then back to logon in the middle of using a variety of APPs or just walking on Safari.

    Using an IPAD 2 running 5.0.1 is frequently shutting down in the middle of a variety of Apps and showing the Apple splash screen for several minutes. This happens occasionally at inopportune times. Once the splash screen clears it goes back to the logon screen and the App that was open is closed. Has anyone else encountered this? Is there a resolution?

    RockHunter wrote:
    This happens occasionally at inopportune times.
    I don't think that there is ever a good time for this to occur.
    What do you mean the Apple splash screen? You see the Apple logo on the screen?
    It appears as though your apps are crashing. Have you tried quitting apps and restarting? Reset the iPad?
    Quit all apps and restart. Go to the home screen first by tapping the home button. Quit/close open apps by double tapping the home button and the task bar will appear with all of you recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner to close the apps. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

  • Lightroom won't boot -I only get the splash screen for a second.

    I do have the photographers version of the Creative Cloud which included Photoshop CC 2014 and Lightroom. Everything was working just fine until I upgraded to Lightroom version 5.6. Now when I try to load LR, the slash screen shows for a second then disappears and LR does not load. This occurs on both my Mac (a Mac Pro and a iMac). I uninstalled LR and had creative cloud reinstall but still the same thing is happening  - Splash screen for a second then nothing. Again, this is happening on both Mac's. Photoshop CC 2014 I working just fine.
    Before I call Adobe, any ideas here on this issue. BTW, Creative Cloud App states LR in up to date and installed.
    Thanks
    James

    Hi PBAYARD,
    I see that you are experiencing an issue with your iPod classic. Here is an article for you that will hep you through some troubleshooting steps regarding this issue:
    iPod: No power or frozen - Apple Support
    https://support.apple.com/en-us/TS1404
    Take care, and thanks for visiting the Apple Support Communities.
    -Braden

  • 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.

  • OpenSUSE-inspired splash screen for GIMP

    I saw this (old) openSUSE splash screen for GIMP and quite liked it:
    And so I created a new version of it, using Inkscape.  The PNG splash screen should be placed in $HOME/.gimp-2.6/splashes/ (or .gimp-2.7/ if you're using gimp-devel).  The font used is FifthLeg, which is based upon the font used in the openSUSE splash, and can be found in the AUR under otf-fifthleg: http://aur.archlinux.org/packages.php?ID=23740.
    The quick install (original version):
    mkdir -p $HOME/.gimp-2.8/splashes
    wget http://oi43.tinypic.com/s33fo9.jpg -O $HOME/.gimp-2.8/splashes/gimp-splash.png
    Here is the SVG file, in case you want to scale it up/down or change anything for your usage:
    http://www.mdn.fm/files/100696_f4f0h/gimp-splash.svg
    Screenshot:
    EDIT: Switched image hosting from ImageShack to TinyPic ... ImageShack has been very unreliable in the past few years.
    EDIT: Updated links (TinyPic is forcing the extension to JPG for whatever reason, but the file itself is a PNG). SVG link is dead.
    Last edited by MkFly (2015-05-27 15:33:01)

    Anonymo wrote:But you used Inkscape to make it? 
    Yes, I appreciate the irony there.  I wanted it to be easily scalable, and I didn't want to make some gigantic XCF.
    That and, I wanted to learn a little more about Inkscape.  The combination of the two (GIMP, Inkscape) is outstanding.
    Last edited by MkFly (2010-05-17 15:58:34)

  • How to create an apple id for your child

    how to create an apple id for your child

    You can create an id without accredit card that might be what you want.  Ten use that ID for your child's iMessage and iCloud and use your ID for iTunes and App Store on both phones. That way you can control what is purchased.  I would set up restrictions on the kid's phone with a pun that you only know and durn off in app purchases

  • I had my ipod touch 4th generation plugged into my sterio and i tried to swipe open my pinger app and now its stuck on the load screen for the app and wont do anything at all its frozen. How do I fix it??

    I had my ipod touch 4th generation plugged into my sterio and i tried to swipe open my pinger app and now its stuck on the load screen for the app and wont do anything at all its frozen. How do I fix it??

    Reset your iPod. Hold the power and the home button for 10 seconds till the iPod restarts. No data will be lost.

  • Chromeless splash screen for application

    hi!
    Anyone know how to create a Chromeless splash screen for java application.Just like the startup screen for the normal application? When the java application start-up the screen will show, it's close after a few screen or user click a button.
    and is there anyway to add background image for a java application?
    Thank in advance!
    jet

    hi there, check a look at this code:
    import javax.swing.*;
    import java.awt.*;
    public class Splash implements Runnable, mainInterface{
    private String initMsg;
    public Splash(String initMsg) {
    this.initMsg = initMsg;
    public void run() {
    splashWindow.getContentPane().add(l, BorderLayout.CENTER);
    splashWindow.pack();
    splashWindow.setSize(splashWindow.getSize().width, splashWindow.getSize().height);
    splashWindow.setLocation(dim.width/2 - splashWindow.getWidth() /2,dim.height/2 -
    splashWindow.getHeight()/2);
    splashWindow.toFront();
    splashWindow.show(); }
    public JWindow getWindow()
    return splashWindow;
    }add this code to the main file
    private static void splash()
              th.start(); // I sleep to let the thread startup and display the window
                   while (splash3.getWindow() == null || !splash3.getWindow().isShowing())
                        try {
                             Thread.sleep(2000);
                        catch (InterruptedException e){}
         }hope u understand this
    asrar

  • HT204003 does the passbook app work on the iPhone4 because I downloaded the apps for it but I continue to see the original screen for the app and I can't find passbook in my settings.

    does the passbook app work on the iPhone4 because I downloaded the apps for it but I continue to see the original screen for the app and I can't find passbook in my settings.

    Some time in the future (Starbucks Tweeted the other day "by the end of the month") the Starbucks app will be Passbook enabled. When that time comes, you will log into the app with your credentials, select your Starbucks card, and you should be given an opportunity to add that card to Passbook at that time. From there, whenever you walk into a Starbucks the alert will be displayed on the lock screen, just slide your finger across the the alert and show your card to pay.
    Now, I have not seen the new app, of course, so I am just speculating based on how the Walgreens, Fandango and Target apps work. Also, I am not sure yet if this will work in any Starbucks, or just the one that you consider your favorite, or primary location. Again, that is just based on how the other apps seem to work. We'll see.

  • How to create a single login for multiple apps on tomcat server?

    Hello,
    I am running the most recent versions of apache and tomcat on several dells with XP pro.
    When I login to an app I have created, a session variable is set, but when I browse to one of the other apps on the same computer, it does not recognize that the session variable has been set and I have to login again.
    Can somebody please suggest how, or where I can find docs, to configure tomcat to pass the session variables to other apps?
    Thank you very much.
    Or, can anybody suggest the most effective strategy for creating single-logon functionality for multiple apps with tomcat and apache running on one computer? and with tomcat and apache running on multiple computers? (i.e., each computer has tomcat and apache integrated).
    The database is Oracle 10g running on each computer.
    Thank you again.

    A good place to start is http://www.javaworld.com/javaworld/javatips/jw-javatip34.html
    Also, do a search in this forum on HttpURLConnection. That class allows you to use POST method to send form data to a web server.
    "Hidden" variables are only hidden in HTML. The HTTP that gets POSTed to the web server doesn't distinguish between hidden and not hidden. That is, the content you would write to the HttpURLConnection.getOutputStream() would be something like:
    hidden=1&submit=ok(Of course, the variable names would depend on what the web server was expecting from the form.)
    Also, be sure to set the Content-Type request parameter to "application/x-www-form-urlencoded"

  • 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?

  • You sent me a notice letting me know that adobe forms central will not continue any more. What tool will replace it? How can I continue creating forms? Thanks for your responses.

    You sent me a notice letting me know that adobe forms central will not continue any more. What tool will replace it? How can I continue creating forms? Thanks for your responses.

    Hello Chalo,
    There are many FormsCentral alternatives. Our solution, JotForm, has the most complete Import Wizard both for your forms and for your response database.
    http://www.jotform.com/formscentral/

  • Downloaded photoshop elements 12, installed ok and activated, started it and splash screen displayed and app launched then shutdown

    Downloaded photoshop elements 12, installed ok and activated, started it and splash screen displayed and app launched then shutdown immediately.
    Repeat and crashes again. Help it won't start!

    Solved! Tried everything in the support documents and none of it worked. Massive frustration with Adobe Chat staff who know nothing and just kept telling me to look at the support documents over and over. They also gave me a contact number in Australia that has a recorde d message saying the product is not supported! What is that about?
    Finally Anand from Adobe tech support called me (from when I reopened the original support case that gave me the serial number).
    Just had to rename folder SLCache in c:\program files(x86) and reaccept the EULA and reactive. Now everything works fine. Way to hard.

  • To display splash screen for certian period of time using threads

    i want to write a program to display splash screen for certian period of time using threads. could some one help me

    If you just want a splash screen: [http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/splashscreen/|http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/splashscreen/]
    If you want to learn threads: [http://java.sun.com/docs/books/tutorial/essential/concurrency/|http://java.sun.com/docs/books/tutorial/essential/concurrency/]

Maybe you are looking for

  • When receiving an email, I can't open it.

    When I receive an email, like from the Breast Cancer site, with a spot to click on for free mammograms, a little circle keeps turning around, but it never opens up, so I can click on the free mammogram site. Also, on facebook, I can open it, but can'

  • HT4628 buffering

    why does my macbookpro keep buffering

  • DELETE EMAIL BUG

    I constantly have Mail freeze when deleting emails. This then results in having to redelete all emails that were deleted prior to the freeze. Needless to say this is VERY frustrating. Has anyone else seen this? Is there a fix, is my iPhone discunctio

  • Missing plugin quicklook for view image in finder

    How to solve my problem?

  • Automate (batch process) other than from default list?

    I really admire the batch process feature that lets me automate functions. The problem is, I want to do something with a single page PDF that is not on the list; Save as TIFF. This is very common in my work environment, and time consuming. Any way to