Cant figure how splashscreen code works

Hi all, I've been exploring a bit on SplashScreens in java
This question is based on the tutorial located at :
http://java.sun.com/docs/books/tutorial/uiswing/misc/splashscreen.html
Given the code (taken from the tutorial above) :
import java.awt.*;
import java.awt.event.*;
public class SplashDemo extends Frame implements ActionListener {
    static void renderSplashFrame(Graphics2D g, int frame) {
        final String[] comps = {"foo", "bar", "baz"};
        g.setComposite(AlphaComposite.Clear);
        g.fillRect(120,140,200,40);
        g.setPaintMode();
        g.setColor(Color.GREEN);
        g.drawString("Loading "+comps[(frame/5)%3]+"...", 120, 150);
    public SplashDemo() {
        super("SplashScreen demo");
        setSize(300, 200);
        setLayout(new BorderLayout());
        Menu m1 = new Menu("File");
        MenuItem mi1 = new MenuItem("Exit");
        m1.add(mi1);
        mi1.addActionListener(this);
        this.addWindowListener(closeWindow);
        MenuBar mb = new MenuBar();
        setMenuBar(mb);
        mb.add(m1);
        final SplashScreen splash = SplashScreen.getSplashScreen();
        if (splash == null) {
            System.out.println("SplashScreen.getSplashScreen() returned null");
            return;
        Graphics2D g = splash.createGraphics();
        if (g == null) {
            System.out.println("g is null");
            return;
        for(int i=0; i<100; i++) {
            renderSplashFrame(g, i);
            splash.update();
            try {
                Thread.sleep(90);
            catch(InterruptedException e) {
        splash.close();
        setVisible(true);
        toFront();
    public void actionPerformed(ActionEvent ae) {
        System.exit(0);
    private static WindowListener closeWindow = new WindowAdapter(){
        public void windowClosing(WindowEvent e){
            e.getWindow().dispose();
    public static void main (String args[]) {
        SplashDemo test = new SplashDemo();
}The splash screen actually animates a duke waving, then the progress bar starts to move.
However in the code, I can only find the code responsible for drawing the string "foo", "bar", "baz".
My question is :
What is responsible for the waving of hand by duke and the progress bar values increasing? I just cant figure it out.
Thanks for reading! Hope to get some response.

The image is an animated gif, and both the hand-waving and the scrolling are part of the animation. The code in the demo app has nothing to do with it.

Similar Messages

  • I wonder how this code works?

    I was going through java API in order to understand how System.out.println("Print this string"); works. I came to know that println is an instance method of PrintStream class. So, i created an instance of PrintStream (ps) and accessed println. My code works fine BUT i realized that i needed to pass System.out as parameter to PrintStream constructor.
    NOW System.out already refers to an instance of PrintStream class.
    BUT there is no such constructor defined in PrintStream class that requires an instance of PrintStream as parameter (See API).
    I wonder how this code works?
    import java.io.*;
    class AnotherWayToPrint {
         public static void main(String[] args) {
              PrintStream ps = new PrintStream(System.out);
              ps.println("Yes! I am printed.");
              ps.println(System.out); // java.io.PrintStream@1ob62c9
    }

    I was going through java API in order to understand
    how System.out.println("Print this string"); works. I
    came to know that println is an instance method of
    PrintStream class. So, i created an instance of
    PrintStream (ps) and accessed println. My code works
    fine BUT i realized that i needed to pass System.out
    as parameter to PrintStream constructor.
    NOW System.out already refers to an instance of
    PrintStream class.
    BUT there is no such constructor defined in
    PrintStream class that requires an instance of
    PrintStream as parameter (See API). Requires? All the constructors for PrintStream take an OutputStream as a parameter.
    A PrintStream IS AN OutputStream

  • HT3678 I have 10.7.4 Mac OS - just paid $32 for Quicktime Pro so I can convert a video file format got authorization code but cant figure how to find Quicktime let alone activate - HELP!

    Just paid $32 for Quicktime Pro so I can convert a .MOV video file format to another format - cant figure out where Quicktime is and how to activate it to Pro
    Is it the Quicktime player 7?

    I did this and copied EXACTLY my name and the activation code sent in the receipt - says invalid
    I am under a deadine for a presentation in 8 hours -
    My problem is thet a person made a montage from photos and saved it as .MOV file format and the presentation is going to be made on a flat screen TV from a USB mem card or thumb drive -
    first problem was card was FAT32 formatted - and I think I understand that for a 5GB file size that ExFAT is required and XP with patches or Windows 7 and Mac OS read this format so not a problem to format USB to be ExFAT - but the TV needs AVI or a MPx format
    suggestions???
    Thanks in advance

  • Cant figure how to downsize pics for myspace or Blogspot....

    hello...i am new to a mac and i am trying to post my photos to my myspace page and mt Blogspot page...in the past i used a program called Ifranview which would reduce the size of my photo so these pages would host my photos in their correct format and size...it specifies no more than 600k??anyway.. i tried to download Ifranview to my mac and use it the way i used to on my pc but mac says it dosent know what application i want to use to open this program...Does my ibook have a program that will do what Ifranview did ???? if not how can i downsize my pics so that i can post them on my myspace page or my Blogspot page????thanx alot!!!!

    thanx so much Lori...i think that i figured another possible way also...i ran the photo thru the Automator application and was able to downsize it.. i think it might have worked cuz i was able to post a photo...im not sure tho cuz i tried so many different things so im not sure which one actually did it.. thanx again tho.. your way seems the correct way.. i figured iphoto should have some easier way to do this simple task....
    thanx again...
    Bobby Magnante

  • How Promo Codes Work

    When I request a promo code for an app I have in the store, that code will expire in 4 weeks.  It's the code that expires, not the app you get with it, correct?  What if I give out a promo code and it expires before it is used?  Does that still count against the 50 codes I'm allowed for that app?

    Hello;
    The best way to double check where the problem of your code is, is to put breakpoints on each NI-DAQ call and figure which function is giving you the error.
    Then, you can go to the NI-DAQ on line help and double check if that function that is giving you the error is still supported by that version of the driver.
    Hope this helps.
    Filipe A.
    Applications Engineer
    National Instruments

  • Hi, i had a 12 month lightroom subscription and now it has told me i need to renew my membership and i cant figure how to do this

    I had a 12 month membership and now lightroom has asked me to renew my membership in order to continue using it and i cant see where to renew it

    Did you purchased the Full Perpetual License from Adobe for $149.00?, if so then what has happened is that you probably downloaded the Creative Cloud trial version which has now expired.
    The license key for the perpetual version will not be accepted to activate the CC version.
    Uninstall the existing Lightroom and then download the one available from the link below. The uninstall process will not affect your Catalog, Preferences or personal files but will just remove the application. Install the new download and you license key will be accepted.
    Adobe - Lightroom : For Macintosh : Adobe Photoshop Lightroom 5.6
    If this is not the situation you face then provide some more details.

  • Only in firefox on ancestry I get a sales bar that moves accross the top cant figure how to shut it off annoying as hell What can I do ?

    It does not happen in ie Tried looking in options can' t seem to find anything that works Have run panda cloud cleaner did not find it Have run advanced windows care did not find it ran antivirus still nothing Looked I uninstall don't see anything It is so annoying it only seems to pop on ancestry.com I have always preferred Mozilla but now will switch if can't be fixed Please help

    You can check for recently installed suspicious or unknown extensions.
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    Do a malware check with several malware scanning programs on the Windows computer.
    Please scan with all programs because each program detects different malware.
    All these programs have free versions.
    Make sure that you update each program to get the latest version of their databases before doing a scan.
    *Malwarebytes' Anti-Malware:<br>http://www.malwarebytes.org/mbam.php
    *AdwCleaner:<br>http://www.bleepingcomputer.com/download/adwcleaner/<br>http://www.softpedia.com/get/Antivirus/Removal-Tools/AdwCleaner.shtml
    *SuperAntispyware:<br>http://www.superantispyware.com/
    *Microsoft Safety Scanner:<br>http://www.microsoft.com/security/scanner/en-us/default.aspx
    *Windows Defender:<br>http://windows.microsoft.com/en-us/windows/using-defender
    *Spybot Search & Destroy:<br>http://www.safer-networking.org/en/index.html
    *Kasperky Free Security Scan:<br>http://www.kaspersky.com/security-scan
    You can also do a check for a rootkit infection with TDSSKiller.
    *Anti-rootkit utility TDSSKiller:<br>http://support.kaspersky.com/5350?el=88446
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked
    *https://support.mozilla.org/kb/troubleshoot-firefox-issues-caused-malware

  • Help. My itouch date says tuesday the 14 but it actully wednesday the 14. I cant figure how to fix this. its not in settings.

    In date an time settings it gives no option to chnage the day. I can set the date (number) to the correct one but the  day name is one day behind. I really want to fix this its really annoying.
    Its the 14th today and its wednesday but my ipod says its the 14th and tuesday.
    Also i havent connected to a computer in a very long time since b4 this date problem occured. My computer got reformated and i dont have itunes anymore. I can get it but none of my infomation will be on the new itunes and i dont want it to deleted all my stuff.

    - Try a reset. It cures many ills
    Reset iPod touch:  Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears
    - Is the Time zone set correctly?
    - In Settings>General>International what calender is specifed? You want Gregorian

  • My ipod wont let me buy any apps because it says i have an invalid security code for my moms credit card but its the right one. and it also says i owe money for upgrading an app does anyone know how to remove my moms credit card cause i cant figure itout

    my ipod wont let me buy any appps because it says i have an invalid security code for my moms credit card but its the right one. and it also says i owe money for upgrading an app does anyone know how to remove my moms credit card cause i cant figure itout

    To change asccount information see:
    Changing Account Information
    For the code issue this may help.
    iTunes Store: My credit card's security code or zip code does not match my bank's records
    For a standard iTunes account you need a valid payment method even for free apps and app updates.
    What is making it think that you own money for an app upgrade?

  • I have  new computer, how do I transfer my old library over , thought Homesharing would work but I cant figure out how to transfer. Thanks

    I have a new laptop and have installed iTunes. How do I transfer my library from my old computer over?  I thought Homesharing would do it but I cant figure it out. I got to the point of it showing that I have homesharing on each computer but how do I download the old into the new?  Thanks

    I tried this with apps and it worked flawlessly!!
    You can do the same with music, playlists etc
    I did it on Windows 7 Ultimate 32-bit
    You should have same Itunes version on both systems!!
    Here are the methods to follow:
    Just for safety, on your new PC go to Edit > Preferences > Devices - and check "Prevent Ipods, Iphones and Ipad from syncing automatically.
    From your old computer,
    1) Open itunes
    2) Go to Edit > Preferences > Advanced
    3) here you may see a location under heading "itunes media folder location"
    4) Go to that location and open "mobile applications" folder. Copy the entire files/apps inside it and paste it to any removable device supporting the size.
    On your new computer:
    a) Repeat steps 1 to 3.
    b) Go to the location you have found in your new computer. You'll find same folders. Now, copy apps/files from your removable device to "Automatically Add to Itunes folder" DO NOT COPY it in Mobile applications folder because it won't sync that way!
    This completely restored all my apps that I had to transfer from my PC to laptop!! You can try to do same with music... This should work!
    HOPE THIS HELPS!

  • I just got the iphone 4s and i cant figure out how to get siri to work it seems to be the old voice command. HELP!

    i just got the iphone 4s and i cant figure out how to get siri to work it seems to be the old voice command. HELP!

    Did you enable Siri in settings?
    Settings > General > Siri > ON
    If Siri is off, all you get when pressing the home button for 1 second is the old Voice Control.

  • Cant Figure Out How To Transfer Songs From iPod back to PC????

    I recently got a different computer which I have installed iTunes on and it recognizes my iPod right away but I cant figure out how to get the songs and files from the iPod onto this computer, I'm assuming since its a different computer... so right now it seems like I'm unable to change songs around on my iPod and if I cleared the iPod I'd no longer have any of my songs since they were also on my old computer which is long gone. Your Help is greatly appreciated, Thanks!

    There are a few third party utilities which allow you to back up your ipod and mirror it with your itunes. I use podutil http://www.kennettnet.co.uk/software/podutil.php you can dl it for free and put up with annoying nag screens or part with £10. I have used a couple of time to rebuild my itunes play list etc (and video) and it works a treat. However it does not backup your notes/contacts/calendar...
    MB67

  • New to logic and i cant figure out how to dupe a mono single to stereo?help

    So I'm loving logic but im used to working on adobe audition and i cant figure out for the life of me how to take the mono loop im working with and turn it in to stereo. Please help and thanks ahead of time.

    You can use a mono to stereo plugin. Spreader would be a good choice.

  • I have an IPad with a Restriction code that we cannot remember.  Is it possible to delete and restore the IPad without the code?  If not how do I figure out the code or how t? o remove it?

    I have an IPad with a Restriction code that we cannot remember.  Is it possible to delete and restore the IPad without the code.  If not how do I figure out the code or how to remove it?

    The only option is to wipe the device clean and restore it to factory settings.  Hope you have a backup.
    Follow the instructions in  iOS: How to back up your data and set up your device as a new device http://support.apple.com/kb/HT4137 to restore the device to factory settings.
    Once you have setup the device as a new one, you can then sync it back with your iTunes account and all your music, apps, contacts and any other content sync'ed with iTunes will be loaded on the device. Any content that is stored only on the device and not sync'ed with iTunes, like app logins or data, will be lost during this process. Be forewarned that this is a long process and can take a couple of hours or more to complete. This can be painful, but it is necessarily so to prevent users from working around the security settings. After the restore is complete, you can setup a new Restrictions passcode. Make a note of the passcode to avoid this situation in future.
     Cheers, Tom

  • SQL JSTL  displat y the count ..  cant figure out how please help......

    Hi all,
    I facing a problem in displaying the count total.. My situation is that I run below query ..
    <sql:query var="jobs" dataSource="jdbc/test">
              SELECT COUNT(*) FROM applications where employerid = '12345610' GROUP BY job_id
              </sql:query>
              <c:forEach var="row" items="${jobs.rows}">
              <li> Count <span id="count"> [<c:out value="${row.??? )}]</span></li>
              </c:forEach>
    {code}
    when I run the same sql in sql prompt it gives me 10 groups with relevant counts.
    but I cant figure out how to do the same using JSTL sql.  in simple terms I want to display the count of each logical group ?  I have tried all I can wit my little knowledge on the subject..
    I will appreciate if someone could help me out please..
    Million Thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    I found the answer my self... It took me just a 4 sleep to find the answer ,,, a break and a coup of coffee did the job
    I chanced the code as below
    SELECT COUNT(*) as cnt FROM applications where employerid = '12345610' GROUP BY job_id
              </sql:query>
              <c:forEach var="row" items="${jobs.rows}">
              <li><a href="/test/servlet/Controller?param=Security">Security </a><span id="count">[<c:out value="${row.cnt }"/>]</span></li>

Maybe you are looking for

  • Edit, read only, disable, blur items. Which to use?

    I've searched the forum and have found some threads that somewhat discuss my question, but none have addressed it specifically. I have a page that has 20 or so items on it. There are 3 fields (like status) that determine which items may be edited, so

  • Why Can't I get my total to output to the text area?

    I can get the numbers to go to the text area and to clear the text area but, the only way I have figured out how to output the total is with a JOptionPane. Can someone look at my code and tell me how to fix this? import java.awt.*; import java.awt.ev

  • Workflow Task not able to be completed due to "System Account" in Requested By field not resolving.

    I have a workflow firing on create and update in a list. The list is a calendar that is email enabled. The tasks are assigned with the requested by set to be the System Account, which shows underlined in red when trying to complete the workflow task.

  • Failed to install Sunone 7 in Windows XP

    Hi, Recall from my memory, I can successfully install/uninstall Sunone 7 & Sunone 8 in my ThinkPad T43 Windows XP SP2 for several times before. However, now after uninstall Sunone 8 and I want to go back to Sunone 7, when I run the setup.exe program,

  • Dynamic Results from Dropdown Menu PLEASE HELP!!!

    Hi. Here's an example of what I'm trying to accomplish. (the Order Estimator section) http://www.modernpostcard.com/products_services/pricing/ Are there any good resources, tutorials, etc. anyone could point me towards on this entire process? I'm jus