JFileChooser issue - open at the back of the browser

Hello All,
I have a strange issue using JFileChooser. I have implemented a WebApplication with a browse option to a folder(not files). For this JFileChooser has been used. Strangely when I click on "Browse" button, the controller calls the JAVA class, and the dialog opens behind the browser (only for the first time). and next time onwards it opens on the browser only. Here is the code i have written:
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.Container;
import java.awt.Point;
import java.awt.Frame;
import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.UIManager;
import org.json.JSONException;
//few more imports for SynchronizeService, and for JSON
public class FolderChooser1 extends SynchronizeService {
     private String selectedFolder = "";
     static final String RETURN_TYPE = "text/json";
     private PrintWriter out;
     private HttpServletRequest request;
     private MessageJSON folderNameJSON;
     int folderCounter = 0;
     String saveSelectedFolder = "";
                static String selectedDirectory = "";
@Override
     public List service(Connection conn) throws IOException {
          HttpServletResponse response = null;
          List<Object> list = null;
          try {
                    super.service(conn);
                    list = serviceClientInput(conn);
                    request = conn.getRequest();
                    response = conn.getResponse();
                    response.setContentType(RETURN_TYPE);
                    out = response.getWriter();
                    folderCounter = Integer.parseInt(request.getParameter("folderCounter"));
                    if(request.getParameter("saveSelectedFolder")!=null)
                         saveSelectedFolder = request.getParameter("saveSelectedFolder");
                    System.out.println("**** Save selected folder:"+saveSelectedFolder);
                    if (folderCounter > 0)
                         System.out.println("**** Folder Count:"+folderCounter);
                         //dialog(new JFrame(), "Browse For Folder", new File("/"+saveSelectedFolder));
                         dialog(new JFrame(),"Browse For Folder");
                    else
                         System.out.println("** In else");                         
                         //dialog(new JFrame(), "Browse For Folder", new File(System.getProperty("user.home")+ "/Desktop"));
                         dialog(new JFrame(),"Browse For Folder");
                    if (selectedDirectory != "") {
                    folderNameJSON = new MessageJSON();
                    folderNameJSON.setMessage(selectedDirectory);
                    out.write(folderNameJSON.toJSONString());
               } catch (JSONException je) {
                    System.out.println("****");
                    je.printStackTrace();
               } catch (Exception e) {
                    System.out.println("*********");
                    e.printStackTrace();
          return list;
                public static void dialog(Container frame, String title) {
          while (!(frame instanceof Frame)) {
               frame = frame.getParent();               
          try {
               UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
          } catch (Exception exception) {
               exception.printStackTrace();
          JFileChooser dirChooser = new JFileChooser();
          dirChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
          if (selectedDirectory!=null | selectedDirectory==""){
               dirChooser.setCurrentDirectory(new File(selectedDirectory));
          dirChooser.setDialogType(JFileChooser.OPEN_DIALOG);
          dirChooser.setDialogTitle(title);
          dirChooser.setMultiSelectionEnabled(false);
          dirChooser.setAcceptAllFileFilterUsed(false);
          dirChooser.setEnabled(true);
          dirChooser.setVisible(true);
          // Display the folder chooser dialog:
          int returnVal = dirChooser.showDialog(frame, "SELECT");
          // If a folder was chosen:
          if (returnVal == JFileChooser.APPROVE_OPTION) {
               System.out.println("Is selected a directory:"+dirChooser.getSelectedFile().isDirectory());
               selectedDirectory = dirChooser.getSelectedFile().getAbsolutePath();
               //selectedDirectory = dirChooser.getCurrentDirectory().getAbsolutePath();               
               System.out.println("**** selected Directory:"+selectedDirectory);
          }else if (returnVal == JFileChooser.CANCEL_OPTION) {               
               selectedDirectory = selectedDirectory;
}So please let me know where it is going wrong.
Thank you.

showDialog(frame) didnot work for me.
Sorry, I have to resolve it as earlier as possible, hence I took all the possible ways to find a solution and posted the query in other forums also.
Kindly help.

Similar Messages

  • FireFox 3.6 and Adobe Reader X. Reader X PDFs opened within the browser contain links, which do not work. Anyone got clues on why the links fail and how to fix?

    When we rolled out ReaderX and AcrobatX we uncheck the Diaply PDF in Browser window. OK with IE, but ignored in FireFox (3.6.16). We can live with that except the PDFs have links to other URLs and clicking on them is ignored. Same PDF opened outside the browser the links work fine. FireFox with Reader 9.4.0 no problem. Reader X with IE no problem. I can fix the Display in Browser with a change to firefox.js, but have not figured out how to fix the links when the PDF is displayed within the browser.

    My replies are in Bold.
    Thank you for your response and message.
    1. Are you seeing this problem with all kinds of PDF's or some specific  kinds like secure PDF's (with doc open password or printing  restrcitions), reader extended PDF's or PDF forms.
    This problem is with all kind's of PDF's.
    2. Are you opening a locally saved PDF by doing a drag drop in the  browser or right click and open with IE/FF or directly opening a PDF  hosted on the internet?
    It doesn't matter. However I do it, I see this problem in Firefox, IE & Google Chrome.
    3.  Can you also check the version of the Reader X browser plugin? you  could find it at C:\Program Files\Common  Files\Adobe\Acrobat\ActiveX\AcroPDF.dll. Right click -> Properties  -> Details
    If version is 9.0.x then you could try a clean install of Reader X.
    I have checked it. It's the latest plug-in (though at the moment, I have gone back to Adobe Reader 9.4.1, as I've mentioned before, because I need the reader to be working fine for my work and daily life. I am just waiting for a fix before I try Adobe Reader X again.
    As I've mentioned before, I am seeing this issue ONLY on my Windows 7 Ultimate (Laptop). In the desktop's at work, with Windows XP / Vista, I don't see it. Adobe Reader is working fine, browser integration is fine, the floating tool bar works fine, the right click menu pop' up where the right click is done...I can also save PDF' from the main toolbar at the top and so on...
    I really have run out of ideas.... and I am very surprised that no expert support personnel (if at all there is one) have dropped by or said anything or mentioned anything about this.
    Anyway.... Cheers.

  • InfoPath form opens in the browser instead of InfoPath Filler when a link is clicked from the Approval Task email

    I have an admin approved InfoPath 2010 form that is web enabled. It is published to a SharePoint 2010 Forms library and an Approval Workflow is attached to it.
    The form needs to open up in the InfoPath Filler with the Workflow Task bar at the top so users can approve the task from within the form and not go to Tasks list to do so.
    Here's a problem I am experiencing: sometimes the form opens in InfoPath Filler and sometiems it opens in the browser when the link to approve the form is clicked form the email that is sent by the workflow.
    Windows 7, IE 9, MS Office 2010:
    The form opens up in InfoPath filler like it supposed to. The Workflow task bar is there for users to approve the form.
    Surface Pro with Windows 8.1, IE 11 and MS Office 2013
    The form opens up in the browser and there is no Workflow task bar at the top.
    Things that I've already looked at and tried which didn't solve the issue:
    - The forms library is exclusivly set to open documents/forms in the Client Application
    - Set the browser compatibility mode in IE 11, that doesn't work too well, because you have to do it every time you open the browser.
    - Setting browser compatility in IE 11 reintroduced another issue, of multiple login promts, which was fixed by entering the SharePoint site in question into the Trusted sites by a group policy. Adding the site to trusted sites made the forms open up in the
    browser.
    - Researched compatibility issues with InfoPath and Windows 8.1, cannot find anything.
    - Researched compatibility issues with InfoPath 2010, Windows 8.1 and SharePoint 2010, also didn't find anything.
    Can someone offer a suggestion on how to fix this problem, preferably with no code, because we are not allowed to put custom code on the server?
    I need to force InfoPath form to open in InfoPath Filler when the link to the form is clicked from the Workflow email. Also the login prompts should not pop up. Need it to work on all the platforms: Windows 7, and Surface Pro Windows 8.1.
    Thank you.

    Hi,
    Thank you for your response.
    [Steps about how to capture the capture the fiddler log]
    ===========================================
    1. Download fiddler from
    http://fiddler2.com/
    2. Install fiddler and launch fiddler.
    3. When the fiddler be launched, the log will be enabled automatically.
    4. You can click “X” to remove all the records before you reproduce the issue.
    5. If the web site has been configured to https. Please enable https option:
                 Click “Tools” -> “Fiddler Options”            
    Switch to HTTPS tab, then check “Capture HTTPS CONNECTs” and “Decrypt HTTPS traffic”.
    6. Then repro the issue.
    7. Click “File”->”Capture Traffic”, uncheck the Option “Capture Traffic” to make sure the “
    ” is not shown, that mean the logs has been stopped.
    8. Click “File”->”Save” ->”All sessions”, save the file.
    Any quesitons, please let me know.
    Best Regards,
    Dats Luo

  • I downloaded Firefox 4 Beta and everytime I tried to open up the browser, I get a message stating I need to reboot the computer in order to complete the upgrade; I've rebooted the computer at least 4 times.

    I downloaded Firefox 4 Beta and everytime I tried to open up the browser, I get a message stating I need to reboot the computer in order to complete the upgrade; I've rebooted the computer at least 4 times. I even tried to download a previous version of Firefox and I am still getting the same message that I need to reboot the computer in order to complete the previous upgrade.

    I have a very similar problem myself. Error 42408. And my phone isnt being recognized. I have restored my phone with no luck. I completely uninstalled itunes and reinstalled and it worked then when I ejected unplugged and plugged it back in it had the same problem over again.. I have no idea what to do?

  • Is there a plug-in yet that will allow pdf forms to be opened in the browser and submitted?

    Is there a plug-in yet for Firefox that will allow pdf forms to be opened in the browser (instead of downloaded), and then submitted to an e-mail address using the submit button on the form? I finally installed the plug-in that allows a pdf to open in Firefox and not downloaded, but the Submit button doesn't work.

    Help. Same issue.

  • Hi there I have updated to your lates version but every time I open up the browser and new windows I get this error message 'TypeError: Components.classes[cid] is undefined' although it does work but the message is very annoying

    Question
    Hi there I have updated to your lates version but every time I open up the browser and new windows I get this error message 'TypeError: Components.classes[cid] is undefined' although it does work but the message is very annoying

    This issue can be caused by an extension that isn't working properly.
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    * https://support.mozilla.com/kb/Safe+Mode
    * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • Anyway to download a file right from acrobat without it opening in the browser.

    I have created a simple interactive order form for our dealers. I intend to deliver the form via email, specifically mailchimp. However, in mailchimp when linking to a file it opens in the browser. This is an issue because the submit button doesn't function properly in some browsers, i.e Firefox and Chrome. Is it possible to download a file to your computer right from Acrobat, or is there a simple way that I could program the file to download to the computer instead of the browser within mailchimp. I am not a programmer, so I didn't know if this was an option or not.
    Thanks

    Can't you just include the PDF as an attachment to the email?

  • I've installed the Adobe Reader Plug In. Yet every time I click to see a PDF, it opens another browser and it is blank. The Browser reads about:blank. How can I fix this so that PDF's open in the browser?

    I've installed the Adobe Reader Plug In. Yet every time I click to see a PDF, it opens another browser and it is blank. The Browser reads about:blank. How can I fix this so that PDF's open in the browser?

    Check your settings in Options > Applications: https://support.mozilla.com/en-US/kb/Opening%20PDF%20files%20within%20Firefox#w_check-firefox-settings
    Also see:
    *https://support.mozilla.com/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox
    *http://kb.mozillazine.org/File_types_and_download_actions
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You need to update some plug-ins:
    *Plug-in check: https://www-trunk.stage.mozilla.com/en-US/plugincheck/
    *Shockwave Flash (Adobe Flash or Flash): [https://support.mozilla.com/en-US/kb/Managing%20the%20Flash%20plugin#w_updating-flash Updating Flash in Firefox]

  • Since upgrading to v 4.01 I am unable to print from a .pdf opened in the browser. How can I fix this?

    Since upgrading to v 4.01 I am unable to print from a .pdf opened in the browser. How can I fix this?
    I can save the page, open in Adobe Reader and print. When in the browser the File - Print command does nothing. Printer screen does not open.
    Windows XP, all updates installed.

    Hi,
    One thing to slow it down: low ink. Please check ink cartridges and replace if required.
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • PDFs do not open in the browser since IE11

    Hi,
    since the IE11 is installed the PDFs do not open in the browser with Adobe Reader, but directly in Adobe Reader.
    The PDFs can be filled but not saved online because they are not open in IE.
    If I disable the PlugIn in IE11 and activate again it works again indefinitely.
    Can you help me?
    PS: translated with Google Translate
    Thanks

    StolzeR wrote:
    If I disable the PlugIn in IE11 and activate again it works again indefinitely.
    This, to me, sounds like it's working.  Or perhaps a problem with the translation?

  • I have Firefox 10.0.2. and OSX 10.6.8. and the latest PDF adobe reader, and still can not open with the browser PDF files.Can someone help,pls?Thanx

    Dear Ones,
    I have Firefox 10.0.2. and OSX 10.6.8. and the latest PDF adobe reader, and still can not open with the browser PDF files.Can someone help,pls?Thanx

    see if this is helpful : [http://support.mozilla.org/en-US/kb/Opening%20PDF%20files%20within%20Firefox Opening PDF files within Firefox]
    thank you
    Please mark "Solved" the answer that really solve the problem, to help others with a similar problem.

  • Reader 11 Customization Opening Outside the Browser

    I am using Wizard to Customize my Adobe Reader 11 install. My question is, where in Wizard do I set the prefrence for opening PDF's outside of the browser. I just see how to configure it to open and save but nothing to set it not to open in the browser.

    Browser integration is not on by default. The default is "open PDFs in the standalone product."
    Ben

  • EML files are not opened in the browser

    EML files opened from a SharePoint 2010 document libraries are not opened in the browser. Instead, a dialog box is opened and prompts to save the file.  
    Since there's no standard application that knows how to handle EML files, and since the EML format is built into SP (send emails to document libraries), I think this behavior is unacceptable.
    EML files should be opened in the browser, similar to SP 2007.  

    Seems the solution is in the client side configuration.
    If eml files (as all other file types) are not configured to open by default in Outlook 2007 (or Windows Live Mail), they will be prompted for download or open.
    The registry change link I provided earlier did not work for me. I tried this:
    http://webcache.googleusercontent.com/search?q=cache:-hgG6T55trAJ:john-h-selnes.spaces.live.com/blog/cns!6C7F16530F119E8D!3092.entry+how+to+configure+sharepoint+to+opem+eml+file+in+outlook+2007%3F&cd=1&hl=en&ct=clnk&gl=us&source=www.google.com and
    solved my problem. Seems by default eml file set to MIME message/rfc822 and associated with windows live mail - SharePoint team hates Outlook team, right?
    If you do not have such assoication, it opens in browser!
    My settings: MOSS 2007, windows 7, outlook 2007.

  • Modzilla does not open as the browser. I get an AVG browser instead. How do I get the Modzilla browser back?

    Updated FireFox and now the SEARCH page opens with AVG browser. Have uninstalled and then reinstalled FireFox but still get AVG as the browser.

    First of all update Firefox, you appear to be using Firefox 5 which is old, unsupported, and not secure.
    * obtain a copy of the installer from <br />http://www.mozilla.org/en-US/firefox/all/
    ** there is no need to uninstall Firefox first. Do NOT use any option to remove personal data as that will destroy bookmarks and passwords.
    *an alternative easier method that may work is to use <br />'''Help -> About Firefox -> []check for updates'''
    I am guessing the ''AVG browser'' is some sort of toolbar or Firefox extension. Please see
    #[[Remove a toolbar that has taken over your Firefox search or home page]]
    #(CARE ! ) Thread "How to remove AVG Secure Search the manual way" [/questions/936670]
    Try the first method initially. The second method may not be applicable in your circumstances, and involves direct editing of the registry, something to be avoided unless there is no alternative.

  • If i want to open firefox the browser opens but it instantly becomes black, i can close or minimize it but it still remains black

    firefox worked perfectly al these year, but suddenly it just became black when i open the browser. just for a couple of seconds the browser shows everything but than it becomes black. i can minimize and close it but nothing happens. i tried clicking anywhere but no results, please help

    hello jay25, [https://support.mozilla.org/en-US/questions/940393#answer-377118 from another user] we found out that this might be related to malware active on your pc. please close all firefox windows and try [[Troubleshoot Firefox issues using Safe Mode|running firefox in safemode]] (by pressing the shift key while you're starting it). in firefox safemode go to firefox > addons > extensions and remove the entry named "Codec v1.0" or any other addons that look suspicious & you have not installed intentionally. afterwards see if you can run firefox normally again...
    please also do an in-depth scan of your system with the security software already in place and/or a different tool like the [http://www.malwarebytes.org/products/malwarebytes_free free version of malwarebytes] & keep firefox and your plugins up-to-date in order to stay safe on the web.
    [[Troubleshoot Firefox issues caused by malware]]
    [[Update Firefox to the latest version]]
    https://www.mozilla.org/plugincheck/

Maybe you are looking for

  • Can I install Bootcamp on an External Hard Drive?

    *Bootcamp on External Hard Drive?* Can I install Bootcamp on an external Hard Drive? I don't see why it wouldn't work. Do I need to install the Mac OS on the external Hard Drive first, then Bootcamp? Parallels Another question. Does Parallels allow y

  • Applet Reloading

    In my applet I have global variables that change. Is there anyway to reload the applet at anytime so that the state of the global variables reset to their original values? Thanks

  • Portal integration with Exchange server 2003 issues.

    Hello, We are using NW04s EP 7.0 SP16 and Exchange server 2003. We are trying to perform OWA and Groupware integration. Both the servers are in the same domain. I have followed all the steps in the notes and documents available there in SDN. There ar

  • Subset of an Vector

    Hi, i have an vector and i want to get another vector that is a part of that initial vector just like the substring function of a string gives an subset of the initial string. Can anyone tell me if there is an simple way of doing this, rather than do

  • New Video / TV Show alerts

    You know how Amazon has a list of "new and future" DVD releases - why can't iTunes do the same thing? I'm tired of checking back all the time looking to see if there are any new shows worth of downloading. Is there any type of list or alerting servic