How to stop a closing step

I want to trap the clicking on 'X' on the window and possibly prevent the window from closing. I have this code:

@Override
public void start (final stage) bird Exception {}
Mother-root = FXMLLoader.load (getClass () .getResource ("demo.fxml"));

Scene = new Scene (root);
stage.setScene (scene);
stage.setTitle ("Demo");
stage.setScene (scene);
stage.onCloseRequestProperty () .set (new EventHandler < WindowEvent > () {}
@Override
public void handle (WindowEvent e) {}
System.Err.println ("A");
}
});
stage.setOnCloseRequest (new EventHandler < WindowEvent > () {}
@Override
{} public void handle (WindowEvent ev)
System.Err.println ("B");
}
});

stage.onHidingProperty () .set (new EventHandler < WindowEvent > () {}
@Override
public void handle (WindowEvent e) {}
System.Err.println ("C");
}
});
stage.setOnHiding (new EventHandler < WindowEvent > () {}
@Override
{} public void handle (WindowEvent ev)
System.Err.println ("D");
}
});
}

@Override
public void stop() bird Exception {}
System.Err.println ("E");
Super.Stop ();
}

When you click the 'X' on the window, it prints

B
D
E

If I add an Event.consume (here):

stage.setOnCloseRequest (new EventHandler < WindowEvent > () {}
@Override
{} public void handle (WindowEvent ev)
System.Err.println ("B");
EV.consume)
}
});

and now, I get this:

B
The '< unknown >' program met with an X Window System error.
This probably reflects a bug in the program.
The error was 'GLXBadDrawable '.
(Details: series 113 error_code 149 136 minor_code request_code 5)
(Note to programmers: normally, X errors are reported asynchronously;)
in other words, you will receive the error a while after the cause.
To debug your program, run it with the - sync command line option
option to change this behavior. You can then get a significant
backtrace of your debugger if you break on the gdk_x_error() function).

I am running Java on Linux:

Java version "1.7.0_17".
Java (TM) SE Runtime Environment (build 1.7.0_17 - b02)
Java for 64-bit Server VM (build 23, 7 - b01, mixed mode)

When you click the 'X' on the window, it prints

B
D
E

This is the expected behavior.

If I add an Event.consume (here):

stage.setOnCloseRequest (new EventHandler() {}
@Override
{} public void handle (WindowEvent ev)
System.Err.println ("B");
EV.consume)
}
});

and that's the correct way to veto the request to close the scene...

>

and now, I get this:

B
The '' program met with an X Window System error.
This probably reflects a bug in the program.

But it is a bug. You must file a JIRA to do this. It's probably worth upgrading to the latest version of the JDK is available, both the stable release (JDK 1.7.0 u21) and also try with the latest snapshot of the JDK 8 (b88 currently); This will give you an idea as to if this problem has already been fixed.

FWIW, it works for me: I'm under JDK 1.7.0 u21 on Mac OS X; but this level of window events necessarily involves an interaction with the native windowing toolkit.

Tags: Java

