JFileChooser - customization

Is there a method for customizing the JFileChooser instances so that all texts displayed (example: "look in:","file type:", etc) be locale dependent?
I know about setting the title and the "Approved" button texts ... but that is all the customization I may perform?
For instance, I would like to have "Type du fichier:" instead of "File type:".
I've already tried the method "setLocale" ... it won't work.
Do I miss anything or this kind of customization is not possible for JFileChooser?
Thank you very much in advance.

Did u get the answer for that query? If u did please let me know

Similar Messages

  • Cannot cutomize ALL of JFileChooser - what are the property names?

    Setting the UIManager property JFileChooser.homeFolderToolTipText to some value seems to have no effect on my machine running jdk 1.4.1.
    I am able to customize most of the JFileChooser, for instance changing this property does work JFileChooser.lookInLabelText.
    However, I have not been able to find the correct property names of the following textual contents of JFileChooser:
    1. The column names in a detailed list view (file name, size, modified date, ...)
    2. The text and tooltip of the open button when a folder is selected (which differs from the text shown when a file is selected)
    3. The text and tooltip of the home button
    If anyone knows the way to change these properties I would be very interested in hearing from you.
    Randahl

    Hi
    WinNT4:
    1. The column names in a detailed list view (file name, size, modified date, ...)
    UIManager.put("FileChooser.fileNameHeaderText","NEW NAME");
         UIManager.put("FileChooser.fileSizeHeaderText","NEW SIZE");
         UIManager.put("FileChooser.fileTypeHeaderText","NEW TYPE");
         UIManager.put("FileChooser.fileDateHeaderText","NEW DATE");
         UIManager.put("FileChooser.fileAttrHeaderText","NEW ATTR");
    2. The text and tooltip of the open button when a folder is selected (which differs from the text shown when a file is selected)
    UIManager.put("FileChooser.directoryOpenButtonText","NEW OPEN");
    UIManager.put("FileChooser.directoryOpenButtonToolTipText","NEW OPEN DIR TTT");
    3. The text and tooltip of the home button
    UIManager.put("FileChooser.homeFolderToolTipText","NEW TTT FOR HOME");//does not work, "Desktop"
    JFileChooser fc = new JFileChooser();
    sergey

  • How to change the image of a selected File/Directory in JFileChooser while

    Hi all,
    I am trying to customize JFileChooser. Basically, I want to display a checked Icon for a selected directory(s) in JFileChooser
    I know that fileView class returns icon for directory/files, but I am not sure how to change their images on selection.
    your help is appreciated.
    Ramesh

    could you please anyone help me with this. I search all the web but I was not successful to find anything that would help me to create a custom renderer for JList component inside JFileChooser..
    if you can give me some reference websites that would be great.
    Ramesh

  • JFileChooser incredibly slow both to initialize and to change directories

    I have searched the forums for this and haven't found anything useful. I have the following code running in jre1.6.0_07:
    JFileChooser objFileChooser = new JFileChooser();
    objFileChooser.setAcceptAllFileFilterUsed(true);
    objFileChooser.addChoosableFileFilter(new CookbookFileFilter());
    objFileChooser.setMultiSelectionEnabled(false);
    if(objFileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
         getModel().load(objFileChooser.getSelectedFile().getAbsolutePath());the first line takes upwards of 20-30 seconds or more to get past when debugging - I don't know how long it takes when running without the debugger however the application does sit for a while after pressing the hotkey to activate the actionlistener. That's a problem, but if that was the only thing, I would do as another post suggested and initialize the jFileChooser from a separate thread during the initialization of the window or application...however, I also run into an issue whenever I change directories where it takes a subset of the initialization time(maybe 10-15 seconds instead of 20-30) to change the directory. This happens in both System and Cross-Platform Look and Feel-s.
    I've looked into the issue with zip files and there are no (0) zip files(or archives of any kind) in the initial directory(My Documents folder). There is a small delay going to My Computer through Windows normally but it may be 1-2 seconds at most, and only sometimes. Notepad opens the Load / Save Dialogs within milliseconds and while I do understand Java is not Notepad, I'm willing to accept a few seconds (like maybe 5 or so), but not 20-30. I also looked into potentially using JDK 7 however I can't seem to get Eclipse to work with it and it consistently uses the JDK 6.
    If a solution can not be found to this, then is there a way to hook into the dialog/control in order to change the mouse cursor to the 'wait' cursor and change it back when the directory is ready? I'd like to provide some communication to the user. Thanks!

    camickr,
    I did include a "Short, Self Contained, Compilable and Executable Example Program (SSCCE)" in my initial posting; and I also included Code Formatting as everyone can see. I've been a programmer for over 10 years, closer to 15 and have almost 8 years experience with Java so I'm not about to ask a question without investigating the solution on my own first(to avoid wasting people's time. Admittedly all I posted was the snippet but that entire snippet could be put within Main like this below and it would be exactly the same without the waste of space. The machine I have running / developing this on is: Athlon 64 3000, 1 GB RAM, about 13 or 14 total hard drive partitions and removable media drives, running under Windows XP SP2. I can even eliminate the Choosable Filter in the example as I do below and the JFileChooser takes (31 seconds on average over 5 iterations, I timed it after I originally posted this) to fully display the dialog and all files and deliver control back to the user. That is unacceptable and one can not deny that it's the class itself when FileDialog runs significantly faster and programs outside of Java executing the standard XP File Dialog run even faster still. If this code is not good enough, I don't know how much shorter or self contained I can make this code example without removing the configuration lines between the initialization and that would defeat my cause as I need the Look and feel customization and prefer not writing my own File Chooser Dialog. Here's the code w/ the main function and all.
    import javax.swing.JFileChooser;
    public class Example
         public static void main(String[] args)
              JFileChooser objFileChooser = new JFileChooser();
              objFileChooser.setAcceptAllFileFilterUsed(true);
              objFileChooser.setMultiSelectionEnabled(false);
              if(objFileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)
                   System.out.println("Approved");
    }Thanks,
    Seth

  • Prob. w/ JFileChooser in 1.4.x on Win. w/ CDF files

    I have an application which deals with files named with a .cdf extension. These files are NOT actually MS Channel Definition Files. With Java 1.1, 1.2, and 1.3, JFileChooser displayed my CDF files as files and allowed them to be choosen. With Java 1.4.0 and 1.4.1 FCS on Windows 2000 (problem doesn't exist on Solaris 8), JFileChooser displays them as empty directories. This prevents them from being selectable to be opened by the application. The problem is easy to reproduce with the FileChooserDemo from the Swing tutorial
    http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html
    Simply download and compile the code. Then create an empty file named test.cdf. Under Java 1.4.0, the file will have to be in a directory other than the current working directory of the application. Under Java 1.4.1 the problem occurs even when the file is in the cwd. java.io.File correctly identifies the file as a file (isFile() == true && isDirectory() == false).
    Is this new JFileChooser behavior the intended behavior? If so, how can I customize JFileChooser to restore the previous behavior in my applications? Thanks.
    Bernie

    The best workaround might be to provide a new FileView object
    which delegates to the default one. See example below.
    (Sorry for the tardy response.)
    Leif Samuelsson
    The Swing Team, Java Software
    Sun Microsystems, Inc.
    import java.io.File;
    import javax.swing.*;
    import javax.swing.filechooser.*;
    import javax.swing.plaf.*;
    public class CDF {
        public static void main(String[] args) throws Exception {
         JFileChooser fc = new JFileChooser();
         final FileView fv = ((FileChooserUI)fc.getUI()).getFileView(fc);
         fc.setFileView(new FileView() {
             File plainFile = new File("dummy");
             public String getName(File f) {
              return fv.getName(f);
             public String getDescription(File f) {
              if (f.getName().endsWith(".cdf")) {
                  return f.getName();
              } else {
                  return fv.getDescription(f);
             public String getTypeDescription(File f) {
              if (f.getName().endsWith(".cdf")) {
                  return fv.getTypeDescription(plainFile);
              } else {
                  return fv.getTypeDescription(f);
             public Icon getIcon(File f) {
              if (f.getName().endsWith(".cdf")) {
                  return fv.getIcon(plainFile);
              } else {
                  return fv.getIcon(f);
             public Boolean isTraversable(File f) {
              if (f.getName().endsWith(".cdf")) {
                  return Boolean.FALSE;
              } else {
                  return fv.isTraversable(f);
         if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
             System.out.println("You selected: " + fc.getSelectedFile());
         System.exit(0);
    }

  • JFileChooser vs FileDialog

    I've noticed that the JFileChooser opens very slowing and was wondering if it would be better to use the FileDialog. My application is a Swing app and I've heard on numerous occasions you should not mix AWT and Swing components in an application. Can someone tell me the best approach to create a correct my problem. THe JFileChooser is just too slow. Also, can someone tell me the reason for not mixing Swing and AWT components?
    thanks

    hello,
    using a FileDialog shouldnt be a problem in a swing application. i agree with you that JFileChooser is abit slow but look on the positive side of the JFileChooser, you can customize it to your liking, and even can set the fileChooser to show a prieview of some files, i mean its fully customizable compared to a FileDialog. if your application is a simple then you rather use a FileDialog but if its major where the GUI makes a difference than use JFileChooser. well this is just a suggestion
    asrar

  • Customizing JFIleChooser

    Hi,
    I have an issue with JFileChooser. My application uses a JFileChooser to select a folder location. I need to customize the JFileChooser so that the user shud be able to select folders and only view files not select it. He shud be allowed to select/open only folders, not the files within it.
    Thanks

    Read the API docs... there's an option for DIRECTORIES_ONLY

  • Customizing JFileChooser (File Size) Need Help

    Can you help me with this. I want to customize my JFileChooser. I'm in a Windows environment so the file view that I see is same with that of the option pane of windows. What I would like to do is make the size that is viewed from the screen from ##KB to specific bytes size. (ex. 34421245). Can someone help me on this. I was able to see some codes on the net but those codes are not straightforward. They override the BasicFileChooserUI. Can someone help me on this. I don't want to override the BasicFileChooserUI instead I want to use the JFileChooser and change the size from ###KB to bytes. Thank you. ^_^

    Hi Rachel,
    My best idea for that is to load the swf files externally, so
    that each page is a different swf. A technique like this would be
    very simple and quick to use, because it only loads what you need
    when you need it.
    For example, you'd set the intro page to load right away, and
    then when you select "At Work" the intro page unloads and is
    replaced by the at work page.
    Another thing you may want to consider is holding the images
    in an xml file, and then using some basic flash/xml intergration to
    load each image as it's called. That way each image isn't stored in
    the flash file causing it to increase in size, and instead is
    actually loaded externally which is must faster.
    There are some great tutorials, if you're intrested, on how
    to do both of these at:
    http://www.kirupa.com/
    Hope I helped some!

  • JFileChooser permission error.

    Our application, or applet if you will has been working fine. We have not needed to create any specific security permissions on the client PC as the applet is signed.
    As of late, and only in IE we get a:
    java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
    When the code below is executed.
    int returnVal = selectOMission.showDialog(this, "Save Mission");
    --selectOMission is defined as "JFileChooser selectOMission = new JFileChooser();"
    This problem is not present in linux, or when running other browsers in XP.
    Anyone have any ideas?

    Self healing is good.
    We keep out look and feel in a separate jar. Makes it easier to customize the app. The error was not being caused by the FileChooser but rather by the ui.
    Signing the look jar fixed it.
    It is rather strange that this only occurred when using IE on windows all other browsers worked and EI on Mac worked as well ...

  • How get JFileChooser stay in front of browser window?

    As an alternative to using HTML (<input type=file>) on the client to take care of browsing local files, I want to use a Java swing component (coded in a servlet) to do the same thing, in order to customize text on buttons, etc. JFileChooser works just fine, if it wasn't for the fact that it time and again disappears behind the web browser (Internet Explorer) window (and I have to minimize the browser window to see it). In contrast to a Java Window object, JFileChooser cannot be set so that it always stays on top of the web browser window.
    Therefore, the solution seems to be to build my own JFileChooser-look-alike file browser (OK, I am NOT talking about the web browser now), based on a Java Window object. Is this possible? In other words, what methods or classes can I use to create the viewing of local files? Any other comments or ideas?

    Hi Sannie,
    change the order of the plots. Your RunAvg should be plot0, while the barplot is plot1…
    There's a reason, why BMPs are banned in the forum: their size! Please convert your images to (real) JPG or (even better for FP or BD images) PNG before posting them!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Why my JFileChooser showed as a FileDialog?

    Hello!
    I'm doing a project to update some existing codes. I made a change to use JFileChooser to replace FileDialog since I can customize JFileChooser. However, after I have replaced FileDialog with JFileChooser in code, it still show as FileDialog when I run it. I'm very sure that I'm using the changed codes since I can see other changes I made in the file. The runtime environment could be a little strange, I heard it may not support Java.Swing. However, I used some other Swing components they all come out fine. It seems that JFileChooser is not supported so it fails back to FileDialog automatically, does anyone know anything about this?
    Thank you very much.
    Edited by: cutty on Jun 5, 2008 9:50 AM

    We can't really diagnose your problem just with what you posted.
    cutty wrote:
    The runtime environment could be a little strange, I heard it may not support Java.Swing.What environment? Platform, OS version, JVM version.
    It seems that JFileChooser is not supported so it fails back to FileDialog automatically, does anyone know anything about this?Write a small test program that simply creates a JFileChooser and displays it, and does nothing else. If it displays a JFileChooser, you'll know there's a bug in your code. If it displays a native file chooser like AWT does, then you may be correct.

  • Transparent JFileChooser

    Hi!
    I have yet another "how can I make this thing transparent" question, this time for the JFileChooser. I've written a function to recursively iterate through its components and these are the ones I can find:
    class javax.swing.JPanel
    class javax.swing.JPanel
    class javax.swing.JButton
    class javax.swing.Box$Filler
    class javax.swing.JButton
    class javax.swing.Box$Filler
    class javax.swing.JButton
    class javax.swing.Box$Filler
    class javax.swing.JToggleButton
    class javax.swing.JToggleButton
    class javax.swing.JLabel
    class javax.swing.plaf.metal.MetalFileChooserUI$1
    class javax.swing.JPanel
    class sun.swing.FilePane
    class javax.swing.JPanel
    class javax.swing.JPanel
    class javax.swing.plaf.metal.MetalFileChooserUI$AlignedLabel
    class javax.swing.plaf.metal.MetalFileChooserUI$3
    class javax.swing.Box$Filler
    class javax.swing.JPanel
    class javax.swing.plaf.metal.MetalFileChooserUI$AlignedLabel
    class javax.swing.JComboBox
    class javax.swing.JPanel
    class javax.swing.JButton
    class javax.swing.JButtonRunning setOpaque(false) on all instances of JComponent makes everything but the list of files transparent. From what I can see it's some kind of JList but it doesn't appear in the list above. Is there a way to make this last part transparent as well? Can I somehow run setOpaque(false) on it too?

    Thanks for your replies!
    I realise now I probably should have put some more effort into this before posting. I've created an example that'll hopefully make things clearer.
    Maxideon: You're right, ComboBox doesn't become transparent, it did in my code because I'd set a custom ComboBoxUI.
    It's only the list of files I'm interested in making transparent right now, I've managed to get all of the other components transparent already. Here's the code:
    FileChooserTest.java:
    import java.awt.*;
    import javax.swing.*;
    public class FileChooserTest extends JFrame {
      String background = "bkg.jpg";
      public FileChooserTest() {
        ImageIcon imageIcon = new ImageIcon(background);
        setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
        JPanel panel = new JPanel() {
          public void paintComponent(Graphics g) {
            g.drawImage(new ImageIcon(background).getImage(), 0, 0, null);
        panel.setBounds(0, 0, imageIcon.getIconWidth(), imageIcon.getIconHeight());
        UIManager.put("FileChooserUI", MyFileChooserUI.class.getName());
        panel.add(new JFileChooser());
        getContentPane().add(panel);
      public static void main(String[] args) {
        new FileChooserTest().setVisible(true);
    }MyFileChooserUI.java
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.plaf.ComponentUI;
    import javax.swing.plaf.metal.MetalFileChooserUI;
    public class MyFileChooserUI extends MetalFileChooserUI {
      public static ComponentUI createUI(JComponent c) {
        return new MyFileChooserUI((JFileChooser) c);
      private MyFileChooserUI(JFileChooser c) {
        super(c);
      public void installComponents(JFileChooser fc) {
        super.installComponents(fc);
        customize(fc);
      /* Set opacity, call recursively */
      private void customize(Container c) {
        int len = c.getComponentCount();
        for(int i = 0; i < len; i++) {
          Component comp = c.getComponent(i);
          if(comp instanceof JComponent) {
            ((JComponent)comp).setOpaque(false);
          if(comp instanceof Container) {
            customize((Container) comp);
    }thomas.behr: Does your solution work for a JFileChooser added to a JPanel or only when it's a separate Window?
    Is there a way to create a custom ListUI that'll make the list in the JFileChooser transparent?
    Once again, thanks guys and sorry for not creating an example from the start.

  • Problem about JFileChooser

    I am using JFileChooser to allow user to select only .wav file. When JFileChooser displaying out, only files with .wav extension and folders are shown.
    When there is text in filename text field, JFileChooser can return, which is not i want. Only existed .wav file can return caller.... Any guys out there, know how to customize this?
    Thanks in advance.

    Disabling the Open button might not be easy. You could force selection of a filetype using a loop and FileExtensionFilter's accept (File file) method. This is a sample code snippet that repeats the loop until a text (*.txt) file is selected or Cancel is clicked:JFileChooser chooser = new JFileChooser ();
    chooser.setFileSelectionMode (JFileChooser.FILES_ONLY);
    chooser.setAcceptAllFileFilterUsed (false);
    FileNameExtensionFilter filter =
          new FileNameExtensionFilter ("Text File", "txt");
    chooser.setFileFilter (filter);
    int retVal;
    do {
       retVal = chooser.showOpenDialog (null);
    } while (retVal == JFileChooser.APPROVE_OPTION
          && !filter.accept (chooser.getSelectedFile ()));You can easily add a check that the selected file exists to the loop condition.
    db

  • JFileChooser customizing

    Hi guys,
    I'm Having a save as JFileChooser dialog that i want to customize:
    is it possible in the file chooser to hide the Save As (File Name) Label and the text box for File name entering ?
    what is the simplest way to do that ?
    thanking you much

    the following method works correctly on linux & windows:
    public void hide(Component[] comp)
          for(int x = 0; x < comp.length; x++)
            if(comp[x] instanceof JPanel) hide(((JPanel)comp[x]).getComponents());
            else if(comp[x] instanceof JTextField)
              ((JTextField)comp[x]).setVisible(false);
            else if(comp[x] instanceof JLabel)
                 JLabel lbl=(JLabel)comp[x];
                 if(lbl.getText().startsWith("Save As") || lbl.getText().startsWith("File Name") )
                lbl.setVisible(false);
        }However when i test on MAC the label Save As: is still displayed and the Save button is disabled. why this ?
    can someone help me ?

  • Help with custom JFileChooser

    Hello everyone,
    I would like to customize JFileChooser to display a panel with some text above the folder browse section.
    Is this possible... if so, could anyone provide some sample code on how to get this started?

    I'm afraid you're on your own. Noone has [ever done something like that before|http://www.google.com/search?q=customizing jfilechooser].

Maybe you are looking for

  • Questions on punch in and mix down

    i've been using vers 1.5 and it seems a lot simpler to use. after punching in and want to keep the take- how do you put it in the track. another question i would like to mix my vocal to another track in multi track that i have added a fx to, i don't

  • Customer consignment with intercompany process

    Hello, Has anybody worked on Customer consignment with intercompany process. If yes, what are the main points to be taken into or configured for this process ? regds

  • Unable to upload to iTunes U private site collections

    Can browse and select a track but never begins actual upload: Can re-produce with any other collection Shannon O'Daniel Emory University

  • Allocating dynamic memory

    Hi, my second question for today...;-) Should I always get dynamic memory via Photoshop API or can I use new[] as well? I understand that photoshop uses own memory management, but I'm talking about relatively small amounts of memory, say some kB. If

  • Problems with the shortcut keys... possible programming defect

    I have a white MacBook '09. All keys work except zero key. But, my shortcut functions don't work. I.e. command and c, to copy something. But the command and c work independently. Also, what's weird is that other short cut functions involving command