Splash Screen that fades in smoothly...

Is there some code somewhere?
Or how can I realize that with Swing?
Hope you can help me... ;)
Greetz
Sambale

Ok... Guess you didn't understand it right...
I want my splash screen to fade smoothly from 0%
(invisible) over 50 % (semi-invisible) to 100%
(full).
It means I need a method just like setTransparency(
values from 0 to 100).
D'you know what I mean?The top level Java components (Frame and Window) are always 100% opaque. In order to do what you want you have to use the java.awt.Robot class to grab a snapshot of the background where the splash screen will be displayed and then paint your semi-transparent image over the top of it using a thread and AlphaComposite to tweak the transparency over time. Not 100% accurate but good enough to fool most people. Here's an example showing the concepts.
import java.awt.AWTException;
import java.awt.AlphaComposite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.JPanel;
import javax.swing.JWindow;
import javax.swing.Timer;
public class FadeImagePanel extends JPanel {
        private Image image;  
        private Image bgImage;
        private float alpha = 0.0f;
        private Dimension PREF_SIZE;
        FadeImagePanel(URL imageLocation) throws IOException {
            this.image = ImageIO.read(imageLocation);
            initialize();
        private void initialize() {
            captureBackground();
            startAnimation();
        private void startAnimation() {
            Thread t = new Thread(new Runnable() {
                public void run() {
                    while (alpha < 1.0f) {
                        try {
                            Thread.sleep(20);
                            repaint();
                            alpha += 0.05f;
                            if (alpha > 1.0f) {
                                alpha = 1.0f;
                        } catch (InterruptedException ie) {
                            ie.printStackTrace();
            t.start();
        public Point getPreferredSplashLocation() {
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            int w = screenSize.width;
            int h = screenSize.height;
            int x = (w - image.getWidth(this))/2;
            int y = (h - image.getHeight(this))/2;
            return new Point(x,y);
        private void captureBackground() {
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            int w = screenSize.width;
            int h = screenSize.height;
            int x = (w - this.getPreferredSize().width)/2;
            int y = (h - this.getPreferredSize().height)/2;
            Rectangle splashRectangle = new Rectangle(x,y,w,h);
            try {
                Robot r = new Robot();
                bgImage = r.createScreenCapture(splashRectangle);
            } catch (AWTException awte) {
                awte.printStackTrace();
        protected void paintComponent(Graphics g) {
            Graphics2D g2d = (Graphics2D)g;
            g2d.drawImage(bgImage, 0, 0, this);
            AlphaComposite comp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha);
            g2d.setComposite(comp);
            g.drawImage(image, 0, 0, this);
        public Dimension getPreferredSize() {
            if (PREF_SIZE == null) {
                PREF_SIZE = new Dimension(image.getWidth(this), image.getHeight(this));
            return PREF_SIZE;
        public static void main(String[] args) throws IOException {
            final JWindow window = new JWindow();
            URL imageURL = FadeImagePanel.class.getResource("splash.png");
            FadeImagePanel fip = new FadeImagePanel(imageURL);
            window.add(fip);
            window.pack();
            window.setLocation(fip.getPreferredSplashLocation());
            window.setVisible(true);
            new Timer(3000, new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    System.exit(0);
            }).start();
    }         

Similar Messages

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

  • Blue screen that fades to yellow then white...

    I have an iPhone 5s 64gbs. This is the second phone I've had to get, the first broke due to a cracked lcd screen. This one gave me the blue/yellow/white screen fade before rebooting. I have it in recovery mode and it is restoring. However, if this doesn't work, what should I do?

    This error could be hardware related, here's what you can do:
    Check for hardware issues
    Related errors: 1, 3, 10, 11, 12, 13, 14, 16, 20, 21, 23, 26, 27, 28, 29, 34, 35, 36, 37, 40, 1000, 1002, 1004, 1011, 1012, 1014, 1667, or 1669.
    These errors mean that your device or computer may have a hardware issue that's preventing the update or restore from completing.
    Check that your security software and settings aren't preventing your device from communicating with the Apple update server.
    Then try to restore your iOS device two more times while connected with a cable, computer, and network you know are good.
    Confirm that your security software and settings are allowing communication between your device and update servers.
    If you still see the error message when you update or restore, contact Apple support.
    copied from Resolve iOS update and restore errors

  • Recently my iPhone 5 started rebooting to a messed up screen that would flash and show different bars and colors. I would either have to wait a bit to restart it and fix it. But now, it got to the point where I can't even get past the Apple splash screen

    My iphone 5 was working fine until it recently started to reboot to a messed up splash screen that would flash and have bars across it. When this happened, I couldn't do anything and had to restart it. I was able to start up the phone sometimes, until just recently. Everytime I started up the phone, it would load up the splash screen and then become distorted, flashy, and sometimes colorful and I could not use my phone. To try and fix this, I put it into recovery mode to do a factory restore, but iTunes can't even restore my phone. I even tried DFU mode.. Any help would be greatly appreciated!

    Check this support document for SIM issues http://support.apple.com/kb/TS4148. No one here is Apple, we are users like you. We can only recommend you try Apple again, unless you are close to an Apple store and can make an appointment to go in there.

  • FCP will not start not even a splash screen

    I updated my 15" MacBook Pro to OSX 10.6.6 and now none of my Final Cut Pro projects will launch there is not even a splash screen that pops up. When I right click the FCP icon in the dock the only option it gives is to force quit. Has anyone heard of this happening in relation to an OS update?

    Okay. I finally got FCS 2 apps and the App Store to coexist, but not without considerable trial and error. There is definitely some bad blood between 10.6.6 and FCS 2 apps. I haven't been able to pinpoint the exact problem since the behavior I experienced with FCP and Compressor was very inconsistent, but I do have some solutions that might work. I don't guarantee they'll all work as they did for me, but it's worth a shot.
    1) Try launching FCP and waiting as long as you can when it hangs. Several times, if I waited long enough, the splash screen would magically appear and everything would start up as normal, even after a full minute or so.
    2) Delete the Final Cut Pro System ID file and re-enter your serial number after launching FCP. Make sure you have your serial number handy before you try this. The System ID file is located in ~/Library/Application Support/ProApps/. Deleting this file allowed the serial dialogue to come up, and after entering the serial, FCP launched successfully.
    3) If you have the time and patience, I highly recommend a totally clean install of 10.6 Snow Leopard and using the 10.6.6 Combo Update to get up to date. I managed to get a working Final Cut Pro and Compressor using this method, even though it was a pain in the ***. Using the Migration Assistant to transfer your files over will not break FCS2 apps. As a precaution, I did not transfer over any of my System Settings with the Migration Assistant. You can find the 10.6.6 Combo update here: http://support.apple.com/kb/DL1349
    From my tests, I think there is some problem in 10.6.6 with how OS X displays custom dialogue boxes, such as the kind that drop down from the menu-bar or FCS's custom dialogue boxes and splash screens. I get hangs in MAS when it tries to display the Apple ID login and FCS upon launching. The behavior is inconsistent, sometimes hanging for 30 seconds, other times indefinitely, and I don't have the technical expertise to understand why. However, I've ruled out a disk error through a clean bill of health from disk utils and running the same OS config from two different hard drives.
    Here's what I did:
    1. Verified internal hard drive and made a SuperDuper backup of my internal hard drive to an external drive.
    2. Wiped internal hard drive, installed 10.6 Snow Leopard, and installed Final Cut Studio from disks.
    3. Installed the 10.6.5 combo update. Used Software Update to get all software up to date, but unchecked the 10.6.6 update.
    Tested FCP: hang on startup.
    4. Deleted the System ID file.
    Tested FCP: asked for serial number, then completed launch.
    Tested FCP again: launched with no problem.
    Tested Compressor: launched with no problem.
    5. I wanted to test the System ID fix on my old setup. I booted to SuperDuper backup (10.6.6 from Software Update) and deleted the System ID file.
    Tested FCP: hang on startup.
    6. Booted to clean-install (now at 10.6.5) and applied the 10.6.6 combo update.
    Tested FCP: hang on startup
    7. Deleted the System ID file.
    Tested FCP: asked for serial number, then completed launch.
    Tested FCP: initially hung on startup. However, after about 30 seconds, it surprisingly launched with no issues.
    Tested FCP: took about 30 seconds to launch (no hang), but eventually displayed splash and launched with no issues.
    Tested Compressor: same as above.
    8. Migrated data from SuperDuper backup to 10.6.6 clean-install on internal drive using Migration Assistant. Excluded "Settings." I also deleted the System ID before testing.
    Tested FCP: asked for serial number, then completed launch.
    Tested Compressor: launched with no problems.
    Tested FCP: launched with no problems.
    9. I then launched the freshly installed Mac App Store. I clicked "install" for Evernote, and the app hung. However, after a moment, it displayed the Apple ID login drop-down from the menu bar. I entered my credentials and Evernote installed.
    Tested FCP: initially hung on startup, then launched without a problem.
    Tested FCP: launched without a problem.
    Tested Compressor: launched without a problem
    10. I decided to try one last little test. I deleted Evernote and launched both the Mac App Store and FCP at the same time. FCP hung on startup. I clicked "install" for Evernote again, and App Store hung. After a moment, though, FCP completed its launch AND the App Store drop-down asking me for my Apple ID appeared at the same time. This interested me, since it seemed to suggest that these were related incidents.
    I have some process samples from activity monitor for when FCP hung, if someone would find them useful, but I can't read them at all. Console showed the following whenever FCP hung:
    objc[192]: Class OutputTexture is implemented in both /Library/Application Support/ProApps/Internal Plug-Ins/ProFX/FxPlugWrapper.plugin/Contents/MacOS/FxPlugWrapper and /Library/Application Support/ProApps/Internal Plug-Ins/ProFX/QCMotionPatch.plugin/Contents/MacOS/QCMotionPatch. One of the two will be used. Which one is undefined. 1/11/11 1:18:36 PM [0x0-0x15015].com.apple.FinalCutPro[192]
    objc[192]: Class objCWrapper is implemented in both /Applications/Final Cut Pro.app/Contents/MacOS/Final Cut Pro and /Applications/Motion.app/Contents/Frameworks/Ozone.framework/Ozone. One of the two will be used. Which one is undefined. 1/11/11 1:18:37 PM [0x0-0x15015].com.apple.FinalCutPro[192]
    objc[202]: Class MIOTimecodeField is implemented in both /Applications/Final Cut Pro.app/Contents/MacOS/Final Cut Pro and /Applications/Final Cut Pro.app/Contents/MacOS/Plugins/ProAppsIntegration.bundle/Contents/MacOS/ProApps Integration. One of the two will be used. Which one is undefined. 1/11/11 1:20:24 PM [0x0-0x18018].com.apple.FinalCutPro[202]
    objc[202]: Class MIOTimecodeFieldTextView is implemented in both /Applications/Final Cut Pro.app/Contents/MacOS/Final Cut Pro and /Applications/Final Cut Pro.app/Contents/MacOS/Plugins/ProAppsIntegration.bundle/Contents/MacOS/ProApps Integration. One of the two will be used. Which one is undefined. 1/11/11 1:20:24 PM [0x0-0x18018].com.apple.FinalCutPro[202]
    objc[202]: Class MIOTimecodeFieldFormatter is implemented in both /Applications/Final Cut Pro.app/Contents/MacOS/Final Cut Pro and /Applications/Final Cut Pro.app/Contents/MacOS/Plugins/ProAppsIntegration.bundle/Contents/MacOS/ProApps Integration. One of the two will be used. Which one is undefined. 1/11/11 1:20:24 PM [0x0-0x18018].com.apple.FinalCutPro[202]
    objc[202]: Class MIOTimecodeSearchFormatter is implemented in both /Applications/Final Cut Pro.app/Contents/MacOS/Final Cut Pro and /Applications/Final Cut Pro.app/Contents/MacOS/Plugins/ProAppsIntegration.bundle/Contents/MacOS/ProApps Integration. One of the two will be used. Which one is undefined. 1/11/11 1:20:24 PM [0x0-0x18018].com.apple.FinalCutPro[202]
    objc[202]: Class ProMetadataQTMDStorage is implemented in both /Applications/Final Cut Pro.app/Contents/MacOS/../Frameworks/MIO.framework/Versions/A/MIO and /Applications/Final Cut Pro.app/Contents/MacOS/Plugins/QTM Reader.bundle/Contents/MacOS/QTM Reader. One of the two will be used. Which one is undefined. 1/11/11 1:20:24 PM [0x0-0x18018].com.apple.FinalCutPro[202]
    objc[202]: Class OutputTexture is implemented in both /Library/Application Support/ProApps/Internal Plug-Ins/ProFX/FxPlugWrapper.plugin/Contents/MacOS/FxPlugWrapper and /Library/Application Support/ProApps/Internal Plug-Ins/ProFX/QCMotionPatch.plugin/Contents/MacOS/QCMotionPatch. One of the two will be used. Which one is undefined. 1/11/11 1:20:27 PM [0x0-0x18018].com.apple.FinalCutPro[202]
    objc[202]: Class objCWrapper is implemented in both /Applications/Final Cut Pro.app/Contents/MacOS/Final Cut Pro and /Applications/Motion.app/Contents/Frameworks/Ozone.framework/Ozone. One of the two will be used. Which one is undefined. 1/11/11 1:20:27 PM [0x0-0x18018].com.apple.FinalCutPro[202]

  • Is there a way to go from BIOS - Splash Screen - Usable Desktop?

    I am using XFCE4. I have followed the instructions for silent boot as per the wiki, and am getting only two text outputs. The first is the "Booting Arch Linux" message and the second is the automatic login notification. I would like to first get rid of the login message, if possible. The second goal is to go from BIOS to a splash screen to the desktop with nothing else being displayed at any point. Is this possible to accomplish? If yes, then how?

    If you start X from a bashrc/profile with autologin to the tty then I don't know if you can do this.  You could, instead, set up a graphical target.
    But if you want a splash screen, that would be plymouth:
    https://wiki.archlinux.org/index.php/Plymouth

  • 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

  • How to close a splash screen?

    How do you close a splash screen that is fullsize, after a
    button is clicked and an application is launched? (Flash 8)
    Thanks for any help.

    There is a good example in Lab-Useful:
    http://www.hamiltondesign-consulting.com/labuseful.html#anchor59995
    Regards;
    Enrique
    www.vartortech.com

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

  • Problem with displaying a splash screen twice

    I have a splash screen that displays while I am reading data from the recordstore, I use the same sceen when I am writing data back to the record store when the application exits.
    The problem I am having is that the screen never appears the second time, I have tried to set it to null and then instantiate it again but it still does not appear. Can someone please give me some adivse as to why this might be happening. I am pretty sure it is some kind of race condition with the threads but I just cant seem to solve it. I am placing snipits of code below.
    public class NetTools extends MIDlet implements CommandListener
    public void startApp()
    isPaused = false;
    display = Display.getDisplay(this);
    splash = new Splash();
    splash.start();
    settings = new Settings(this);
    settings.start();
    display.setCurrent(splash);
    splash.StartTimer();
    splash.setMsg("Loading Settings...");
    settings.Load();
    splash.setMsg("Loading Main App...");
    splash.Dismiss();
    showMainScreen();
    splash = null;
    public void destroyApp(boolean unconditional)
    display = Display.getDisplay(this);
    splash = new Splash();
    splash.start();
    display.setCurrent(splash);
    splash.setMsg("Saving Settings...");
    //splash.Join();
    //splash.StartTimer();
    settings.Save();
    //splash.Dismiss();
    settings = null;
    splash = null;
    public class Settings implements Runnable
    public void Load()
    try
    thread.yield();
    public void Save()
    try
    thread.yield();
    public class Splash extends Canvas implements Runnable
    public void StartTimer()
    start_time = System.currentTimeMillis();
    repaint();
    serviceRepaints();
    public void Dismiss()
    while ((start_time+WAIT_TIME)>System.currentTimeMillis())
    repaint();
    I cannot seem to figure out how to make the thread for the splash overtake the UI thread in the destroyApp(), does anybody have any ideas.
    Sunny

    A grey box with the splash screen size is displayed.would indicate you have your "application which takes sometime to load" in the
    EDT, which will prevent painting until loading finishes
    use a separate thread to load the data
    http://java.sun.com/docs/books/tutorial/essential/threads/
    http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
    http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html

  • Applet, splash screen an JButton

    Hi,
    I have an applet that only contains a JButton in order to connect a host. When you click the JButton, the connection begins and during this time I want to display a splash screen that is removed or hiden when the connection has achieved.
    For this, I created a JWindow that is created in a thread as many others Java developers do.
    The problem is that is done in the JButton actionPerformed() method and therefore, I never see my JWindow (only its shape) during this connection.
    Is there anybody out there who would know how to do that ?

    In order to get stuff to paint properly.
    In your action performed pop up your Frame/Window. Let the frame then start the thread. Pass the frame instance into the thread object for callbacks such as progress bars, or if you want to rotate graphics. When the thread is finished, have it callback to the frame and tell it to dispose.
    Good Luck
    z.

  • How do I change/customize the Photoshop CC splash screen?

    I've looked everywhere, but no correct answer has been found. Please help!
    I DO NOT want to deface the splash screen, but just add our company logo.
    I was able to edit the Illistrator CC just fine.

    The only splash screen that i was able to edit was the Illustrator one, because the raw files were in the Windows folder. I have also tried looking in the PSArt.dll for the encrypted versions, but without any luck.
    The updater process shouldn't remove the custom ones, because I just replaced the new ones with the same file names.
    Please Help!

  • Loading time of splash screen verus initial siena created splash screen

    Hi everyone,
    I have a load issue on windows surface RT device with a seina app.  I need some insight on trying to decrease load time.  This new app has about 2000 images and growing and each image is optimized to be about 20 kb.  This app is for reference
    when training in specific disciplines.  The source is an excel file and the images are downloaded locally when published.
    I have two splash screens, the initial splash screen that loads via the default html webpage of the app.  The other is a siena screen visual that I call an extended splash screen with the usual timer and rating control. The extended splash screen set
    for 2 seconds loads the default settings to be used every time the app loads.  The settings are saved to file when the user changes the configuration.  This all works are designed.
    The app loads within 5-7 seconds on a laptop but takes between 25 - 30 seconds to load on the surface device.  I know the initial surface is somewhat slow device but I have tweaked the surface to squeeze every cpu cycle I can during the testing and
    analysis stage. 
    The initial default splash screen takes about 17 - 21 seconds to load.  I have tried tweaking as much as possible by removing some visuals on the extended splash screen down to 3, picture, timer, rating.  I don't think the extended splash
    screen is the issue as this part loads within 7-9 seconds to load.  
    Can someone explain or provide some insight on the load process during the initial phase on the splash screen, like is the app loading the source data from excel, initializing all the scripts, loading itself into memory, etc... This will allow me to build
    more efficient apps with siena. 
    Thanks,
    William

    Hi
    I cant really give you an technical insight on the load process, but I have noticed that if I have multiple timers and or gallery's (15 +) (I suspect more timers that gallery's) in my app load time was very slow on ARM devices.
    Again not sure if this applies to your app but might help point you towards the issue.
    Ronan

  • Premiere Pro CC crashes at splash screen

    Hello everyone. Having a problem that I hope someone can help me resolve.
    This morning I restarted my workstation and when it rebooted I was unable to launch Premiere Pro CC. It gets stuck on the purple splash screen that normally loads all of the assets. After a while, it says "Premiere Pro CC is not working" and gives me a crash log. I'll post the crash log but first I'll list some of the things i've tried to fix this..
    1. Restart the computer
    2. Update all drivers
    3. Run Premiere in compatibility mode and as an admin
    4. Reinstall Premiere
    5. Adobe tech support used remote acces to replace the file "dvamarshal.dll" in my Premiere folder (but it still doesn't work)
    Problem Event Name:     APPCRASH
      Application Name:     Adobe Premiere Pro.exe
      Application Version:     7.2.1.4
      Application Timestamp:     52aed7f3
      Fault Module Name:     dvamarshal.dll
      Fault Module Version:     7.2.1.4
      Fault Module Timestamp:     52ae9790
      Exception Code:     c0000005
      Exception Offset:     000000000000aa59
      OS Version:     6.1.7601.2.1.0.768.3
      Locale ID:     1033
      Additional Information 1:     1ef8
      Additional Information 2:     1ef85c0568694c37a496679930350233
      Additional Information 3:     baac
      Additional Information 4:     baac23f2a22564c5ed3f3c4d66fbcb9b
    At a loss here and I have deadlines to meet. What can I do besides re-installing my entire operating system..?

    Hi,
    May I know the System Model name and also which video card is there.
    As you mentioned that there is a dead line you can run the Premier pro in standard VGA mode.
    To make in standard VGA mode.
    1. right click on my computer -> click on Manage
    2.on the computer management window on the left side click on the option for Deivce manager
    3.Expand Dispaly Adpaters Option
    4.Right click on the video card (AMD Or Nvedia) ->select Upgrade device driver
    5.select Browse my computer for driver software
    6.Select Let me pick from the listof device driver on  my computer
    7.Select Standard VGA Graphic Adapter and click on next
    then restart the computer and launch premier pro . It should work for the time being and in the mean time we will research more and help you .

  • Bug when splash screen graphic has a space

    I dragged a picture for my splash screen that had a space in the file name. When imported into Flash Builder, I immediately got an error:
    Description Resource Path Location Type
    unable to resolve '@Embed('assets/Picture%20001.jpg')' for transcoding Foo.mxml /Foo/src line 7 Flex Problem
    Looks to be easy enough to fix, but it definitely does not do this when the picture file name doesn't have a space in it.

    Fixing and will be in the next update coming out soon, thanks for the heads-up!

Maybe you are looking for

  • AppSet Status??

    Hi Guys, Anyone know which table stores the application set status? I would like to have a monitoring job check the table, but i can't seem to find it in the database. Regards, AvdB

  • MIRO: EXIT_SAPLMR1M_002 & BAPI: invoice_update

    Hello, Can anyone tell me how to use exit EXIT_SAPLMR1M_002 in transaction MIRO?  I have requirements to create new line items with GL accounts and amounts.  From OSS, exit EXIT_SAPLMR1M_002, should be use.  But I cannot trigger this exit.  I have tr

  • Header Details of Actionable Message

    Hi, Can it possible to remove actionable message Header details while displaying message details? Madhu

  • BW Security: Infoobject security

    Hi all,      I have  the following requirement: 1) I built a role Role1  giving access to execute query Q1 and access to cost center's  CC1 , CC2 . It is assogned to  USER1 and when he executes the query Q1 , the data for only  the cost center CC1 an

  • Does 10.10 break photoshop elements12 ?

    The content aware move tool will not work in elements 12 !