Similar Questions

  • Reopened FF &amp; found 2 strips not 20 + both for adding toolbars, how to stop?

    I closed and seq. Reopened an hour later - it my 20 + tabs disappeared - 2 new ones in their place. I was asked to install a Yahoo toolbar and the other wanted to my good to install a toolbar of Downloader YouTube (CDA).
    I don't want either and only had not asked either. (I had downloaded a stand alone YouTube Downloader program - but nowhere he said I would get to the toolbars with.)

    (In this case, I found an option to "Restore last session" - and fortunately it brought back my tabs)

    I looked in the Extensions and found one for CDA Toolbar - fortunately disabled. I removed it completely.
    This will stop my tabs disappear again? And I can still use the CDA program without the toolbar?
    I have nothing to allow Yahoo toolbar in so I have no idea why it turns up - how to stop it deleting all my tabs?

    Hello

    Glad to know that you were able to restore your session on the Forelegs. Usually, this occurs if a program that you have installed on your computer tries to install the toolbars and plugins for Firefox. Please uncheck all the options for the facilities of the toolbar, the next time that you install the software, or at least make a note of these programs so that you know what to uninstall if necessary.

    Come to the toolbar for a YEAR, I found this reference on the Internet, which mentions that the YouTubeDownloader program installs a plugin in the browser - CDA toolbar. You should be able to use the CDA program without the plugin also. I suggest that you keep the plugin disabled in Firefox mode and it will not interfere with your use.

    And if you have chosen to uninstall the plugin, you can follow the steps detailed below.

    To uninstall a possibly unwanted extension, please proceed as follows:

    1. In the Firefox Firefox window click on the top left and select Add-onsor, if the Firefox button is not displayed, click the Tools menu, and then click Add-ons.
    2. Once the add-on Manager has opened in a new tab, click the Extensions button on the left side of the window.
    3. You should now see a list of your extensions installed on the right side and buttons on the right side of each extension.
    4. To remove an extension of Firefox, simply click on the Remove button. You should see a message that informs you about the deletion of the add-on.
    5. Note that some modules require a restart of Firefox to make it disappear completely. To perform a restart of Firefox after removal of add-on, click restart now in the message.

    You can find more information about uninstalling extensions in the following articles:

    Disable or remove modules

    Remove a toolbar that has supported your Firefox or the homepage search

  • How to stop a bunch of ad to come on every page that I select? In addition, how to stop the 2nd page coming when I open my browser?

    I really hate to get these bands little ads all over my page when I'm scrolling. I have to hover over them to find the small 'X' to delete. Can they be taken out completely?
    In addition, when opening my browser, how to stop a 2nd blank page opened (he did of tiles on it to select it, but not necessary)

    Looks like you contracted a bad add-on or two. Here is my procedure suggested for tracking down and cleaning of the injectors to ad, the unwanted speed dials and other bad modules. Sorry for the length - it is not as bad as it sounds:

    (1) open the Control Panel, uninstall a program. After the loading of the list, click on the column heading "installed on" to group infections, I mean additions by date. This can help the undisclosed items bundle smoker who snuck out with some software, you have agreed to install. Out as much garbage as possible here.

    (2) open Firefox page modules using either:

    • CTRL + SHIFT + a
    • "3-bar" menu button (or tools) > Add-ons

    In the left column, click on Plugins. Set essential and unrecognized plugins 'never enable '.

    In the left column, click Extensions. Then, in case of doubt, disable (or delete, if possible) not recognized and unwanted extensions.

    Often, a link will appear above at least an extension disabled to restart Firefox. You can complete your work on the tab and click one of the links in the last step.

    Any improvement?

    (3) you can search the rest of problems with scanning/cleaning tools listed in our technical support article: Troubleshooting Firefox problems caused by malware. These scanners on request are free and take a long time to run. If they end quickly, especially if they require the payment you have a serious infection. I suggest the specialty forums listed in the article in this case.

    Success?

  • How to stop the Sync tab? When Open firefox it opens also tab asking to sign up for synchronization.

    When click on browser Firefoxon to open it now add check automatically on every time that compatibility, never used to do this. Just started doing this because on Firefox starts, it opens a designated Home tab and another for Firefox sync join to the top of the page.
    How to stop opening SYNC registration page.
    All I want is for the homepage to show.
    See if you can help

    Hello, this can happen when firefox is not able to correctly save preferences in the profile folder. Please try this: click the menu button

    then click on help

    > troubleshooting information > profile folder - 'display the folder '. then a new window will open. in this search on a file named user.js window (it can be used to overwrite your custom settings). where it is present, delete or rename this file and then restart firefox.

    For more information and other steps, please also see: How to fix preferences that will not save

  • How to stop the VI and a Sub VI together

    Hi, in my application, I have a vi with a state machine with a loop of event handler. One of the events in my loop of event handler is out who runs the State of the output of my state machine. I also have an under vi outside my statemachine.

    The problem:

    1. at the exit of pressing my Vi does not stop.

    Reason: my sub vi is still running.

    Need solution : How tp stop the two loops together using the exit button.

    StateMachine P.S:1.My is inside a while loop and while loop runs inside my sub vi also.

    2. both the loops are parallel, since I'm on queues in it.

    2. both the loops are parallel, since I'm on queues in it.

    There are many ways, depending on your architecture.

    Can pass you a message from out of your event loop to your another loop on the queue?

    Another way is to use a global Boolean variable 'Stop' and use it in your second loop exit condition. Set it in the event loop when you want to stop the program.

    The producer consumer example stops the second loop by closing the queue during the first loop stops and then to capture the error when the second loop trying to read the queue.

  • How to stop the log in page and continue straight on the desktop at boot?

    Original title: desktop

    How to stop the newspaper in stright page and go to the desktop page when starting

    Hi Ms.HarleyChic,

    Windows operating system you are using?

    If you use Windows 7, try the steps in the following article and check if this can help:

    Enable or disable a secure connection (CTRL + ALT + DELETE)

  • How to stop execution when modal Subvi open?

    Ladies and gentlemen,

    A very simple question: I sometimes modal dialog boxes, which can be closed (which can happen during programming, when logical not completed, or if one of the modal dialog boxes then opened, and then main VI is started). Then, when it happened, so the only way to stop execution is killing LabVIEW of Task Manager. I remember it was something simple how stop running without killing LabVIEW, but do not remember. Can you please give me a hint - how to stop the run in this situation? Yes, I know not Ctrl +. combination, but this does not work in this case.

    See the attachment for more details.

    Andrey.

    Try useful tool of Darren

  • How to stop the spam e-mails in my Inbox to hotmail address?

    Original title: too much junk in your Inbox!

    why I am and how do I stop these emails from flippin with address "contact12543" ect. ? I'm as much as 46 per day! It's annoying, I'm tired of him, and I do not give my hotmail address to anyone, I don't know! or on a Web site I visit.

    I get messeages talk to me about this job more difficult to prevent this garabge in my Inbox, well, WHEN!

    Hi Randy,

    Thanks for posting your question in the Microsoft Community.

    I understand you want to know how to stop e-mail spam in your Inbox to hotmail address. Correct me if I'm wrong.

    I imagine the inconvenience that you are experiencing. I will certainly help the question of fixing.

    You should report the e-mail as spam, so that the e-mail that keeps arriving in your Inbox is redirected to the Spam folder directly and you do not have to worry about this.

    Please follow the steps described in the links below and check the issue:

    Help keep the spam in your Inbox:

    http://www.Microsoft.com/security/online-privacy/spam-prevent.aspx

    Note: The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

    When to trust an e-mail message:

    http://Windows.Microsoft.com/en-us/Windows7/when-to-trust-an-e-mail-message-IE9

     

     

    Report an abuse, phishing, or spam in Outlook.com:

     

    http://Windows.Microsoft.com/en-us/Windows/Outlook/abuse-phishing-junk-email

     

     

     

    Hacked account:

    http://Windows.Microsoft.com/en-us/Windows/Outlook/hacked-account

     

     

    If the problem persists, then I suggest you to post the same question in the Windows Live Mail forum for additional help.

    Portal of Windows Live e-mail:

    http://answers.Microsoft.com/en-us/windowslive/Forum/LIVEmail?tab=all

     

     

    Your response is very important for us to ensure a proper resolution. Please get back to us to help you accordingly.

     

  • How to stop emails double in my Inbox in? I get duplicates of all emails.

    I use OUTLOOK EXPRESS for my e-mail. For months I get duplicates of 90% of the e-mails received. I can't figure out how to stop the duplicates. Can anyone help?

    First of all, check tools | Accounts and make sure that the account is not listed twice.
     
    Second, make sure that your security program is not set to scan e-mail.
     
     
    If the above does not help, create a new file Pop3uidl.dbx.
     
    Tools | Accounts | Mail | Properties | Advanced. Uncheck: Leave a copy of messages on the server. Then, remove the Pop3uidl.dbx file. You will get the messages once more, but it should be.
     
    Tools | Options | Maintenance | Store folder will reveal the location of your Outlook Express files. Note the location and navigate on it in Explorer Windows or, copy and paste in start | Run.
     
    In Windows XP, the files of user OE (DBX and WAB) are by default marked as hidden. To view these files in Windows Explorer, you must enable Show hidden files and folders under start | Control Panel | Folder Options icon | Opinion, or in Windows Explorer. Tools | Folder options | View.
     
    With OE closed, find the Pop3uidl.dbx file and delete it.  Another will be created automatically when you open OE.
     

     
  • How to stop a script of long-run, or leave in the first place?

    How to stop a longrunning script to stop or start in the first place. It does in itself. I don't know what it is. The only reason for which we know that it is running is because from time to time, we get a box popping up to say something like "this can't start/work due to a long-running script. Is this something that is important for our computor or is she something harmful, or simply unnecessary?

    Hi Anna-KarinEdvardsson,

    1 did you change on your computer before the show?

    2 are. what scripts you referring?

    3. when exactly the script starts?

    I suggest you to set the computer to clean boot and check how it works.

    To configure the computer clean boot, follow the steps in the below link:

    How to perform a clean boot

    Note: After the installation of updates to the clean boot follow step: 7 article to reset your computer to normal startup.

  • As soon as I get on the computer it is something, don't know what it is, how to stop?

    Original title: computer

    As soon as I get on the computer it is something, don't know what it is, how to stop?

    Hello

    1. Since when are you facing this problem?

    2. don't you make recent changes?

    3. do you receive any error messages?

    I suggest you to follow these steps and check if that helps:

    Method 1:
    Start the computer in safe mode and check if the same problem occurs:
    http://Windows.Microsoft.com/en-us/Windows-Vista/start-your-computer-in-safe-mode

    Method 2:
    Try to perform the clean boot and check if it helps:
    http://support.Microsoft.com/kb/929135

    NOTE: When you are finished troubleshooting, make sure that you reset the computer in start mode normal such as suggested in step 7 of the above article.

    You can also view the programs that load at startup.

    http://Windows.Microsoft.com/en-us/Windows-Vista/optimize-Windows-Vista-for-better-performance#section_2

    It will be useful.

  • How to stop the zoom to change?

    How to stop the zoom of the evolution to more or less at will.  I don't have a mouse

    Hi shellywilson,

    ·         Are you referring to the Web page zoom feature?

    ·         Did you do changes on the computer before the show?

    Follow the steps in the article.

    Get the best display on your monitor

    For reference: Zoom in on a Web page

  • How to stop spooler under app to come and say he has stops working what is spooler subsystem app

    How to stop spooler under app to come and say he has stops working what is spooler subsystem app

    Hello

    1. Since when are you facing this problem?

    2. have you made changes on the computer recently?

    3. when exactly you get the error?

    I would suggest trying the following methods and check if it helps.

    Method 1: Solve printer problems:

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-printer-problems

    Method 2: Clear the print spooler:

    To do this, follow these steps.

    a. click on Start Menu, in the online search, type services.msc and press enter.

    b. in the Services listed stop the service print spooler.

    (c) in Windows Explorer, navigate to the folder below and open the PRINTERS.

    C:\Windows\system32\spool\PRINTERS

    d. click on continue and Yes (if prompted by UAC) to approve the opening of the PRINTERS folder.

    e. remove all files in the PRINTERS folder, until it is empty, and then close Windows Explorer.

    Note: DO NOT DELETE the PRINTERS folder itself. Don't delete its content.

    f. open Servicesand start the service print spooler.

    I hope that helps!         .

  • How to stop automatically rebuild the index

    How to stop windows from automatically rebuild the index; I am running vista sp2?  it restarts just as soon as he completed which makes my ability to get something useless

    Hi deblee99,

    -How long have you had this problem?

    -What software changes you did on the computer before the show?

    Follow these steps:

    Method 1:

     

    Follow these steps:

    Step 1:

    Create a new user account and see if the problem persists.

    Step 2:

    If the problem does not persist in the new user account, it could indicate that your old user account is corrupted.

    Follow the steps in the following article to repair the damaged user profile:

    Difficulty of a corrupted user profile

    Method 2: Perform an auditor of file system (CFS) scan in safe mode

     

    SFC tool scans system files and replaces incorrect versions of system files by using the correct versions.

    For instructions, see How to use the tool File Checker system to troubleshoot missing or corrupted system files on Windows Vista or Windows 7 .

  • How to stop my printer from adding a drive on my computer

    I have a C4780 who has the unfortunate habit of adding a Z: drive on my computer to himself. It is especially annoying because I the Z: drive mapped to another folder on my computer to make things easy for me.

    How can I stop this car since supported by the printer?

    Hi AbSoiLoki,

    Thank you for your response. I could locate some different options here for you to try. There is a previous post for a different printer that is having the same problem with the printer mapping a Z:folder.

    Here, the link will take you to a post on the HP Forums with a few steps for you to try in case of problems.  Click here.

    I have also included another document on how to stop printers of grabbing the drive letters, click here.

    Please let me know if this was able to help you solve the problem.

Maybe you are looking for

  • El Capitan is compatible with Canon Pixma printer?

    The new Mac OS is compatible with Canon Pixma printer

  • How can I permanently disable TOUCHPAD on laptop? Windows7 64 bit.

    How to disable the touchpad on laptop permanently? I KNOW how to disable but whenever I restart computer - it It's on once AGAIN... HP pavilion dv7 6c27cl. Win 7 64 bit. I can't believe I have to download some software or readers to solve this proble

  • Cannot use Winodws XP System Restore utility

    I wonder if anyone can help. I can't get my laptop to restore as soon as possible. I have it and have used control points and manually restore points but it will not restore. Don't stop of saying impossible to restore. No changes have been made.

  • Error hidusb.sys__

    My windows vista computer crashes trying to start and when I try to do the F8 and repair, it gave me an error message on hidusb.sys not loaded... I've been trying to fix by with vista OS DVD, but it hangs just... everything I have now is just an arro

  • Tunnel VPN from Site to Site dynamic

    I spent the last 2 days, try to set up a dynamic tunnel VPN site to site of a Cisco 5510 to a Cisco SA540. The 540 is a dynamic supplier that can not be changed. There a dyndns account. I was lucky that the other 10 sites are all static and the ADSM