Directory Chooser existance?

Hi all,
I wonder if there exisist Directory chooser component (Windows like, dislpaying only directory tree).
I use know this code for getting similar effect but I am curious if I can do it in a better way. Thanks in advance.
Nenko Ivanov
JFileChooser jf = new JFileChooser();
    jf.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    if(jf.showOpenDialog(this)== JFileChooser.APPROVE_OPTION){
      File file = jf.getSelectedFile();
      if(file != null && file.isDirectory()){
        // do some stuff here
    }

The bug report for rfe 4322989 has been updated with an example directory
chooser class. Try it out!
http://developer.java.sun.com/developer/bugParade/bugs/4322989.html
Cheers,
Leif Samuelsson
Java Swing Team
Sun Microsystems, Inc.

Similar Messages

  • How can I create a directory chooser?

    hi there
    is there any way to create a directory chooser? because it is the directory that I am more interested in, but with JFileChooser, I must select a file to get a directory. help please, and thank you.

    Just a followup regarding directory choosers.
    I previously attempted to use the JFileChooser.DIRECTORIES_ONLY selection to make a directory chooser, but found that this didn't allow the user to descend into the wanted directory, then select it.
    The following code shows my attempt to resolve this. BTW, this works because the assumption has been made that when a directory is descended into, its name will appear in the file name field.
    JFileChooser browser = new JFileChooser(System.getProperty("user.dir"));
                   browser.removeChoosableFileFilter(browser.getAcceptAllFileFilter());
                   browser.addChoosableFileFilter(new DirectoriesOnlyFilter());
                   //This method will set the dialog type to custom via setDialogType(CUSTOM_DIALOG);
                   if (browser.showDialog(this, "Select") != JFileChooser.APPROVE_OPTION)
                        return;
                   File location = browser.getSelectedFile();
                   if (!location.exists())
                        String dirName = location.getName();
                        //Find the requested directory by looking at the parent directory
                        location = location.getParentFile();
                        if (location.exists() && location.getName().equals(dirName))
                             //User has descended into the wanted directory -
                        else
                             //Cannot resolve the requested directory
                   else if (location.isDirectory())
                        //The user has clicked, without descending, onto a directory in the chooser
                        //This is the directory that the user wants
                   else
                        //Oops - File found.  This should only happen in one of two cases:
                        //1) If there is a file with the same name as the directory it is in
                        //2) If the user has typed in a file name into the field
    class DirectoriesOnlyFilter extends javax.swing.filechooser.FileFilter
         public DirectoriesOnlyFilter()
         public boolean accept(File file)
              return file.isDirectory();
         public String getDescription()
              return "Directories";
    }Hope this helps.
    Rob

  • I can't log into my iTunes account. I logger out a few days ago to trouble shoot because I was trying to redeem some iTunes cards but when i pressed redeem nothing happened. Now when i press sign in and then choose existing Apple ID, nothing happens

    I can't log into my iTunes account on my iPhone 5s. I logged out a few days ago to trouble shoot because I was trying to redeem some iTunes cards but when i pressed redeem nothing happened. I then tried to log back in immediately afterwards. I was unable to do so. After clicking "sign in" at the bottom of the apps main page, it brought up another menu where I clicked "Choose existing Apple ID". After pressing this the menu disappeared and nothing happened. I tried this multiple times and received the same result each time. I tried the other available option of creating a new AP ID to log in with and that one worked perfectly fine. I am clueless as to why the log in for me is either not able to load or just completely blocking me from getting back into my iTunes account on my phone. Not only can I not listen to the music I currently have, but I cannot log in to purchase the new music that I wanted to with my unused iTunes gift cards

    I have the same problem too and tried alot of things like time zone , restarting or changing DNS of wifi connection to 8.8.8.8 still nothing happens .. !!
    iPhone 5s, iOS 8.3

  • How do I upload documents (i.e Word) rather than photos when I click on 'choose existing documents'?

    When replying to an email request to update my CV, when I click on 'upload document/choose existing document', I'm only given the option to upload my photos. I want to be able to upload documents from my GDrive, without having to start a new email. Please advise. Thanks.

    File uploads from Safari are limited to contents of the Photo app at this time. You might try an alternate app such as iUploader or iCab Mobile.

  • File directory chooser

    this code for file directory chooser runs in standalone java programs. i need it for a web app, can someone help me manipulate this to do so?
    package ETPS.web.service;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.*;
    public class DemoJFileChooser extends JPanel
       implements ActionListener {
       JButton go;
       JFileChooser chooser;
       String choosertitle;
      public DemoJFileChooser() {
        go = new JButton("Do it");
        go.addActionListener(this);
        add(go);
      public void actionPerformed(ActionEvent e) {
        int result;
        chooser = new JFileChooser();
        chooser.setCurrentDirectory(new java.io.File("."));
        chooser.setDialogTitle(choosertitle);
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        // disable the "All files" option.
        chooser.setAcceptAllFileFilterUsed(false);
        if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
          System.out.println("getCurrentDirectory(): "
             +  chooser.getCurrentDirectory());
          System.out.println("getSelectedFile() : "
             +  chooser.getSelectedFile());
        else {
          System.out.println("No Selection ");
      public Dimension getPreferredSize(){
        return new Dimension(200, 200);
      public static void main(String s[]) {
        JFrame frame = new JFrame("");
        DemoJFileChooser panel = new DemoJFileChooser();
        frame.addWindowListener(
          new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              System.exit(0);
        frame.getContentPane().add(panel,"Center");
        frame.setSize(panel.getPreferredSize());
        frame.setVisible(true);
    }

    AndrewThompson64 wrote:
    BIJ001 wrote:
    If we are talking about a web application, then the browser will use its file chooser when down- or uploading a file.++++
    The only way to shoe-horn that code into a web page is via an applet. The applet would need to be either
    a) Trusted, or..
    b) Deployed in a plug-in2 JRE and use the JNLP API services to get access to an InputStream.
    Either way, applets are a PITA for both the developer and (usually) the user. Stick to pure HTML in web-apps, wherever possible.
    Edited by: AndrewThompson64 on May 31, 2010 9:51 PMI've also seen some attempts with Google Gears. Even file drag & drop support. It works quite neat, if the user doesn't have gears installed you get a nice requester for it. Don't know what the system requirements are for that product though.

  • Can't choose existing certificate to sign/decrypt email after profile installed

    After playing with iphone configuration utiltiy
    After profile installed, I can't choose existing S/MIME sign/encrypt certificate inside the phone. But ok if I config manually in iphone.
    Is there any purpose for this? Is there anyway to let user choose certificate after profile installed?

    I just thought I would put myself on this discussion, since I can't find anything to "fix" this problem. It seems to work for some people, but not others...
    I have everything set up the same way as nebbbben. Server is set up, certificate installed, VPP set up, and everything works great for some of my users.
    For about half of my users- I can send out invites, they will click on the invite and login to the App Store, but they will never show up in Profile Manager as registered for VPP on the Mac Server. For those that do- pushing apps is easy and transparent, although there is as much as a half-hour time delay. For those that can't get registered, no matter how many invites I send them, there isn't any way to distribute the apps. It's very frustrating, and the only "answers" I can find just say it should "just work."
    I'm assigning apps to the users specifically, not to groups. I have no doubt it would work fine if the Server/VPP ever showed they were registered. The invite system seems to be hit-and-miss.
    I'm wondering if there is a command-line hack or some other setting that can be changed to reset their App Store settings to try again?

  • Integration Directory | Choose Adapter Metadata - No objects found!

    Hi friends.
    I'm new in XI and I wanted to test some simple scenarios. At the beginning I had a problem with the SLD. We made some post-installation steps and everything was allright. Thus my problem is now: In the Integration Directory I try to create a communication channel - I choose Scenario->Service Without Party -> Business System -> <myBusinessSystem> -> Communication Channel and do a right click on it. I choose NEW and create a new communication channel. But when I use display input help for Adapter Type, it is loading for a while but the list of Adapter engines is empty and there is written - No objects found!. I didn't install XI on our machines and I don't know which installation / post installation steps were done. Adapter Engine in integration server is installed for sure. I looked for some threads on the forum, but I didn't find nothing more specific for my problem. Probably I need to set up something somewhere to obtain a list of adapters for the communication channel. Any help will be rewarded.
    Thanks
    Ondrej

    Ondrej,
    You need to import SAP BASIS Software Component Version into Integration Repository.
    You need to download it from service market place.
    https://websmp205.sap-ag.de/~form/handler?_APP=00200682500000001943&_EVENT=SEARCH&HIDE=&SEARCH_SPAT=X&SEARCH_BPAT=X&SEARCH_CD=X&SEARCH_P=X&SEARCH_PV=X&SEARCH_C=X&SEARCH_CV=X&SEARCH_TA=&SEARCH_V=&HIDE_EXPERT_SEARCH=X&SEARCH_MAX_RESULT=20
    In Search Term Enter "SAP BASIS <version>".
    Then put this in the import directory: \usr\sap\<SID>\SYS\global\xi\repository_server\import\
    Now in IR, <b>TOOLS ---> Import design objects</b> and import it.
    After import you should be able to see the namespace under it.
    Regards,
    Sarvesh

  • Directory does exist

    Hi,
    Here are the current codes
    codes
    I do not know why I get
    Directory f:\dir1
     could not be accessed!
    while the folder does exist there, within the current machine. why?
    Many Thanks & Best Regards, Hua Min

    probably a network folder or something likewise that. 
    That does not really exist on your machine. Maybe it is shown in file explorer or something like that.
    To address that use an UNC path
    http://en.wikipedia.org/wiki/Path_%28computing%29#Uniform_Naming_Convention
    Success
    Cor

  • Directory Objects exists twice after converting a NON-CDB to a PDB

    After converting a NON-CDB to a PDB (originally Oracle 11g Database) I've encountered that the default directory objects like ORACLE_OCM_CONFIG_DIR exists twice. One with ORIGIN_CON_ID 1 and one with ORIGIN_CON_ID 3. That's not a real issue here except for the DATA_PUMP_DIR. The same directory name is used for two different Directory path (a new one with the path of the CDB and an old one with the path of the origin NON-CDB). With some tests I found that the "old" one is going to be used within the PDB but I don't know how to clean up the structure. Within the CDB$ROOT I can only drop the new directory and in the pdb I get the error message "ORA-65040: operation not allowed from within a pluggable database"
    Any idea?

    After converting a NON-CDB to a PDB (originally Oracle 11g Database) I've encountered that the default directory objects like ORACLE_OCM_CONFIG_DIR exists twice. One with ORIGIN_CON_ID 1 and one with ORIGIN_CON_ID 3. That's not a real issue here except for the DATA_PUMP_DIR. The same directory name is used for two different Directory path (a new one with the path of the CDB and an old one with the path of the origin NON-CDB). With some tests I found that the "old" one is going to be used within the PDB but I don't know how to clean up the structure. Within the CDB$ROOT I can only drop the new directory and in the pdb I get the error message "ORA-65040: operation not allowed from within a pluggable database"
    Any idea?

  • Install exit after directory choose without any error

    installation of Q2 30 trial exit after I choose the directory ( I try to use either default directory or my own directory), the installation program exit without any error.
    I create a file creator-2004q2-windows-en.sp or Creator-ea-windows-en.sp with is.debug=1, but still no install.log. how to deal with this.

    Given the archive name, the platform is windows.
    This sounds like a bad download.
    -Alexis

  • Create a new directory in existing Zip archive

    Hello Every One
    I want create a new folder in existing Zip archive. Can any one help in this regard.
    Thanks
    Edited by: SatishBejgum on Dec 18, 2007 12:42 AM

    Delete the ZIP, write a new one. You can't modify an existing archive.

  • Can t send photo using whatsapp on iphone 4s. Choose existing photo from camera roll then, I can only see cancel, send , key and it says press and hold over a thumbnail to rearrange but chosen photo is black... should say blank...what happened?  Re

    Dear all,
    I want to upload photo form photo gallary while using whatsapp on iphone 4s either it was blank or the statement written over " pree and over a thumbnail to rearrange" comes at the bottom of white window haveing sing of cross at top left hand side...some of pics were able to send and some of them are not pl help me..

    PORT YOUR NUMBER OUT...T MOBILE WILL PAY YOUR ETF IF YOU GIVE THEM YOUR VERIZON PHONES.

  • How can I send my resume in PDF format, when a website asks to upload one, all the options I get are choose existing ie upload a picture, or take a picture... No options are available to upload a document I am using an IPad 4 to do this..

    I am trying to send my resume, cv, up to recruitment agencies, I am using my iPad, and I have no options to upload when requested from my iPad... Can anyone offer any help... Why is the iPad so restrictive when used as a mobile office solution.

    I am trying to send my resume, cv, up to recruitment agencies, I am using my iPad, and I have no options to upload when requested from my iPad... Can anyone offer any help... Why is the iPad so restrictive when used as a mobile office solution.

  • Oracle/CDC directory not exists

    where can I find CDC.jar or CDC classes?
    How install it?

    Hello,
    This post requirment . just try to run that i mention. Or can you provide brief when get this errro.after patch installion like this or else after somethin?
    Regds,
    Suresh

  • Joining 10.8.5 with existing account to Active Directory domain

    Hi-
    I have a MacBook Pro that I am using as a test computer to figure out how to introduce the growing population of Mac's into our Active Directory environment in our small company. This comptuer is running OSX 10.8.5
    There is a test account in AD that I will be using to connect to the windows domain. I am able to get the Laptop binded to AD, and have no problem authenticating, and seeing all the network resources required.
    Here is the part that has me stumped:
    Is there any way to take my existing "local" account that was configured when I began using my MBP without Active Directory and continue to use it, but logon to the laptop using my Active Directory account?
    Perhaps copy all the settings and preferences from the local account ontop of the AD account on the laptop?
    I have been using this laptop as my personal machine for many months and have quite a few customizations made to my deskop preferences, icon layouts, etc. This will be same case with all of the users that will soon be authenticating on the domain. We need this for centralized management of network shares, password policies, and number of other security features.
    There is some limited information on the web, but nothing that I have tried really works, here's some of what i found and the difficulty that resulted.
    http://community.spiceworks.com/how_to/show/37886-convert-mac-local-user-into-ac tive-directory-network-user
    - The script mentioned in step 3 was not able to copy local account to the destination folder.
    http://robotcloud.screenstepslive.com/s/2459/m/5322/l/112415-convert-local-accou nts-to-network-mobile-accounts
    - The sudo mv /Users/USERNAME /Users/DIRUSERNAME command was not able to make the "DIRUSERNAME" directory, and did not have any effect if this directory already existed due to a prior logon.
    I'm just looking for some help making it so that my users can retain their desktop layouts that they are used to, but logon to the domain using AD credentials.
    Seems simple, but is pretty difficult to get done.
    Thanks in advance for any help....
    -Aaron

    This might help:
    http://www.afp548.com/article.php?story=20060517222656622&query=radius

Maybe you are looking for

  • FM: FP_FUNCTION_MODULE_NAME Not working

    Hi all, I am using FM:  'FP_FUNCTION_MODULE_NAME' to get function module name to be generated by smartform. But it is throwing an exception as 'Exception API (REPOSITORY)'. TRY.     CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'       EXPORTING         i_na

  • How do I upload documents (i.e Word) rather than photos when I click on 'choose existing documents'?

    When replying to an email request to update my CV, when I click on 'upload document/choose existing document', I'm only given the option to upload my photos. I want to be able to upload documents from my GDrive, without having to start a new email. P

  • A question about users assigned roles extraction

    Dear all, I have a question about users assigned roles list extraction. I need the list of the users who have already been created along with their assigned roles. According to what I found on Google, there is a table named AGR_USERS which provides t

  • Anyone have a scenario to do a file to file with xi and bw

    Hi, I am looking for a scenario that has file to file between an xi and a bw system...

  • HELP! broken glass iPhone 5s

    it was broken glass at my phone 5s gold 16gb. At official service at russia said it needs to change the phone. It will cost 16500 rur or 500$, it's so expensive. They said there is no details to fix iPhone 5S and change glass like for 5 model. Really