How to open a browse a folder dialog box

Hi,
Please tell me,
how to open a 'browse a folder' dialog box in java SE. I dont need showopenDialog or showSaveDialog methods.
User have to be prompted to select a folder(not a file), and clicks on 'OK'. That path have to come in a text field.
In my program user has to give a folder path....

bhuvanavijayam wrote:
Thank you very much..........
i got the answer............ we have to set
jfilechsr.setFileSelectionMode(1);
1 -> DIRECTORY_ONLY
No!
Never use "Magic Numbers" They may change in a future verison and your code will break. Also anyone who reads your code (that includes you, months/years from now) won't know what the code is supposed to do.
jfilechsr.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);Not DIRECTORY_ONLY
db

Similar Messages

  • How do I call browser Save As dialog box before downloading pdf files?

    How do I call browser Save As dialog box before downloading pdf files?
    Here's my favorite scenario:
    1. User clicks button
    2. Save As dialog displays
    3. User chooses location
    4. A set of PDF files download to that location OR a single zip file downloads
    Background:
    I want to ensure the user sees that files are being downloaded. I'm delivering content to users who may not be Web savvy.
    Concern:
    1. User has no clue how to find downloaded files or that files have even downloaded.
    2. I'd like to deliver the set as zip files. Not sure if self-opening zip files still exist.
    FYI:
    I'm using jQuery UI buttons. Not sure if that factors into response.

    Just for clarity, I'm not forcing a download. The user will click a button.
    Click a button or click a link, either way you're technically executing a script to force a download.
    I'm assuming that's the php file resident on the server.
    Yes but that's only part of it.  Once the contact form executes, another script is called up which opens the browser's download dialogue.
    Is there a php script for simply calling the Open/Save dialog box?
    Yes. 
    <?php
    /* This short script forces a file download.
       For simplicity, it's intended to be used for a single file.
       You can use multiple copies of this file (with unique names)
       with different variable values to use it with multiple files.
       Use of this script has a side-effect of hiding the location of the
       file on your server.
    // full server path to file to be downloaded (including filename)
    $Path2File = "path/to-file-on-server.zip";
    // the filename
    $theFileName = "name-of-file.zip";
    //the work gets done here
    header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header ("Content-Type: application/octet-stream");
    header ("Content-Length: " . filesize($Path2File));
    header ("Content-Disposition: attachment; filename=$theFileName");
    readfile($Path2File);
    ?>
    Name this file zip2download.php.
    Add a link to your HTML page:
    <a href="zip2download.php">Download Zip</a>
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web.blogspot.com/

  • Export presets now direct me to the "Browse For Folder" dialog box

    Suddenly Lightroom will not remember the name of the "export to" folder when I use my export presets in certain ways, even though the name of the "export to" folder appears in the "Export" dialog box. The prolem exists in Library and Develop modules. This is what's happening…
    IF I CLICK ON "FILE":
    1. And choose the "Export" option, LR displays the Export dialog box, from which I can select an user preset and export a JPG file to the proper folder, as intended. (OK) 
    2. And choose the "Export with Previous" option, LR exports the JPG file immediately to the proper folder. (OK) 
    3. And I choose the "Export with Preset option, LR displays the menu of Lightroom presets and user presets, but clicking on a user preset displays the "Browse for folder" dialog box from which I must manually browse to the export folder before a file can be exported. (NOT OK) 
    IF I RIGHT-CLICK ON THE IMAGE:
    LR displays a menu containing these options: Export, Export with Previous, the Lightroom presets, and my user presets. 
    4. If I then choose "Export," LR works properly---same as example 1 above. (OK) 
    5. If I then choose "Export with Previous," LR exports the JPG file immediately. (OK) 
    6. If I then choose one of my presets, LR does not work properly: it acts as it does in example 3 above. (NOT OK) 
    BACKGROUND:
    I have been using these presets for almost a year without fail---they're great! Two days ago I moved my Lightroom catalog to a new external drive. I also renamed the "export to" folder (that new name is stored in the "Export" dialog box). 
    I sure would appreciate hearing from anyone on this because it's driving me crazy. Thanks.

    SOLUTION FOUND:
    I created yet another folder for storing exported JPGs. Then for each export preset I used the "Browse For Folder" dialog to point that preset to that new folder. All presets now work as before. This fix was tolerable for the seven presets I have, but a large number of presets would have made it a real chore.

  • Recently, whenever I try to open Firefox, I get a dialog box: Exc in ev handl: TypeError: brw is undefined (JavaScript Application). Firefox is definitely my default browser

    Question
    Recently, whenever I try to open Firefox, I get a dialog box: Exc in ev handl: TypeError: brw is undefined (JavaScript Application). Firefox is definitely my default browser.
    After clicking OK Firefox opens.

    Doesn't work out for me either, so I keep it disabled, because it slows down the searches, and it won't stream its additions onto the pages after the first page of search results. Streaming or page zipping allows me to scroll down to the next page of search results without selecting the page number.

  • How to open the browser in a Tab

    How to open the browser in a new Tab when click on the URL.
    My problem is i have one DataGrid that contains
    "Name,Designation,Company URL".
    After running the program Name,Designation,URL are displayed
    in the DataGrid .
    I have Four URL's in Datagrid ,the four URL's are opening in
    the different tabs when the user click on the URL.
    How can i do these three things in Flex.
    Thanks & Regards,
    Srinivas.

    Hi,
    Please check the sample in the URL below.
    http://raghuonflex.wordpress.com/2006/12/07/flex-i-frame/
    Hope this helps.

  • Browse For Folder Dialog

    I am trying to display a "Browse For Folder" dialog
    Note that this is not the JFileChooser with the DIRECTORIES_ONLY flag
    It is this one
    http://i.msdn.microsoft.com/Bb964683.ed6b0efa-d190-4995-861d-abc3571b06ac(en-us,office.12).gif
    There have been several posts over the years on these forums asking similar questions without answers.
    I can't believe that noone has ever made one since so many people want this functionality.
    There doesn't appear to be one in the Swing Package.
    Does anyone know of a free jar that contains this?

    JDirectoryChooser
    And while we are with choosers, we might also want to try the folowing choosers for colors and dates:
    [Quick Color Chooser|https://colorchooser.dev.java.net/]
    [MultiDateChooser |http://www.javafr.com/codes/SELECTEUR-DATES-MULTIPLES_48407.aspx] (to download the zip you must be connected with your CodeS-SourceS account wich is totally free)
    Edited by: Andre_Uhres on Feb 23, 2009 6:02 AM

  • How do I get rid of a dialog box that keeps coming back even though I press Cancel?

    How do I get rid of a dialog box that keeps coming back even though I press Cancel?

    I was looking up Olympic stats on  Norwegian website, and must have inadvertently clicked a link. The dialog box says: "There is no application set to open the URL nasjoner:2"
    It goes on to tell me to search the App Store , choose an application, or cancel.

  • How do I get rid of a dialog box stating.

    How do I get rid of a dialog box stating - Were sorry but the browser you are using doesn't support the community toolbar?

    Did you install Community Toolbar and deleted it and the pop up continues, or do you want to use it but on a different browser? Which browser are you using? This article might not be what you want http://reviews.cnet.com/8301-13727_7-20027867-263.html If you want to get the right version you need to go to the Conduit site http://www.conduit.com/ and get the right one, I think.

  • How can i call the certificate selection dialog box from source code?

    How can i call the certificate selection dialog box from source code?
    NB: Of course if i have more than one certificate in the Microsoft Keystore 'My'.
    Thank You in advance

    I found an example of the "TestStand UI Expression Control.ctl" and it works just the way I need it. (check the link)
    Proper use of "TestStand UI ExpressionEdit Control" in LabVIEW http://forums.ni.com/ni/board/message?board.id=330&requireLogin=False&thread.id=10609 
    The "Expression Browser Dialog Box Button" F(x) stays disable while editing the VI, however it become available when the VI is called from TestStand.
    Thank you,
    Hecuba
    Mfg. Test Engineer
    Certified LabVIEW Associate Developer

  • Why does it take so long for the Open, Save, or Save As Dialog Boxes to Open?

    I'm having a problem throught CS6 with the Open, Save, or Save As dialog boxes not opening for a period of time after clicking on the desired functions.  It can take over a minute just to get the Open dialog box up to browse for a file.  Eventually, the dialog boxes open, but during the time that it's trying to open, the program is unresponsive.  It is happening with all of my CS6 programs.  I have unistalled and reinstalled with no fix.  The programs are updated.  Anyone else having this trouble?  Any solutions?

    Thanks for your response.  The system is a Windows 7 64-bit system with 4GB RAM installed.  I am not trying to save anywhere in particular.  By default, it would open to the user's documents, and does eventually, but it currently just sits for about a full minute before doing anything.  This machine was saving properly when CS6 was first installed about 5 months ago. 
    I've checked for unconnected network drives. I've also renamed the Illustrator preferences file based on a reccomendation that I found elsewhere.  However, neither of these helped.
    I can provide screenshots or anything else that's needed.

  • How to create application toolbar in modal dialog box in selection-screen

    Hi Experts,
    how to create application toolbar in modal dialog box in selection-screen?
    Regards,
    Swapnika

    Hi,
    Check the following link regarding Model dialog box and appication toolbar
    http://help.sap.com/saphelp_nw70/helpdata/en/d1/801b84454211d189710000e8322d00/frameset.htm
    It helps in solving your problem.
    Thanks.
    Ramya.

  • How to set width for this modal dialog box?

    Hi All,
    How to set width to this modal dialog box:
    <input id="btnVote" onclick="javascript:SP.UI.ModalDialog.showModalDialog({ url: &#39;../Lists/Sports%20Activities%20Voting/NewForm.aspx&#39;, title: &#39;User Survey&#39;}); return false;" type="button" value="Vote"/>
    Thanks in advance!

    set as bellow:
    <input id="btnVote" onclick="javascript:SP.UI.ModalDialog.showModalDialog({ url: &#39;../Lists/Sports%20Activities%20Voting/NewForm.aspx&#39;, title: &#39;User Survey&#39;,width:700,height:350}); return false;" type="button" value="Vote"/>
    yaşamak bir eylemdir

  • How do I get rid of the dialog box and audio that is in the bottom left of the screen that keeps telling me what I'm doing or need to do?

    How do I get rid of the dialog box and audio that is in the bottom left corner of the screen running script and audio of  what I'm doing or need to do?

    Go into System Preferences, select Universal Access, turn off Voiceover.

  • How can i invoke a file chooser dialog box with out using input type=file

    how can i invoke a file chooser dialog box with out using <input type=file> can any one help me mail me to [email protected]

    You could use an applet...
    Or maybe Javascript has some way to do it.

  • How do I stop the "drag firefox into the applications folder" dialog box from opening every time I open Firefox on my iMac?

    When I installed Firefox on my iMac, a dialog box appeared telling me to drag the Firefox logo into the Applications folder, which I did. Firefox works fine, but every time I open it this dialog box opens before Firefox does, and I have to close it out. This is irritating. How can I stop it from opening again?

    Make sure that Firefox gets installed properly.
    * [[Installing Firefox on Mac]]
    * http://kb.mozillazine.org/Installing_Firefox#Mac_OS_X

Maybe you are looking for