Splash screen using JWindow

HI ,
i had crated a splash screen using JWindow and made
JWindow.setVisible(true); during the loading time and then made
Jwindow.dispose(); after it gets loaded...
but it is not working a only a blank window is visible not its contents....what's wrong

hi!
import java.awt.Color;
import java.awt.Insets;
import javax.swing.JLabel;
import javax.swing.JWindow;
import javax.swing.border.LineBorder;
* @author          : aniruddha<br>
* @date          : Nov 22, 2006,  11:43:43 AM<br>
* @source          : TestJwindow.java<br>
* @project          : HelpForum<br>
* @author aniruddha
public class TestJwindow
     public static void main(String[] args)
          JWindow loadWindow = new JWindow();
          JLabel lblLoad = new JLabel("  Loading..........");
          if(loadWindow.isVisible())
               loadWindow.dispose();
          else
               loadWindow.getContentPane().setBackground(Color.gray);
               lblLoad.setBorder(new LineBorder(Color.red, 3));
               lblLoad.setForeground(Color.white);
               loadWindow.add(lblLoad);
               loadWindow.setSize(150, 50);
               loadWindow.setLocationRelativeTo(null);
               loadWindow.setVisible(true);
}works fine with me..
:)

Similar Messages

  • How can i create splash screen using netbean?

    how can i create splash screen using netbean?

    Welcome to the Sun forums.
    gabbyndu wrote:
    how can i create splash screen..Java 6 offers a splashscreen functionality. See [New Splash-Screen Functionality in Java SE 6|http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/splashscreen/] *(<- link)* for details.
    [Java Web Start|http://java.sun.com/javase/technologies/desktop/javawebstart/index.jsp] has offered splash screens to applications since Java 1.2. See [How can I provide my own splash screen?|http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/faq.html#206] in the JWS FAQ for more details.
    .. using netbean?We don't support Netbeans here. Ask that on a [Netbeans forum|http://forums.netbeans.org/].

  • Removing Splash Screen using button in Movieclip

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

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

  • Closing a splash screen using mouse click.

    When I click the image it does not close the splash screen. What do I fix and why? Thank you.
    package splash;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.JWindow;
    public class SplashWindow2 extends JWindow {
         public SplashWindow2 (String filename, Frame f) {
              super(f);
              try {
                   JLabel l = new JLabel(new ImageIcon(filename));
                   jbInit();
              catch(Exception e) {
                   e.printStackTrace();
         private void jbInit() throws Exception {
              // Add the mouse listener
              this.addMouseListener(new java.awt.event.MouseAdapter() {
                             public void mousePressed(MouseEvent e) {
                                  this_mousePressed(e);
              getContentPane().add(l, BorderLayout.CENTER);
              // Size the image
              pack();
              // Centre the image
              Dimension screenSize =
                   Toolkit.getDefaultToolkit().getScreenSize();
              Dimension labelSize = l.getPreferredSize();
              setLocation(screenSize.width/2 - (labelSize.width/2),
                             screenSize.height/2 - (labelSize.height/2));
              setVisible(true);
         void this_mousePressed(MouseEvent e) {
              System.out.println("TESTING");
              setVisible(false);
              dispose();
         JLabel l ;
    package splash;
    import java.awt.*;
    import javax.swing.*;
    public class SplashWindow2Test
         public static void main(String[] args)
              JFrame frame = new JFrame("Splash Screen Test");
              SplashWindow1 splashWindow = new SplashWindow1("D:\\javatest\\test\\gif\\JSplash.gif", frame);
              splashWindow.show(); // Makes the window visible, brings it in front of other windows
    //          frame.setBounds(100, 100, 400, 400);
    //          frame.show();
              splashWindow.requestFocus();
    }

    try this modified code (it works) -
    package splash;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.JWindow;
    public class SplashWindow2 extends JWindow {
    public SplashWindow2 (String filename, Frame f) {
    super(f);
    try {
    l = new JLabel(new ImageIcon(filename));
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    private void jbInit() throws Exception {
    // Add the mouse listener
    this.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mousePressed(MouseEvent e) {
    this_mousePressed(e);
    getContentPane().add(l, BorderLayout.CENTER);
    // Size the image
    pack();
    // Centre the image
    Dimension screenSize =
    Toolkit.getDefaultToolkit().getScreenSize();
    Dimension labelSize = l.getPreferredSize();
    setLocation(screenSize.width/2 - (labelSize.width/2),
    screenSize.height/2 - (labelSize.height/2));
    setVisible(true);
    void this_mousePressed(MouseEvent e) {
    System.out.println("TESTING");
    setVisible(false);
    dispose();
    JLabel l ;
    package splash;
    import java.awt.*;
    import javax.swing.*;
    public class SplashWindow2Test
    public static void main(String[] args)
    JFrame frame = new JFrame("Splash Screen Test");
    SplashWindow2 splashWindow = new SplashWindow2("//D:\\javatest\\test\\gif\\JSplash.gif", frame);
    splashWindow.show(); // Makes the window visible, brings it in front of other windows
    // frame.setBounds(100, 100, 400, 400);
    // frame.show();
    splashWindow.requestFocus();
    }

  • J2ME splash screen using alerts

    Hi everyone,
    I have used alerts before with no problem, but I am having probelms using them to create a welcome splash screen. The code I have used is below:
    private void showSplashScreen(Display d)
         Image logo = null;
         try
         logo = Image.createImage("/images/logo.png");
         catch( IOException e )
                   System.out.println(e);
         Alert splash = new Alert( "Advanced Predictive Text", "David Fowler", logo, null);
         splash.setTimeout(3000);
         d.setCurrent(splash, tb); // tb is a global variable
         System.out.println("Displayed splash screen");
    The method is called on startup. The toolkit displays "Displayed splash screen", but nothing is shown on the emulator. If it's running the code why isn't the alert appearing? The textbox (tb) appears no probs!
    Three days prior to my final year demo...please help!!!
    Many thanks in advance,
    David Fowler

    try this...
    private void showSplashScreen()
         Image logo = null;
         try
              logo = Image.createImage("/images/logo.png");
         catch( IOException e )
              System.out.println(e);
         Alert splash = new Alert("Advanced Predictive Text", "David Fowler", logo, null);
         splash.setTimeout(3000);
         Display.getDisplay(this).setCurrent(splash);
         System.out.println("Displayed splash screen");
    }

  • 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

  • Multiple logons using same Logon Manager Splash Screen

    I have an web application set up in Logon Manager where the user profile is set to login as a simple user with matching credentials. I also want the person to login to the same web page at the same login splash screen using different credentials as administrator. Can this be done. I am new to this so all help id welcomed.

    Many questions, many answers. :-)
    Yes, Rich, they would need to install the multiserver version
    for you to see that Enterprise Manager option in the CF Admin. But
    no, they would not need to uninstall the Server deployment (what
    you did) to add the Multiserver deployment. They can co-exist
    (though it's not something most would typically do).
    The best news for you is that, yes, they can indeed just
    setup a second site on their web server, and have that also point
    to the one CF Server deployment you have installed. That is, of
    course, assuming they run a web server that supports multiple
    sites. If it's Apache, you're good. If it's Windows, then as long
    as its Windows Server 2003 (or 2008, or Vista), you're good, too.
    (Just for completeness, for other readers, XP does not let you run
    more than one site at a time.)
    If during the installation of CF you told it to have ALL
    sites in the web server run with CF, you need do nothing more than
    create the new site. It should immediately be able to run CF pages.
    If instead you told it to only link CF to one site, then you'll
    need to run the web server configuration tool again. You can do
    that manually, even after the installation. See the CF Admin and
    Config docs for more on that, as well as on this very question. (I
    realize many like to just run stuff and hope that the interface is
    clear enough, but as this question shows, for some things anyone
    installing CF will be well-served by looking over that often-missed
    manual.)
    Hope that helps, Rich. It's not an RTFM answer. :-) Just
    saying that if you need more than what I've said, it is in the
    manual. Still, I'll be happy to answer follow ups if I can.

  • Only portrait splash screen (no landscape) for app

    Is it possible for a DPS app created in App Builder to only have a portrait splash screen? 
    As in, our company does not want a landscape splash screen embedded.
    Portrait splash screen could be rotated; however, this would add unnecessary size to the footprint of the download.

    For my portrait-only apps I always create both splash screens, using rotated portrait as landscape.
    The overhead on the app size is minimal, and not worth worrying about.

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

  • Custom splash screen only shows up when command line is used...

    Hi,
    Everything in my Java web start application works perfectly but, the custom splash screen only shows up when command line is used ("C:\Program Files (x86)\Java\jre7\bin>javaws -verbose http://www.xxx.eu/AcSentVivresCrus/AcSentJnlp/AcSent.jnlp"), if I use the shortcut on the desktop or in the start menu, the Java 7 splash screen shows up (tested under Windows Vista and Seven). Does someone have any clues?
    Thanks...
    My jnlp file :
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="6.0+" href="AcSent.jnlp">
      <information>
        <title>AcSent : Commande de repas</title>
        <description>AcSent - Commande de repas</description>
        <vendor>AcSent</vendor>
        <homepage href="http://www.xxx.eu" />
        <icon href="acSentIconBiseau.png" />
        <icon href="splashAcSentRC.png" kind="splash" />
        <shortcut online="true">
          <desktop />
          <menu submenu="AcSent" />
        </shortcut>
      </information>
      <security>
        <all-permissions />
      </security>
      <resources>
        <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" max-heap-size="128m" />
        <jar href="AcSentJnlpProgressIndicator.jar" download="progress" />
        <jar href="AcSentJnlp.jar" main="true" version="1.0" />
        <property name="jnlp.packEnabled" value="true" />
        <property name="jnlp.versionEnabled" value="true" />
      </resources>
      <application-desc name="AcSent" main-class="eu.acsent.jnlp.AcSentApplication"
           progress-class="eu.acsent.jnlp.progressindicator.CustomProgress"> 
      </application-desc>
    </jnlp>

    Hi again,
    I made some researches :
    - The link in the generated shorcuts ("C:\Windows\SysWOW64\javaws.exe -localfile -J-Djnlp.application.href=http://www.xxx.eu/AcSentVivresCrus/AcSentJnlp/AcSent.jnlp "C:\Users\Arnaud\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\46\69c1e9ee-1f252d1a") is not the same as the one I use in the command line ("C:\Program Files (x86)\Java\jre7\bin>javaws -verbose http://www.xxx.eu/AcSentVivresCrus/AcSentJnlp/AcSent.jnlp"). Is there a way in the the JNLP file to tell how to generate shortcuts (not the icon, etc., but command line options)?
    - This sample (https://blogs.oracle.com/thejavatutorials/entry/changing_the_java_web_start) displays the splash screen when I click on the the generated shortcuts (I use Windows 7). I have copied the ButtonDemo jar file and the JNLP file on my IIS web server (Windows 2008 Server), this time the splash screen does not show up when I click the generated shortcuts but always shows up when I use the command line. Can someone tell me if it is a trouble with IIS ?
    Thanks again...

  • When using Teststand, how do I prevent the LABView splash screen from appearing?

    It comes up even if I have the "Don't show this screen" checked !

    I'm excited to see TestStand is a celbrity product.
    Typically when you run a sequence in TestStand, LabVIEW is launched by TestStand when the sequence contains steps that use the LV adapter. In this case LV is launched through its ActiveX interface and the LV splash screen is suppressed. This is in contrast to launching LabVIEW manually in which case the LV splash screen will be displayed.
    In your case I'm not sure how LV is being launched. You might want to shut down LV and then run your sequence to see if the splash screen is then suppressed.
    You may also want to read NI Knowledgebase article 28MEPUXL, "Why Does the LabVIEW Startup Screen Appear When Using the Dialog Box Function from Within My VI?". In this case LV has been opened manually and not be Test
    Stand, such that the splash screen is not suppressed.

  • Splash screen says "System extension cannot be used  The system extension "/System/Library/Extensions/PulseDriver.kext" was installed improperly and cannot be used. Please try reinstalling it, or contact the product's vendor for an update.  How to fix?

    Please help!
    After installing iTunes 11.0.1 I got a splash screen that appears after all updates.  The screen reads:
    System extension cannot be used
    "The system extension “/System/Library/Extensions/PulseDriver.kext” was installed improperly and cannot be used. Please try reinstalling it, or contact the product’s vendor for an update."
    Question: How do I re-install or replace this file?
    Jim

    I submitted the above question, later finding that it has been answered by Buller already.  No one need reply as Buller's answer seems to solve the problem for others, and I'll try that.
    Jim

  • 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/]

  • Excel 2013 stalling at splash screen for files in use by others

    Excel 2013 is stalling (and not opening) when trying to open a file that is in use by another user. In office 2010 it would prompt the user to open in read-only mode, but in 2013 it seems to just stall and never open. It just stays on the splash screen
    for ever. We have done some testing and it appears that double clicking on an excel file causes this to occur, but will function correctly if the file is opened through excel's file browser.  Any suggestions on how to fix this?  It's a pain to make
    all the users open excel first, then browse through a lengthy network location.  Thanks in advance!
    For information purposes: these are files on a network location shared by many users.

    Hi,
    Did the issue occur when you just installed the Office 2013 or after using Office 2013 sometimes? I recommend we try the following methods and test to check if they are helpful.
    1. Click the File tab>Options>Advanced>scroll down to the General section>Clear the Ignore other applications that use Dynamic Data Exchange (DDE) check box in the General area.
    2. Install the latest Cumulative Update for Excel
    3. Right click on the Start Button>Click 'Open Windows Explorer'> click Organize > Layout> Uncheck Details Pane and Preview Pane.
    On a Windows menu, click on Tools > Folder Options.  In the box that opens up, click on the View tab.  Scroll down the list to “Show pop-up description for folder and desktop items” and clear the checkbox and then click OK.
    4. Check/Disable the Excel add-ins
    5. Repair Office.
    Hope it's helpful.
    Regards,
    George Zhao
    TechNet Community Support

  • Using Splash screen WPA2 network

    I was using Document 100787 as a guide.
    1. I have  1252 & 1142 AP's  connected to the Wism (6.0.188.0 code)
    2.  FWSM I have a 4402 (6.0.188.0 ) appliance connected as my anchor.
    3. ACS is ver 4.2
    All of my wireless networks function as expected. I see the successful auth in ACS. I just built a new WPA2  network and set it up to use Splash screen redirect. It doesn't seem to matter what I do it just wont work. IE or  Mozilla.
    Test 1 was to drop the users at the wism. There was no splash screen.
    There was no evidence of my url-redirect in the wireshark trace.
    Test 2 used the 4402 as my anchor point with the same results.
    In both cases the client was authenticated  and was able to navigate the internet and other duties.  The problem is apon opening the broswer there is no redirect.
    Any thoughts ?

    I am not sure I understand what you are trying to accomplish. Typically you do not configure L2 encryption such as WPA/2 on web authentication SSIDs. This is because it is difficult to manage L2 encryption on networks intended for guest use or non domain users. If this SSID is for guest/non domain users I would use a PSK and provide that to end users if you need to use L2 encryption. If this is for domain users I would normally use 802.1x for authentication via EAP-TLS or PEAP.

Maybe you are looking for

  • I want to know how to install and download an app on more than one machine at a time

    download and install an app on more than two computers at a time

  • MO Opearting UNIT value update through back end

    Friends, I have a MO: Default operatng UNIT and MO: operatng UNIT defined in my Oracle apps 11i. and by mistake i deleted both theses values through system profile options. and now i would like to update the MO values through back end . please let me

  • IOS 6 File Type Association Issues

    I've run into a problem that appears to be restricted just to iOS 6 devices -- iOS 5 seems to handle this situation well. I'm building an application that exports JSON-formatted files with a custom extension via email, and should also be able to open

  • Why is my performance so ridiculously slow ??

    Hey, I have the PLUS version of Story My performance through both the app online and offline and also through the browser is very, very slow The system catches up with my typing after a couple of seconds ?? Please advise, thanks

  • Scheduling in Production server.

    Hi , I have scheduled a job in dev server using SM36 job schedule wizard. now there is no workbench request no. in job scheduling. i need to transport that to production server. how can i do that. with warm regards, Vikash.