How to close JFileChooser dialog only while using ESC key ?

Hi All,
I am using a Frame and from this frame i am calling the JFileChooser via a JButton.
and using JFileChooser ShowOpenDialog() for open and close .
while doing ESC operation my Main Frame is getting closed with JFileChooser dialog.
Can i close only JFileChooser dialog while doing ESCAPE key operation.
I Have Escape key function in Main Frame file and JFileChooser file( EscKeyEventActionIntialization)
But while debuging i am not able to catch the esc key action inside EscKeyEventActionIntialization.
I have attached the code, please suggest me , if i need to do any change .
* To change this template, choose Tools | Templates
* and open the template in the editor.
package MainPackage;
import javax.swing.filechooser.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.*;
public class SourceSettings extends javax.swing.JDialog{
    JDialog dialog;
    private javax.swing.JFileChooser jFileChooser1;
    MainFile  mainFile;
    ImageIcon icon = new ImageIcon(getClass().getResource("/Resource/mchpIcon.GIF"));
    /** Creates new form SourceSetting */
    public SourceSettings(MainFile  pMPFS) {
        dialog = new JDialog();
        dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        mainFile = pMPFS;
        jFileChooser1 = new javax.swing.JFileChooser();
        dialog.add(jFileChooser1);
        EscKeyEventActionIntialization();
        jFileChooser1.setDialogTitle("Browse For Folder");
        jFileChooser1.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11)); // NOI18N
        jFileChooser1.setName("Browse For Folder"); // NOI18N
    public String getDirctoryPath()
        int retval = jFileChooser1.showOpenDialog(dialog);
        dialog.setVisible(true);
        if(retval  == JFileChooser.APPROVE_OPTION)
            return jFileChooser1.getSelectedFile().getAbsolutePath().toString();
        else
            dialog.setVisible(false);
            dialog.dispose();
            return null;
    public String getParentDirctoryPath()
        return jFileChooser1.getCurrentDirectory().getAbsolutePath().toString();
    public String getOutputDirctoryPath()
        if(jFileChooser1.showOpenDialog(mainMpfs)  == JFileChooser.APPROVE_OPTION)
           return jFileChooser1.getCurrentDirectory().getAbsolutePath().toString();
        else
           dialog.dispose();
           return null;
    private void EscKeyEventActionIntialization()
        Action  ESCactionListener = new AbstractAction () {
          public void actionPerformed(ActionEvent actionEvent) {
            dialog.setVisible(false);
            dialog.dispose();
        KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, true);
        JComponent comp = dialog.getRootPane();
        comp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(stroke, "ESCAPE");
        ActionMap actionMap = comp.getActionMap();
        actionMap.put("ESCAPE", ESCactionListener);
}

You have a class that extends JDialog and has a JDialog member variable (very confusing), and no main(...) method. How is the class used as a JDialog?
To get better help sooner, post a SSCCE that clearly demonstrates your problem. Note that this should be executable and should not contain any extraneous code.
db

