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

Similar Messages

  • 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

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

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

  • Using mouse click to return image coordinates.

    Ok so I've been trying to figure out how to do this and it seems very complicated for something that really seems straightforward.
    Anyway. I have a camera that updates an image object on the front panel using a while loop. I have another image object that is updated with a still image when the "snap" button is pressed. Now what I want to do is to click on a point in the snapped image and have the VI return the coordinates of that pixel in the image coordinate frame.
    What I've got so far is an event structure in the while loop with the following to occur in the event "image object -> mouse down":
    Server reference (reference to the image object) -> Property node (last mouse position) -> output screen coordinates.
    I've got two errors that don't make a whole lot of sense to me (I haven't worked with event structures before): "event data node contains unwired or bad terminal" and "event structure one or more event cases have no events defined". This second one seems strange since I don't actually want anything to happen if there's no mouse click. The first one seems to refer to the element box on the left hand side of the event structure.
    The above is my lastest attmpt at sorting this problem and as far as I can see it should work. whatever about the errors, am I even taking the right approach with this? I'd have thought image cordinates would be a common enough thing but search the boards here, it would appear not...
    Kinda stumped here. Any help is much appreciated.
    Message Edited by RoBoTzRaWsUm on 04-14-2009 08:34 AM
    Solved!
    Go to Solution.

    Hello RoBoTzRaWsUm,
    I have taken a look at your VI, which has been taking a correct approach to the data you are looking for.  As you are using and event structure, you should be looking for an event to occur.  When using a Property Node, you are trying read an attribute of a control.  However, in an Event Structure, I believe you should be using an Invoke Node.  An Invoke Node allows your to read an event or write a method with the Control Class in LabVIEW. 
    1. Place down and Invoke Node from the Functions Palette in 'Programming'->'Application Control'
    2. Wire your Image Control reference to it
    3. Click Method, and select 'Get Last Event'
    4. Right click on 'Which Events' and 'Create Constant'.  Make the constant '1' in the array
    5. Read the 'Coordinates' Cluster from the left hand side of the Event Case by right clicking  and 'Create Indicator'
    You will find a piece of example code attached.
    Regards
    George T.
    Applications Engineering Specialist
    National Instruments UK and Ireland
    Attachments:
    UKSupportMouseClick.vi ‏39 KB

  • Edit Spry Menu Bar using Mouse Click

    Hello…
    I created a Spry Menu Bar and it's working just fine. But on phones and Tablets the submenu doesn't work because it's a mouseover, is it possible to change it to a mouse click?
    Thanks!

    Yes, but it needs a lot of JS coding to do so.
    A better solution is to use a jQuery or pure CSS menubar or visit http://www.projectseven.com/ for a commercial version

  • Use mouse click trigger option more than once?

    Hi, is there some way to use the "mouse click" trigger option more than once in the project? I am trying to build a menu button animate where the users click the (menu grid icon) once, and it transforms into the (x icon) and stays there until they click it again ONCE to change it back to the (menu grid icon). Other trigger actions aren't ideal, and I find that if I used the "double mouse click", the response gets a bit messy as clicking once would replay the whole sequence again. Thanks!

    At CreationComplete make a var as:
    button = -1;
    At click event of the button write:
    if (button == -1){
    sym.getSymbol("nmnmnmn").play("xicon");   // if you have a trigger in timeline to make this action that you want
    button++;
    else {
    sym.getSymbol("nmnmnmn").play("returnedicon");
    button = -1;
    Somehow like the above you'll have to do it.
    Or else you can use boolean , TRUE/FALSE

  • Can't use mouse clicker

    I was changing settings in expose and I assigned a mouse button to windows applications and now I can't click my mouse to change back the setting.
    I tried safe mode but it still can't click.
    Is there a way to reset the mouse options or the expose preferences back to default without using the mouse????
    HELP!!!

    Everyone's stumpted on this one. I called apple support and they told me to archive and install.
    It is a logitech wireless MX 700 Keyboard & Mouse. I set it on mouse button 192 out of 295. You have to leave one option for the mouse blank in the system preference for expose.
    I solved this problem by clicking both clickers (logictech, not apple, 2 clickers) or maybe it was one then the other I am not sure but it worked and I was able to get back into the system preferences to change one of the mouse button empty and was able to use my clicker.
    In conclusion good to know about this issue. I love my mac.

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

  • Want to trigger at selection screen on 'X'  using mouse click event.

    I've designed a report which has two radiobuttons i would to like change the selection screen depends on the selection of the button as of now i'm selecting the button and hitting enter so that at selection screen on radiobutton group triggers.but for more user friendly I would like trigger as soon as i click on the button. Is it possible to do this?
    cheers
    Anand

    Hi,
    all the selection screen elements which u want to be appearing on the screen during one radio button should be declared as:
    SELECTION-SCREEN BEGIN OF BLOCK b_2 WITH FRAME TITLE text-001.
    *PARAMETERS:      rb_img    RADIOBUTTON GROUP rad1.
    PARAMETERS:      p_from    like bkpf-bldat modif id gr2,
                     p_to      like bkpf-bldat modif id gr2.
    SELECT-OPTIONS:  s_arobj  FOR   toa01-ar_object modif id gr2.
    SELECTION-SCREEN END OF BLOCK b_2.
    SELECTION-SCREEN BEGIN OF BLOCK b_3 WITH FRAME TITLE text-001.
    *PARAMETERS:      rb_invo   RADIOBUTTON GROUP rad1.
    SELECT-OPTIONS:  s_bukrs   FOR bkpf-bukrs modif id gr1,
                     s_belnr   FOR bkpf-belnr modif id gr1,
                     s_gjahr   FOR bkpf-gjahr modif id gr1,
    SELECTION-SCREEN END OF BLOCK b_3.
    AT SELECTION SCREEN
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF SCREEN-GROUP1 = 'GR1'.  
          IF RB_INVO  = SPACE.
            SCREEN-ACTIVE = 0.
          ELSE.
            SCREEN-ACTIVE = 1.
          ENDIF.
          MODIFY SCREEN.
        ELSEIF SCREEN-GROUP1 = 'GR2'.
          IF RB_INVO  = C_X.
            SCREEN-ACTIVE = 0.
          ELSE.
            SCREEN-ACTIVE = 1.
          ENDIF.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    Hope this helps you.
    Regards,
    Anjali

  • Screen Sharing: Mouse click is reversed

    I keep getting a problem when controlling another Mac via Screen Sharing where normal (left) clicking the mouse will right click on the computer I'm sharing (i.e. I'll click on a folder with the left button, but instead of selecting the folder the context menu will pop up).
    Does anyone else have this problem? Does anyone know how to fix this?

    Yes. I ought have stated originally that I don't have this problem all the time. It just seems to happen randomly. If I relaunch Finder it fixes it for a while.

  • 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

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

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

Maybe you are looking for

  • URGENT:error while deploying a process flow

    EMP_COUNT is a mapping which i have deployed . when i try to deploy a process flow i get the following error: OMB05602: An unknown Deployment error has occured for Object Type API8028: No signature is available for mapping EMP_COUNT because the gener

  • Object Oriented Modelling and Code Generator

    i have a final yr project on java--any help plzz Objectives: In software development we make extensive use of models to capture details about objects in a domain, the attributes of the objects and the relationships between the objects. Once complete,

  • Why is the sound so terrible in 10.4.6?

    After upgrading to OS 10.4.6, there are serious problems in the sound when importing clips from my Sony DCR-TRV 900. The main problem is what someone else described as "digital noise," high-pitched bubbling sounds and distortion, in both singing and

  • Aperture 2  and White Balance Tint

    Hello Has anyone else noticed the huge colour shift when making a White Balance Tint adjustment with AP2 on a new image? When I make an incremental (1 point) Tint adjustment for the first time on a new image the colour changes dramatically (similar t

  • Safari error message on iPad 2

    Has anyone gotten an error message saying IOS crashed and to call I-Pad-support at 1-877-908-2105 immediately? Is this for real? I-Pad is misspelled. The message has inconsistent capitalization. Safari is in a loop that keeps repeating the message.