How to prevent (X button) closing window

Hi!
I am wondering how to prevent X button on
the right top corner on the window closing
the window.
My jdev java app is intended to close window
when user explicitly presses return button.
That's works fine ... but how to catch
window close event (X sys btn) and stop it?
null

Hi,
You need to change the default close operation of JDialog or JFrame:
myFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

Similar Messages

  • How to prevent refresh button?

    how to prevent refresh button?
    ould anybady know pls tell it me

    Double-posted. See reply on http://forum.java.sun.com/thread.jspa?threadID=715948&tstart=0

  • How do I delete recently closed windows from the history tab

    when closing the browser, even after private viewing, the site shows in the recently closed windows section of the history button on the toolbar. how can I delete this section. I have options set in the tool section but still doesn't work. helppppppppppppppppppp!

    Make sure to close all tabs in a window before closing that window.
    Set the pref browser.tabs.closeWindowWithLastTab to false on the about:config page to prevent closing the last tab from closing the browser and make a close button appear if only one tab is open.
    *http://kb.mozillazine.org/about:config

  • Prevent Someone from closing window

    I am currently filling out a form on safari and there is no option to save my work so I will have to leave it up on the screen all day. My younger sibling use the computer too and have already accidentally closed it and have started over 2 times. Is there a way I can prevent someone from closing the window or lock it in any way????

    Hi
    Welcome to Apple Discussions
    No way to lock-in a window, however, if you have administrative control of the system, you can set up a separate user account for others (System Preferences>Accounts). This way, only you have access to your files etc. in your User Account, while affording others the same in their user account.

  • How to add "x" button in window

    hi,,
    in my program I create the window
    Like :
    Windoe w =new Window ();
    I want to add "x" button to close window
    how I can do it??
    please healp me ..
    very Thanks,,

    You can just JFrame, JDialog, or create a component and draw it yourself

  • How to prevent RDC sessions closing when inactive

    I am using MS Remote Desktop version 8.0.5
    and I have observed that the session automatically closes on my desktop [whether a PC or my iMac] if I should happen to step away from my desk and leave the session being inactive for over about 5 mins or so.
    How can I prevent this or at least prolong the time of inactivity before automaticclosing of session.
    BTW - when I reopen the session on my desktop - the Terminal Services end [Windows Server 2012] is still running where I left it.
    Thanks

    Hi,
    It is true with the Power Saving mode and I am afraid that it is the only option.
    Thanks.
    Jeremy Wu
    TechNet Community Support

  • Re: How to prevent shutdown when closing Satellite A35-S159 lid?

    I just inherited a Toshiba Satellite A35-s159.I am running XP.
    When I shut the lid,Windows shuts down.
    I would like to keep things on, to be able to recieve updates and downloads.
    I don't see anything in the "control panel" to allow me to do this.
    In the control panel there is "Toshiba Power Settings" but I don't seem to be able to find a way to change a setting in there to keep everything running with the lid closed.
    I see a prong on the screen lid that contacts a switch when it is closed,which then shuts the computer down.
    Has anyone take to grinding this prong off? Is that the only solution?

    Hi there!
    I wish I was able to use the "Power Management" in my OS!
    In "Control Panel" I have "Power Management"...but when I click on it,I get a message telling me to use the "Toshiba Power Management" which is a seperate icon in the "Control Panel".When I click on the OS "Power Management" I am not able to make any choices,although I can see them as gray ghosts in the background.The choices would seem to be more extensive. The "Toshiba Power Management choices are few and seem rudimentry in comparison.
    I am guessing that Toshiba customized the Control Panel to be computer specific for the A35 model?
    I am wondering if I have any choice but to disable the lid switch.That may have been Toshiba's idiot proof way of power management at the time.

  • How to prevent a Button from playing a Sound overlaped?

    I have a Button named "Bt1P" that when I click on it, the Sound "S1.mp3" begin to play.
    This is the code:
    Bt1P.addEventListener (MouseEvent.MOUSE_DOWN, Bt1PDown);
    function Bt1PDown (event:MouseEvent):void {
    clicked = 1;
      var str:String = "S1.mp3";
        var ClassRef:Class = Class(getDefinitionByName(str));
      var playSound:* = new ClassRef();
      playSound.play();       
    My question is, what is the right code to tell this Button not to repeatedly play "S1.mp3" while it is already Playing!
    because when i click it for the 2nd and 3rd time, the file overlaped, and 3 same sounds play together at once....you know what I mean?
    any Help please??....thanks a lot.

    Hey Pouradam! How are you!!
    I found the answer myself....I just need to Add the RED code as below :
    Bt1P.addEventListener (MouseEvent.MOUSE_DOWN, Bt1PDown);
    function Bt1PDown (event:MouseEvent):void {
      clicked = 1;  
      SoundMixer.stopAll();
      var str:String = "S1.mp3";
      var ClassRef:Class = Class(getDefinitionByName(str));
      var playSound:* = new ClassRef();
      playSound.play();       
    Hope it solved my problem??  Yes It did!

  • How to prevent command button in jsf

    Hi,
    I have one problem in my login page in jsf. When i am clicking the command button, the values are erased and again asking username and password, then its called to my actionevents?
    In my command button onclick i called js script for validating client side.
    can you please provide information for how to avoid this??
    Thanks
    MOhan

    HI,
    I am using RAD6.0. Some times its working fine. some times not working.
    I think this is not an server proplem, jsf problem.
    Why do I need to click my action method commandButton twice?
    Any solution to solve the problem , pleae help me

  • 10.1.3 ADF -- How to prevent "submit" button submits data?

    Hi,
    In an Edit JSP page, there are several inputText fields that the users can modify data. And a "submit" button they can click when they are done with modification. I also add a validator for a inputText field to check whether the input is valid.
    When the users click "submit", I can see the error msg on top of the page if the data is invalid. Because I change the navigation string to "null" if the input is invalid, the page does not get forwarded. But here comes the problem, if I cancel this page and navigate to the next, I see the invalid data I just input.
    In another word, even with the validator and error msg, the data still gets submitted to the database.
    I haven't registered the validator in the face-config.xml. Will that help solve the problem? Any other idea? Any help is appreciated.
    Annie

    Hi Annie,
    If the input is invalid the current page is redisplayed by default.
    if you want to cancel this page and want to go to another page without
    displaying error messages, specify immediate="true" attribute
    with cancel button.
    Shakir

  • [Flex 4.5.1] How to prevent Radio Button from being selected when clicked on? No Changing Event?

    I have a very common use case where you have a few radio buttons and only one can be selected at a time. Some of them are basic and on click should be selected right away, but other are more complex and open a pop up which requires some additional user selections after which the user selected OK or CANCEL for example and only after that the selection of the radio button should be applied programatically.
    So to solve this issue I've come up with 2 workarounds:
    1) make the entire group, that holds the radio button, act as a button with buttonMode="true" mouseChildren="false" and programatically change the radio button within it.
    2) hold the current radio button selection in a variable and in the changeHandler of that radio button return the selection back to what was selected before. But this also causes a small flickering of the radio button which gets selected and deselected immediately after that.. not cool.
    So my question is... is there something I am missing that could do the job without these workarounds... like a Changing event which I use for the ButtonBar but I can't find on the RadioButton or RadioButtonGroup... thanks!

    Hi,thanks for the reply. Actually that was my third option, but not sure if it's very good also..
    Here is a simple scenario:
    User must select between 2 radio buttons:
    1) no volume -> sets variable volume=0 and selects the radio button (that is the normal use case)
    2) set volume -> opens up a pop up with a list that has a X button to close and 4 options: 25% volume, 50% volume, 75%, 100%
    At this point the set volume radio button should not be selected and the user has 2 choices:
    -> hit the X button to close - nothing changes and no volume radio button is still selected and volume is still = 0
    -> hit one of the volume % buttons -> the set volume radio button gets selected and the variable volume=25/50/75/100 depending on the button selected by the user.
    That's a pretty common scenario and it's bugging me that I can't easily alter the radio button selection logic since whenever I click it, it gets selected and I can't put a logic in between in a standard way. This should apply to any component with selection, just like ButtonBar has it with the Changing event.
    So is there any other more convenient way to accomplish this scenario that you could recommend?
    Thanks!

  • How to prevent Apply button from automatic execution

    I'm using OBIEE 11.1.1.5.
    When user enter my dashboard he can see section with many prompts and some chart based reports below.
    Usually, when entering the page the reports are executed with default prompts values and it may take a while.
    Only after most of reports are being generated, user is able to open the listboxes in the prompts and select his desires.
    The listbox is not filled quick since the DB is busy on the reports execution.
    My question is:
    Can I prevent the reports to be executed automatically when entering the dashboard?
    I would like user to click on Apply in order to get results.

    Hi,
    Tune up your RPD,
    Make sure that joins are implemented correctly,
    use cache management to increase the performance to load.
    login to em and in overview you will get the cache management their also u can increase the performance
    even in RPD also u can tune the cache management to increase the perfrmance.
    Regards
    VG

  • I am trying to surf the Net and every time I click the SAFARI button, a window pops up saying that this application was closed all of a sudden

    I am trying to surf the Net and every time I click the SAFARI button, a window pops up saying that this application was closed all of a sudden. What can I do to solve this problem?

    How are you connecting to this website?

  • How to detect the HTML extension window close in In-design? Does the In-design throws any event on opening/closing of extensions?

    How to detect the HTML extension window close in In-design? Does the In-design throws any event on opening/closing of extensions?
    I have a HTML extension running in In-design CC 2014 version.
    I want to perform some required set of actions before my extension window is closed(by clicking on the cross button on top right corner).
    Does In-design throws any event for it? Or can we capture it using C++ plugin in some way?

    Naah.......haven't got any event for that yet.
    Although, since HTML extensions are using chromium browser,  as a workaround, u can attach listener to HTML onClose event, but it won't solve any purpose if you
    are looking to logout session or do some business login in your code.

  • In v3.x clicking my programmed "close" mouse button closed only active tab, in v4 it closes entire program, how do I change it back?

    One feature I loved in Firefox v3.6 was closing tabs with a programmed mouse button. My Microsoft Intellimouse has a button that I programmed for the "Close" command. In 3.6, clicking this button would only close the active tab I was on. This made for fast opening and closing of tabs. It's the main feature that made me ignore all other browsers actually.
    Now I got updated to v4. And now, clicking my mouse's Close button closes out the Firefox window completely, just as though I'd clicked the window close "X" in the upper right.
    How can I get it back to the way it was in 3.6?

    I have the same problem with a Microsoft Comfort Optical Mouse 3000.
    The problem with the mapped close button closing the program, instead of tabs, only happens in Firefox 4.0.
    The close button works correctly with Chrome 10, IE8 and Firefox 3.X.

Maybe you are looking for