SplashScreen class that works in Linux but not Windows?

OK so I wrote this splashscreen class:
public class SplashScreen extends JWindow {
    public SplashScreen(String imageFile, int msecs) {
        Image imgData = getToolkit().getImage(getClass().getResource(imageFile));     
        System.out.println(imageFile);
        // Create label with image on it               
        ImageIcon image = new ImageIcon(imgData);
        // Create label with image as content
        JLabel imageLabel = new JLabel(image);
        // Add label to content pane
        getContentPane().add(imageLabel, BorderLayout.CENTER);
        // Resize window to match image
        pack();
        // Get the size of the screen and the size of the image
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension imageSize  = imageLabel.getPreferredSize();
        System.out.println(String.format("%d %d", imageSize.width, imageSize.height));
        // Center window on screen
        this.setLocation(screenSize.width/2 - (imageSize.width/2), screenSize.height/2 - (imageSize.height/2));
        // Runnable that handles closing down the screen
        final SplashScreen parent = this;       
        final Runnable closeThread = new Runnable() {
            public void run() {
                parent.setVisible(false);
                parent.dispose();
        // Thread that simple sleeps and then calls the closer
        final int waitTime = msecs;
        Thread waitThread = new Thread(new Runnable() {
            public void run() {
                try {
                    Thread.sleep(waitTime);
                    SwingUtilities.invokeAndWait(closeThread);
                } catch (Exception e) {
                    e.printStackTrace();
        // Display the screen
        setVisible(true);
        // Wait and close
        waitThread.start();              
}Which I call thusly:
gui.SplashScreen sc = new gui.SplashScreen("/images/splashscreen.png", 2000);Obviously this is supposed to display the given image on the screen for 2 seconds before disappearing. My problem is that it works exactly like you'd expect in Linux, but when I run it in windows the image doesn't appear. The app loads and runs fine otherwise. I put some print outs in and verified that it looks like it's finding the image correctly, but then it just doesn't display... I'm stumped, does anyone have any clue why this would be a problem on different platforms?

Seriously? I tried it on two different windows machines and it didn't work.... Maybe it has something to do with how netbeans is jarring stuff up.

Similar Messages

  • JMF code working under linux but not windows XP

    Hello everyone,
    I'm currently working on a nice cross-platform project involving sound producing. I decided to take a look at JMF and test it a bit to know if its features can suit me. I tried to make it works under windows, using a very simple sample of code. The system seems to play the sound as some console output detects the start and the end, but all i hear is a very short noise ( 1/2second ) like a "CLIK" and nothing else. I tested the code under linux, using the same computer and it works just fine, playing the same wave nicely and entirely.
    some info:
    -i used the cross platform JMF, no performance pack ( i tried it , but still no result )
    -the code just opens a file dialog and plays the selected file
    -the selected file was always a very simple .wav
    -i did not use system classpath variables because i don't like it, i rather use local classpath ( which works fine too, no doubt about it )
    -i tested this little soft on 2 other computer using windows XP, and still got the same result.
    Please, have you got an idea about what's going on ?
    Thanks a lot for any answer!
    Maxime - Paris . France
    Code Sample:
    import java.io.File;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import javax.media.*;
    import javax.swing.JDialog;
    import javax.swing.JFileChooser;
    import javax.swing.JOptionPane;
    public class JMFSound extends Object implements ControllerListener {
         File soundFile;
         JDialog playingDialog;
         public static void main (String[] args) {
              JFileChooser chooser = new JFileChooser();
              chooser.showOpenDialog(null);
              File f = chooser.getSelectedFile();
              try {
                   JMFSound s = new JMFSound (f);
              } catch (Exception e) {
                   e.printStackTrace();
         public JMFSound (File f) throws NoPlayerException, CannotRealizeException,     MalformedURLException, IOException {
              soundFile = f;
              // prepare a dialog to display while playing
              JOptionPane pane = new JOptionPane ("Playing " + f.getName(), JOptionPane.PLAIN_MESSAGE);
              playingDialog = pane.createDialog (null, "JMF Sound");
    playingDialog.pack();
              // get a player
              MediaLocator mediaLocator = new MediaLocator(soundFile.toURL());
              Player player =     Manager.createRealizedPlayer (mediaLocator);
    player.addControllerListener (this);
    player.prefetch();
    player.start();
    playingDialog.setVisible(true);
         // ControllerListener implementation
         public void controllerUpdate (ControllerEvent e) {
    System.out.println (e.getClass().getName());
         if (e instanceof EndOfMediaEvent) {
                   playingDialog.setVisible(false);
                   System.exit (0);
    Message was edited by:
    Monsieur_Max

    Hello everyone,
    I'm currently working on a nice cross-platform project involving sound producing. I decided to take a look at JMF and test it a bit to know if its features can suit me. I tried to make it works under windows, using a very simple sample of code. The system seems to play the sound as some console output detects the start and the end, but all i hear is a very short noise ( 1/2second ) like a "CLIK" and nothing else. I tested the code under linux, using the same computer and it works just fine, playing the same wave nicely and entirely.
    some info:
    -i used the cross platform JMF, no performance pack ( i tried it , but still no result )
    -the code just opens a file dialog and plays the selected file
    -the selected file was always a very simple .wav
    -i did not use system classpath variables because i don't like it, i rather use local classpath ( which works fine too, no doubt about it )
    -i tested this little soft on 2 other computer using windows XP, and still got the same result.
    Please, have you got an idea about what's going on ?
    Thanks a lot for any answer!
    Maxime - Paris . France
    Code Sample:
    import java.io.File;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import javax.media.*;
    import javax.swing.JDialog;
    import javax.swing.JFileChooser;
    import javax.swing.JOptionPane;
    public class JMFSound extends Object implements ControllerListener {
         File soundFile;
         JDialog playingDialog;
         public static void main (String[] args) {
              JFileChooser chooser = new JFileChooser();
              chooser.showOpenDialog(null);
              File f = chooser.getSelectedFile();
              try {
                   JMFSound s = new JMFSound (f);
              } catch (Exception e) {
                   e.printStackTrace();
         public JMFSound (File f) throws NoPlayerException, CannotRealizeException,     MalformedURLException, IOException {
              soundFile = f;
              // prepare a dialog to display while playing
              JOptionPane pane = new JOptionPane ("Playing " + f.getName(), JOptionPane.PLAIN_MESSAGE);
              playingDialog = pane.createDialog (null, "JMF Sound");
    playingDialog.pack();
              // get a player
              MediaLocator mediaLocator = new MediaLocator(soundFile.toURL());
              Player player =     Manager.createRealizedPlayer (mediaLocator);
    player.addControllerListener (this);
    player.prefetch();
    player.start();
    playingDialog.setVisible(true);
         // ControllerListener implementation
         public void controllerUpdate (ControllerEvent e) {
    System.out.println (e.getClass().getName());
         if (e instanceof EndOfMediaEvent) {
                   playingDialog.setVisible(false);
                   System.exit (0);
    Message was edited by:
    Monsieur_Max

  • I have a JavaScript loop that works in Dreamweaver but not in my browsers. What's missing? Should the page load another script first?

    I know that the code is clean because it runs perfectly in DW (even with the occasional lag). Shorter loop functions have also worked in DW, but not in my Chrome or IE browsers. Is there a script or program that the HTML should run first?

    I'm sorry, of course:
    The Crow Haven Witches and Psychics of Salem
    I am designing a phone psychic hotline (don't ask! ) page, and the loop is supposed to sort the readers according to their availability. Each should appear in their respective listing.
    The setup works perfectly in DW, but none of the scripted material appears in the current page. I will add a photo of how it does look in DW.

  • Fonts that work in AppleWorks but not in Pages?  Possible to convert them?

    I don't know enough about fonts to know why this would be the case; I have some fonts which are presently working in AppleWorks, but which are not listed in Font Book and do not show up in Pages.
    Is there some way to convert the fonts so they will work? Some examples are all the free dingbat fonts at http://www.subgenius.com/SUBFONTS/subfont.html

    I tried the Windows version, but that didn't work.
    But, thanks! Font XChange was able to convert them, and they work in Pages now, although due to that being commercial software, the demo version altered them somehow. However in this case at least, since they're dingbats, that doesn't manifestly show.
    For the small amount of font converting I might do, and the limited use I'd probably have for those fonts, I'm not sure about paying $100 for software that does that, even though it does appear to do its job really well. I wonder if there is cheaper, shareware, or freeware software that does the same?
    What is it about these Fonts that necessitated the conversion?

  • I have air printer that works on iPhones but not iPad 2

    I have air printer that works with both iPhones but not with iPad2

    Just to build on red_menace's answer a bit...
    set MyText to do shell script "ps -A | grep '[M]ac VNC 2.1.app' | awk '{print $5}'"
    log "MyText=" & MyText
    set content of text field "Dir" of front window to MyText
    The log command will write the results of the "do shell script" to Xcode's run log window. If you see the correct output there then you know that part is working correctly and the problem is in the way you're trying to insert the string into the text field. Maybe "Dir" doesn't match the name you've given your text field in IB? Or maybe your text field is contained within another view, such as an NSBox or an NSTabView?
    Also, I guess "of front window" should work in AppleScript Studio but I always give my windows AppleScript names in IB and then explicitly specify the window in my scripts. Like this:
    set content of text field "Dir" of window "MyWindow" to MyText
    Steve

  • Error: NoClassDefFoundError: javax/xml/ws/Service on linux but not windows

    Hi,
    I have the following java app:
    package company.app;
    import org.springframework.context.ApplicationContext;
    import org.springframework.context.support.ClassPathXmlApplicationContext;
    public class Main {
        public static void main(String[] args) {
            ApplicationContext BEAN_FACTORY = new ClassPathXmlApplicationContext("springConfig.xml");
    }When I run it in Windows from cmd with this command: "java -jar app.jar" it works perfectly. But after I deploy it on Linux and run with the same command I get this error:
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/ws/Service
    at java.lang.ClassLoader.defineClass2(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:719)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:160)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:254)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
    at java.lang.Class.getDeclaredConstructors(Class.java:1808)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:152)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:957)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:869)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:514)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:413)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:735)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:369)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
    at company.app.Main.main(Main.java:10)
    Edited by: TolvanTolvan on Dec 2, 2008 10:23 AM

    SystemTray is a standard Java class, but it was only added in Java 6, so it seems you're using an older version of Java on Linux. Run "java -version" to verify that.

  • Strange on - Wake on LAN (WOL) works with Win2K3, but not Windows 7

    Hi,
    I have a PC that I originally had Windows 2003 on.  With Win2K3, I can send a wakeonlan (magic) packet (WOL) and get it to power on remotely from my home network/LAN.
    I just installed Windows 7 Ultimate 64-bit, in a dual-boot configuration, i.e., so I can boot the machine to either Windows 7 Ultimate 64-bit or Win2K3.
    As mentioned, I can power the machine up remotely (from my home network/LAN), but if I've LAST booted into Win7, then shutdown, it doesn't respond to the WOL packet.
    I've confirmed that if I boot into Win2K3, then shutdown, the WOL works fine.
    I have another PC that has both Win2K3 and Windows 7 (also dual boot), and that works fine with WOL.
    One difference between the one that doesn't work vs. the one that works is that the one that works is a machine that I just built a couple of weeks ago, which uses an MSI 880gm-E43 motherboard.
    The one that doesn't work also has an MSI motherboard, but it's an older one, an MSI K9NBPM2-FID.
    I've cross-checked the various Windows power management settings between the one that works, and the one that doesn't work, but I just can't get WOL to work with Win7 on that older machine.  I've even turned the Windows Firewall off completely on the machine where WOL isn't working, but no matter what I've tried thus far, no joy :(...
    The only thing that I can think of is that the network card driver (it's the MS one, from the Win7 distribution) might not work with WOL, but I've checked, and it's the latest driver from MS (Nvidia Nforce Networking Controller - 10/17/2008 - 1.0.1.211), and MSI doesn't have a specific Win7 64-bit driver for this motherboard.
    So, I was wondering if anyone has any ideas about this?
    Is there some registry setting or something that might allow WOL to work?
    Thanks in advance,
    Jim

    Hi,
    Unbelievable!
    Just for the record, I got WOL working with the older machine, JUST after I posted the original msg.
    Here's what I did:
    - I was in Device Manager, and did Update Driver, but
    - I selected to let me choose, and then I checked the "Show Compatible devices" checkbox
    Then, a 2nd, older (10/6/2006 - 6.2.0.127) driver appeared, so I figured, "what the heck?" and tried that.  I then shut the machine down, and sent a WOL packet to it, and kind of forgot about it (machines in a different room), but a few minutes later "bing!", the machine had powered up and booted into Win7!!
    Anyway, as I said, for the record, and hope that this helps someone in the future.
    Jim

  • Video that appears in iTunes but not Windows Explorer crashing iTunes

    I added some videos to my iTunes library today, and I tried to sync my iPod. When I connect it, I get the "Updating iPod, do not disconnect" message, but it doesn't say exactly what it's transferring. After a little while, I get the notification that iTunes is crashing and the option to send an error report.
    I updated iTunes to 6.0.3 earlier today, and updated my iPod to see if that would fix anything. When it didn't, I checked to see if there was something wrong with any of the videos. I tried deleting the videos, until iTunes crashed again. Whenever I try to delete, or play, or right-click this video, it crashes. I thought that maybe there was a problem with a video, so deleting it through Windows Explorer might have some effect, so I went to where it would be stored, and . . . it wasn't there.
    I know that a file being listed in the library but not actually stored in Windows would normally just result in the exclamation-point-in-a-circle icon, but could this be what's causing iTunes to crash? Is there a way to delete something from the iTunes library without actually going through iTunes?

    Okay, I managed to fix it after uninstalling iTunes and installing an old version . . . but of course, after I had everything up and working again, I ended up causing it to happen again. The upside of that is that I now know how it happened and an easier way to fix it.
    The corruption of the file occured when trying to type in an artist on a file whose tag I had modified with iPod TVShow . . . it said "Editting tag", then crashed for the first time, and crashed again whenever I tried to edit that. Though, I found that that can be fixed just by deleting the movie file first through Windows Explorer, and then through iTunes (I didn't see it in Windows Explorer originally because I didn't realize that the re-labeling of the artist never went through, so I looked in the wrong folder, and I wasn't able to use Show Song File in order to see where it was, what with the constant crashing). Hopefully that'll help if anybody else ends up with the same problem.

  • 802.11ac works in OSX but not Windows 7

    My Haswell Macbook Air connects to my new Airport Extreme with 802.11ac in OSX but in Windows 7 with the drivers in BootCamp 5.1.5621 I only connect with 802.11n.
    I can't find any new drivers for Windows -- has anyone had any luck?

    Not the answer for your question. But I have Steam on my mac. You can download it on their website!

  • I have made a Flash gallery that works in DW but not in browsers

    Hi, I am fairly new to Flash and Dreamweaver and have encountered a problem with my CS4 Dreamwever and Flash. I have made two galleries in flash of 30-40 stills that change after 2 seconds in time line. I saved these and exported to DW as .swf files.
    Having placed them into my web page in DW and viewing the page locally in both Safari (yes I'am a Mac user) and Firefox they work fine, so I have uploaded the whole schbang to the remote server. When viewing the pages in Safari or Firefox they do not view at all, I get either a blank field in the page where the Flash should be or a message from adobe saying I need to update to a newer version of flash player, depending on which browser I'm using. I have followed the download link and installed the new player but it still comes up the same. Is this somthing I'm doing wrong or a problem with CS4, The CS3 I trained on seemed to be able to do this ok?
    All help greatfully received, Thanks

    Yopu may have missed uploading a javascript file to the server.  It will be identified in the head section of the html file, possibly as a file in a Scripts folder.  If that is not the case, then you'll need to provide a link to the file on the server.

  • On a MAC with OS 10 how do I pinch, tap to make larger, and some other gestures that work on Safari but not FireFox

    I can not do all the gestures when I am in FireFox. Example Pinch to increase or decrease size of window. Tap with two fingers to increase the size of window. The other gestures like scrolling, swiping etc work.

    Hello Shona37a, if you have the [http://kb.mozillazine.org/Places.sqlite places.sqlite] file probably you are ok. the places.sqlite file can be edit with SQLite Manager or a specialized editor BUT you can move it to a [https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles#os=mac&browser=fx17 new profile], see informatinos in the above link.
    also think if you must go to [http://www.floodgap.com/software/tenfourfox/ TenFourFox] for PowerPC's running Mac 10.4.11 & 10.5.8 , it is more secure from your 3.6.18 that is unsupported.
    EDIT : [https://support.mozilla.org/en-US/kb/Recovering%20important%20data%20from%20an%20old%20profile#w_copying-files-between-profile-folders Copying files between profile folders]
    http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox
    thank you

  • Thunderbird will not recgonize or authenticate a google pasword that works in Google but not in Thunderbird.

    Thunderbird does not recognize a password for a Google account. I keep getting pop ups indicating that the password can not be found on the server. MY other Google accounts are ok.
    What do I have to do to get this email account working?

    Sounds like a gmail 2 step authentication issue or a Less Secure Application Issue. Google has instructions on solving both.

  • I have a search box on my site that works in IE but not in FF. How can i giv you the code?

    The code:
    <pre><nowiki><!-- This Script is from www.htmlfreecodes.com, Coded by: Krishna Eydat-->
    <SCRIPT language=JavaScript>
    var NS4 = (document.layers);
    var IE4 = (document.all);
    var win = window;
    var n = 0;
    function findInPage(str) {
    var txt, i, found;
    if (str == "")
    return false;
    if (NS4) {
    if (!win.find(str))
    while(win.find(str, false, true))
    n++;
    else
    n++;
    if (n == 0)
    alert("Not found.");
    if (IE4) {
    txt = win.document.body.createTextRange();
    for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
    txt.moveStart("character", 1);
    txt.moveEnd("textedit");
    if (found) {
    txt.moveStart("character", -1);
    txt.findText(str);
    txt.select();
    txt.scrollIntoView();
    n++;
    else {
    if (n > 0) {
    n = 0;
    findInPage(str);
    else
    alert("Sorry, we couldn't find.Try again");
    return false;
    </SCRIPT>
    <FORM name=search onsubmit="return findInPage(this.string.value);">
    <P align=center><FONT size=4; COLOR=#ffffff;>
    <INPUT style="BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; FONT-SIZE: 8pt; BORDER-LEFT: #ffffff 1px solid; BORDER-BOTTOM: #ffffff 1px solid"
    onchange="n = 0;" size=16 name=string><INPUT style="BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; FONT-SIZE: 8pt; FONT-COLOR: #ffffff; BORDER-LEFT: #ffffff 1px solid; BORDER-BOTTOM: #ffffff 1px solid; FONT-FAMILY: Tahoma; FONT-COLOR: #ffffff; BACKGROUND-COLOR: #16ADE6; color:#FFFFFF" type="submit" id="Button1" name="" value="Sök ID Kod" style="position:absolute;width:96px;height:25px;border:0px #000000 solid;background-color:#17AFE7;color:#FFFFFF;font-family:Arial;font-size:13px;">
    </center></font></nowiki></pre>

    Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox. <br />
    http://forums.mozillazine.org/viewforum.php?f=25 <br />
    You'll need to register and login to be able to post in that forum.

  • How can I play cd that is formatted for pc - it is continuing ed cd that works in car but not on my laptop

    I called my professional organization that sells the material and they said there is a way to play it on a mac, but the person I spoke to didn't know how to do it.  any ideas?

    Is this an audio CD or what?

  • Media Queries:  Works on Mac but not Windows

    http://www.sandiegohomegrown.com/testSDTG/
    I have been coding this site on my Mac and it works with Firefox, Safari, and Chrome.  I fired up the old Windows machine and it doesn't work with Safari, Firefox, or IE10.  It just ignores the media queries completely.  This has to be something really simple but I am baffled.  Help!!  Gary

    Alt attributes on images are not significant for rendering.  Did you fix the duplicate ID problems? Those are important.
    Windows OS doesn't ignore media queries but some browsers will if they see code errors they can't reconcile.
    Make sure IE is NOT running in Compatibility Mode which is practically the same as IE7.
    If you want to ensure IE always opens in standards mode, add this meta tag to the <head> of your HTML pages.
    <!--[if IE]>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <![endif]-->
    Nancy O.

Maybe you are looking for