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;

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

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

  • Splash Screen "Play" button Trouble

    I have a splash screen at the beginning of my animation.  When I push the play button, I want it to go straight to the animated map and start playing, but it just goes to the map and the user has to push play again.  How do I make it so the play button on the splash screen makes the map automatically start moving in the animation?

    How is all of this set up? Is the map animation on the main timeline or is this animation in its own movieClip? If the map animation is on the main timeline, how are navigating to that part of the movie? Are you using "gotoAndStop()" or "gotoAndPlay()" or something else?

  • 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");
    }

  • 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();
    }

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

  • Remove particular field and button from a screen when using pnp

    hi,
    i came to a request of remove a field and button from the displayed screen. i developed the report using logical database pnp. i need help.

    There are a couple of ways to accomplish this.
    1. Use a report category so that the only fields on the screen are those that you want.
    2. Do something like this:
          LOOP AT SCREEN.
        IF SCREEN-NAME = 'PNPTIMED' OR
           SCREEN-NAME = 'PNPBEGDA' OR
           SCREEN-NAME = 'PNPENDDA'.
          SCREEN-ACTIVE = '1'.
          SCREEN-INPUT = '0'.
          SCREEN-OUTPUT = '1'.
          SCREEN-INVISIBLE = '0'.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.

  • My iPhone crashing after latest IOS Update. Screen is not working anymore. I cannot use buttons, the screen is freezing up.Only thing I am able, is to 'restart' the phone. Now it does it after 5 minutes itself! Already removed en reset phone, no success!

    My iPhone crashing after latest IOS Update. Screen is not working anymore. I cannot use buttons, the screen is freezing up.Only thing I am able, is to 'restart' the phone. Now it does it after 5 minutes itself! Already removed en reset phone, no success!
    Can anyone help me?

    Hi there Cinthia88,
    I would recommend taking a look at the troubleshooting steps found in the article below.
    iOS: Not responding or does not turn on
    http://support.apple.com/kb/ts3281
    -Griff W.

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

  • Cool way to remove 'X' from Splash Screens

    I just found a way to remove the 'X' in the window for creating splash screens. Here is the code:
    // Make sure you have an image file (splash.jpg) in your dir.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class SplashScreen
    static JWindow window = new JWindow();
    private static void showWaitDialog(boolean show)
         JPanel panel = (JPanel)window.getContentPane();
         panel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
         if (show)
              JProgressBar progressBar = new JProgressBar(JProgressBar.HORIZONTAL);
              progressBar.setIndeterminate(true);
              panel.setLayout(new BorderLayout());     
         panel.add(new JLabel(new ImageIcon("splash.jpg")), BorderLayout.NORTH);
              panel.add(progressBar, BorderLayout.SOUTH);
              window.setLocation(300,300);
              window.pack();
              window.show();
         else
              window.hide();
    public static void main(String[] args)
         try
              showWaitDialog(true);
              Thread.sleep(10000);
              showWaitDialog(false);
         catch(Exception e)
              e.printStackTrace();
    I would love it if you let me know if this was helpful.

    Check the links below for options to remove the Adware.
    The Easy, safe, effective method:
    http://www.adwaremedic.com/index.php
    If you are comfortable doing manual file removals use the somewhat more difficult method:
    http://support.apple.com/en-us/HT203987
    Also read the articles below to be more prepared for the next time there is an issue on your computer.
    https://discussions.apple.com/docs/DOC-7471
    https://discussions.apple.com/docs/DOC-8071

  • Launching Splash Screen on the click of a button

    Situation: I have an application running, and when the user clicks a button on the main menu, a new dialog opens.
    Problem: This dialog takes awhile to load as it is retreiving information from the database etc ... hence I would like to launch a splash screen in one thread and the other dialog in a second thread.
    Following is the Splash Screen class:
    public class SplashScreen extends JWindow {
        public SplashScreen(int d) {
            duration = d;
            this.launchSplash();
        public void launchSplash() {
            JPanel content = (JPanel) getContentPane();
            content.setBackground(Color.white);
            // Set the window's bounds, centering the window
            int width = 350;
            int height = 255;
            Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
            int x = (screen.width - width) / 2;
            int y = (screen.height - height) / 2;
            setBounds(x, y, width, height);
            // Build the splash screen
            JLabel label = new JLabel();
            label.setIcon(new ImageIcon(getClass().getResource("loading.gif")) );         
            label.setHorizontalAlignment(JLabel.CENTER);    
            content.add(label, BorderLayout.CENTER);          
            // Display it
            this.setVisible(true);
            // Wait a little while, maybe while loading resources
            try {
                Thread.sleep(duration);
            } catch (Exception e) {
            this.setVisible(false);
    //        System.exit(0);
    //    public static void main(String[] args) {
    //        // Throw a nice little title page up on the screen first
    //        SplashScreen splash = new SplashScreen(10000);
    //        // Normally, we'd call splash.launchSplash() and get on
    //        // with the program. But, since this is only a test...
    //        System.exit(0);
    //    }When I run this as a standalone, it works fine (i.e. uncomment the 'main' function). But when I try to call it from another function, it doesn't launch.
    Eg: I am calling it when a button has been clicked. Code is as follows:
        public void actionPerformed(ActionEvent e) {
         SplashScreen sd = new SplashScreen(10000);
         // Calling the dialog (that takes a long time to load) here
    }Would like to know whether
    [1] is it possible to launch a splash screen on the click of a button? As usually a splash screen is done at the beginning of an application before anything is loaded. In my case an application is already running, during which a splash screen needs to be launched.
    [2] Would using the new splashscreen class of Java 6.0 support this?
    [3] If not what is the best way to approach this problem
    Appreciate any input.
    Thanks,
    Edited by: mnr on Feb 20, 2008 9:47 AM

    Thanks Michael_Dunn, I see what you mean.
    I know this is not exactly as you suggested, but when I tried the following I got a partial solution. Just wanted to know whether I am on the right track.
    I wrote a small class for the thread
    public class cSplashScreenThread extends Thread {
        public volatile boolean finished = false;
        public cSplashScreenThread(){       
    // override run() method in interface
        public void run() {
           SplashScreen sd = new SplashScreen(10000);
        }This calls the SplashScreen(code encl in earlier post).
    In the main application I added the following
    public void actionPerformed(ActionEvent e) {
    // SPLASH SCREEN
    //                    SwingUtilities.invokeLater(new Runnable() {
    //                        public void run() {
                                cSplashScreenThread sd = new cSplashScreenThread();
                                sd.start();
                                sd.finished = true;
    // DIALOG
                        SwingUtilities.invokeLater(new Runnable() {
                            public void run() {
                          DialogToCall tempDialolog = new DialogToCall(.......);
                                tempDialolog .setVisible(true);
    :When I run this in the application, the SplashScreen does indeed appear(earlier I wasn't able to see the splashScreen), and I notice (when I put a breakpoint at the pt where it calls the dialog), that it is going and creating the dialog etc, but the dialog never appears ...... after the splash screen closes, nothing else happens!
    Could you please guide me on what best to do?
    Thanks,
    Edited by: mnr on Feb 21, 2008 11:19 AM

  • 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

Maybe you are looking for

  • Disk Utility

    Hello.  I'm hoping someone can answer a quick question for me regarding Disk Utility in Snow Leopard and creating .dmg files. I have created a few setting a picture file in the "view options" area to appears at the top of the window.  Everything seem

  • How can I get iTunes in English in Mexico. I am registered with a Canadian address

    I have an iTunes account with a Canadian address. However, I am currently living in Mexico. How can I get iTunes Store downloaded to my computer and appleTV in English?

  • Ora-011157 cannot identify but fixed but i do know how and whats the reason

    There is a development going on in our clients place. Strange thing happened and fixed today.Let me explain but i have fixed it When we used sqlloader to load files from .csv i faced the above eror or-011157 cannot identify ./temp01.dbf. when i looke

  • UCS director configuration

    Hi All I newly deploy UCSD 5.2.0.0 OVF on VMware ESXi 6.0 the deployment done correctly and the VM CUCSD based Centos as in CUCSD image and I can login to centos when I trying to login th UCSD with the browser I find that no configuration done(as in

  • Make Entourage default mail program for composing?

    Hey folks. I'm trying to get Entourage to be teh default mail program for composing mail as well as reading mail. I already set it to be default for reading mail from the Mail program, bt when I click a "send to" someone type link, Mail keeps popping