Similar Messages

  • Export dialog only for use with teleprompter?

    I tried the official Story Plus teleprompter and didn't care for it (plus it has the same problem I'm having now).
    HOW do you export dialog only from Story Plus for use with a teleprompter?
    I've exported a TXT document and it included everything.  Additionally, it kept the formatting, so I have to go into a text editor and remove all the spaces.  Otherwise my dialog is a mess in the prompter.
    Any thoughts on how to get this working?
    Thanks,
    Paul

    If you want to export just the dialogs from the story, you can try out Breakdown Reports (Authoring view : Production - > Breakdown Reports). You can try "Character..." or "Custom Report..." to see if it serves your purpose. It will generate csv file for you.
    Thanks

  • How do I sort or reorganize while using the new Numbers 3.0

    How do I sort or reorganize while using the new Numbers 3.0; I can't seem to find the sort icon.
    Thanks
    ActiveSolutions

    Yes, I understand the convenience of the old Reorganize panel. I thought it was great. The problem is (I'm guessing) that it is really hard to do something like that in Numbers iOS and Numbers for iCloud. So they gave us features that are more likely to work across all platforms.
    If you need to sort just selected rows you could put the =A&C&B formula (or whatever order you need) in just the rows you need to sort. Leave the other cells in column D blank.
    Or, if you're doing a LOT of partial sorting like that maybe you should have the data in separate tables anyway.
    Not saying it's great... just saying there are workarounds... until (if) something like the Reorganize panel comes back by popular acclaim. 
    SG

  • How to improve the load performance while using Datasources for the Invoice

    HI All,
    How to improve the  load performance while using Datasources for the Invoice . Actually my invoice load (Appx. 0.4 M records) is taking very long time nearly ~16 to 18 hrs  to update data from R/3 to 0ASA_DS01.
    If I load through flat file it will load with in ~20 Min for the same amount of data.
    Please suggest how to improve load performance.
    PS: I have done the Inpo package settings as per the OSS note.
    Regads
    Srininivasarao.Namburi.

    Hi Srinivas,
    Please refer to my blog posting [/people/divyesh.jain/blog/2010/07/20/package-size-in-spend-performance-management-extraction|/people/divyesh.jain/blog/2010/07/20/package-size-in-spend-performance-management-extraction] which gives the details about the package size setting for extractors. I am sure that will be helpful in your case.
    Thanks,
    Divyesh
    Edited by: Divyesh Jain on Jul 20, 2010 8:47 PM

  • How to close parent window when we use call method l_window_manager- create

    hi...
    how to close parent window when we use call method l_window_manager->create_external_window
    thank you.

    hi
    good
    go through this link,hope this ll help you to solve your problem
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/63a47dd9-0b01-0010-3d8e-de27242bf011
    thanks
    mrutyun^

  • Click produces menus instead of desired action.  Menu can be cleared using esc key, but additional clicks produce more menus until I hit the lucky click that yields the desired action.

    Magic mouse & trackpad "clicks" produce menus instead of desired actions. Menus can be cleared using esc key, but additional clicks usually produce menus until I hit the magic click that initiates the desired action.  How can I deactivate the menus that appear?

    Sounds like your left click is set to right click. Read this: http://magicmousehelp.com/change-primary-click-magic-mouse/

  • How to use an iPad 2 for web search (via 3G only) while using AirPrint via Airoprt express wifi (NOT connected to the internet)

    Heres the setup: I have an IOS 7 iPad 2 that I want to use 3G only for web searches/ emails while using an Airport Express generated wifi bubble (without any connected internett) to print web seraches via airprint to a wifi printer.
    The problem: the ipad deafults to searching via the AE's wifi and vainly waits for the non existent interent to connect. It ignores the available 3G internet.
    The workaround: a) turn off the AE's wifi, search the web via 3G b) once I have something to print, turn the wifi back on and print via airprint and the AE's wifi to the printer.
    The question: Is there a way to turn off the AE's internet access. Using Airport utility, I have tried setting Bridge mode and static IPs to no avail. There is no turn-the-internet-off tick box.
    In the ideal setup I would like the ipad 2 to search the web via 3G only (straight away versus waiting vainly for the AE to find it!!) and then print the results via the AE's wifi and airprint without having to toggle wifi on and off all the time.....
    Thanks in advance,
    Bill...

    Hi,
    You can consider to configure the Forefront TMG Arrays or NLB.
    Planning for Forefront TMG server high availability and scalability
    http://technet.microsoft.com/en-us/library/dd897010.aspx
    Thanks.
    Jeremy Wu
    TechNet Community Support

  • How to disable CD-DRIVE checking, while using a Dolphin file manager

    Hello.
    I  would like ask for a help. I have one problem that's quite annoying. It is related to checking cd-drive when using a dolphin file menager. It always cheecks it when Dolphin is launched from K or launcher on taskbar for the first time, again it happens when i close it and open again.
    Is there a way to disable checking of cd-drive in Dolphin? This behaviour occurs on KDE with all linux system that i checked: Slackware, Arch, Kubuntu. Look at this:
    Disabling CD-DRIVE checking, while using a file manager
    I would like to disable it in order to speed up opening Dolphin, launching it.

    Udisks2 is what dolphin uses to handle external drives of all kinds (USB, optical, etc).  Udisks is an automounting tool that allows normal users to mount disks.  The permission handling before was handled with consolekit and has now been replaced by systemd-logind (which is much better anyway).  So what I am suggesting is that it might be that dolphin is using udisks2 as the tool that polls for the existence of a disc in your optical drive.
    Unfortunately, it is a bit more confusing than that because udisks2 is the replacement for the original udisks.  It is totally different and not compatible.  So I remember seeing a way to turn off optical drive polling, but I cannot remember if it was udisks or udisks2.  But it was done with a udev rule. 
    So I think if you tried to google for "udisks optical (or cd or dvd) polling" or something like that, you might be able to figure out how this is done.
    Edit: unfortunately, I do not use dolphin or udisks2.  But I do have the original udisks installed.
    Edit2: It seems that the method I remembered is for the original udisks.
    Last edited by WonderWoofy (2013-07-25 17:51:56)

  • Can't close levels dialog box by pressing ENTER key, how to fix?

    Using Windows 8.1.
    I could close the levels dialog box (CTR-L) by hitting ENTER key in CS6. Doesn't work like that in CC and I can't find a preference to change the behavior.
    Thanks in advance.

    You realise that Enter works on whatever is the active button?  That defaults to the OK button when you open Levels, and stays there if you just adjust the sliders, but will move to whatever button you click on i.e. Auto.   If you really want to use the keyboard, then hitting Shift Tab a couple of time will move you back from Auto to OK and you can then hit enter to close the dialog box.

  • How do i remove airplay icon while using screensaver

    How do I remove airplay icon from screen while using screensaver photos?

    You enter autoscrolling if you middle click with the mouse wheel on a web page.
    You can disable this feature here:
    *Tools > Options > Advanced > General: Browsing: "Use autoscrolling"
    *https://support.mozilla.org/kb/Options+window+-+Advanced+panel

  • How to export low quality png while using exportToPNGSequence jsfl command ?

    how export low quality png while using exportToPNGSequence jsfl command ?

    var mat=fl.getDocumentDOM().library[0].matrix;
    mat.a=.5;
    mat.d=.5;
    fl.getDocumentDOM().library[0].exportToPNGSequence(file:///yourfile.png,startframe,endfram e,mat);

  • [REPOST]How to force ADF Dialog / POPUP to use POST method ?

    Hi all,
    Is there any way to make ADF Dialog / POPUP to use POST method ?
    I need that approach to implement this post : [SOLVED] Faces - Preventing user from entering URL manually
    But it breaks in my application because ADF Dialog / POPUP is using GET method.
    Thank you very much,
    xtanto

    repost.
    Thank you

  • How to open a dialog box while double cliking the JTree child node.

    hi
    I am new to Swing technology.I want to open a dialog box while double clicking the child node of a tree.Could anyone please send me some examples.

    mouse listener on the tree, see if the click count is 2 and what node it clicked, open the dialog. MouseEvent can give you the click count and x/y coordinate, JTree can tell you what node is at that coordinate.

  • How to activate JMenu from other frame using accelerator key

    Hi.
    I'm developing an application for my final year project.
    i set up my application to have multiple frame open at the same time (like sunone studio in SDI mode). only one JFrame contains the JMenuBar.
    i can activate this menu bar using the accelerator key when the containing JFrame has focus. however, i donot know how to make the Menu activate when the accelerator key is pressed on other frame. press help, thanks in advance.

    does any one have some idea.
    the solution i found seem not suit my need.
    i want to be able to pull down (and get the focus transfered to) the jmenu in menubar of another frame using the menu's mnemonics. using InputMap does not seem to fit since i need to the menmonic of menu is not in the input map.

  • Runtime error ASSIGN_TYPE_ILLEGAL_CAST while using ASSIGN key word

    Hi All,
    I'm getting a runtime error ASSIGN_TYPE_ILLEGAL_CAST while using ASSIGN keyword in the below statement,
    ASSIGN L_XVALUE(L_LENGTH) TO <TEXTLINE> TYPE 'C'. "see 581444
    Here L_XVALUE is of type X with value 'ENVIRONMENTALLY HAZARDOUS SUBSTANCE, LIQUID, N.O.S' , L_LENGTH is of type I with value 51 and <TEXTLINE> is of type C wih one character length .
    Should I have to declare <TEXTLINE> as same as that of L_XVALUE ( type X ).
    Thanks in Advance,
    Sabu.

    Decalre <TEXTLINE> as type any.

Maybe you are looking for