JFileChooser CUSTOM_DIALOG issue

Hi,
I am using JFileChooser CUSTOM_DIALOG one. Here is the snippet of the code :
fileChoose = new JFileChooser();
fileChoose.setDialogType(JFileChooser.CUSTOM_DIALOG);
fileChoose.setMultiSelectionEnabled(false);
fileChoose.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChoose.setControlButtonsAreShown(false);
fileChoose.addPropertyChangeListener(this);
Here I have disabled the default buttons. I am using my customized one. When I select the file in the FileChooser I am able to retrieve the filename by using the below method as expected.
fileChoose.getSelectedFile();
But, the typed filename in the "File Name" textfield of the FileChooser is not getting reflected in the fileChoose.getSelectedFile() method.It is always providing the previously selected filename not the typed one in the text field. Please share your thoughts.
Edited by: pearls on Nov 20, 2007 10:27 AM

Hi,
I am using JFileChooser CUSTOM_DIALOG one. Here is the snippet of the code :
fileChoose = new JFileChooser();
fileChoose.setDialogType(JFileChooser.CUSTOM_DIALOG);
fileChoose.setMultiSelectionEnabled(false);
fileChoose.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChoose.setControlButtonsAreShown(false);
fileChoose.addPropertyChangeListener(this);
Here I have disabled the default buttons. I am using my customized one. When I select the file in the FileChooser I am able to retrieve the filename by using the below method as expected.
fileChoose.getSelectedFile();
But, the typed filename in the "File Name" textfield of the FileChooser is not getting reflected in the fileChoose.getSelectedFile() method.It is always providing the previously selected filename not the typed one in the text field. Please share your thoughts.
Edited by: pearls on Nov 20, 2007 10:27 AM

Similar Messages

  • To select a file path?

    Hi all!
    Currently I want to allow user to select the file path using those file dialog like JFileChooser/FileDialog... So that there's an input field that accepts a file name... Then another text field which will display the path that the user chose... I need to do that separately to write a .wav file... How do I do it?
    I tried using JFileChooser and set this... (.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);) It only shows the directories, yes... But if I open a directory... without anymore directories in it... When I click on the "OK" button... It does not allow me to go on...
    Cozel

    How about this???
    import java.io.*;
    public class MyFileChooser extends javax.swing.JDialog {
             private javax.swing.JPanel cntrPnl;
             private javax.swing.JFileChooser chsr;
             private javax.swing.JButton cancelButton;
             private javax.swing.JButton svButton;
             private javax.swing.JTextField dirField;
             private java.io.File selFile = null;
        public MyFileChooser(java.awt.Frame parent, boolean modal) {
            super(parent, modal);
            initComponents();
        private void initComponents() {
            chsr = new javax.swing.JFileChooser();
            cntrPnl = new javax.swing.JPanel();
            dirField = new javax.swing.JTextField();
            svButton = new javax.swing.JButton();
            cancelButton = new javax.swing.JButton();
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    closeDialog(evt);
            chsr.setControlButtonsAreShown(false);
            chsr.setDialogType(javax.swing.JFileChooser.CUSTOM_DIALOG);
            chsr.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    chsrActionPerformed(evt);
            chsr.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent evt) {
                    chsrPropertyChange(evt);
            getContentPane().add(chsr, java.awt.BorderLayout.CENTER);
            dirField.setEditable(false);
            dirField.setMargin(new java.awt.Insets(0, 5, 0, 5));
            dirField.setPreferredSize(new java.awt.Dimension(200, 30));
            cntrPnl.add(dirField);
            svButton.setText("SAVE");
            svButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    svButtonActionPerformed(evt);
            cntrPnl.add(svButton);
            cancelButton.setText("Cancel");
            cancelButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    cancelButtonActionPerformed(evt);
            cntrPnl.add(cancelButton);
            getContentPane().add(cntrPnl, java.awt.BorderLayout.SOUTH);
            pack();
        private void chsrPropertyChange(java.beans.PropertyChangeEvent evt) {
            dirField.setText(chsr.getCurrentDirectory().getAbsolutePath());
        private void svButtonActionPerformed(java.awt.event.ActionEvent evt) {
            selFile=chsr.getSelectedFile();
            this.hide();
        private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
            selFile = null;
            this.hide();
        private void chsrActionPerformed(java.awt.event.ActionEvent evt) {
            dirField.setText(chsr.getCurrentDirectory().getAbsolutePath());
        private void closeDialog(java.awt.event.WindowEvent evt) {
            setVisible(false);
            dispose();
        public static void main(String args[]) {
            MyFileChooser fc = new MyFileChooser(null, true);
            fc.show();
            File f = fc.getSelFile();
            if(f!=null)
                System.out.println("Selected File is: "+f);
            fc.dispose();
            System.exit(0);
        public File getSelFile() {
            return selFile;
    }walker

  • 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.

  • JFileChooser Issues!

    I am writing an application in swing and I am trying to use a JFileChooser so that the users of my app can set the path to save text files to. My issue is that wether I use the showSaveDialog or showOpenDialog I can only choose files with extensions, not a folder. Is there a way I can approve the selection of just a folder?

    Aj_Green wrote:
    Here is the code I am using for my JFileChooser
    public void openFileChooser() {
              JFileChooser pathChooser = new JFileChooser();
              pathChooser.showSaveDialog(this);
              pathChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
         }Well it should be obvious that you'd need to invoke setFileSelectionMode BEFORE you show the dialog, wouldn't you think?

  • Graphical issues with JFileChooser

    I have reduced the problem as much as I could:
    package javaapplication4;
    import java.applet.Applet;
    import javax.swing.*;
    public class NewJApplet extends JApplet {
        public void init() {}
        public void start() {
            javax.swing.JFileChooser FC = new javax.swing.JFileChooser();       
            if (FC.showOpenDialog(this) == javax.swing.JFileChooser.APPROVE_OPTION) {}       
    }If I start this as an Applet the FileChooser sometimes has [graphical issues|http://arokh.dnsalias.org/Images/FileChooser.png]. (ErrorLog)
    If started as a normal app (through main method) it works perfectly fine.
    Can anybody also reproduce/solve this?
    I'm using FireFox3 B5 (IE7 also shows this problem) & WinXP SP2
    Sun Java 6 Update 6

    I also have a 27 in iMac Core i7 3.4 with the 2GB Graphics Card.
    I called apple care and informed them + I recorded a video of it happening with ScreenFlow and sent it to apple. Please call apple care and inform them so they escalate this issue.
    When I called them they sent me a file to Capture the Data of my computer to see what happened and what caused it.
    By the way this computer should be able to connect with 6 screens simultaneously.
    Please if you are experiencing this issue write here to inform apple about and call apple care or see the genius bar.
    Thanks

  • JFileChooser Network Folder Issue

    Hello all
    Class : javax.swing.JFileChooser (network folders)
    J2SE : 1.4
    OS : Windows
    I'm in need of urgent help for JFileChooser, scenerio is, currently when I do a open or save dialog using the JFileChooser it brings up the mapped network folders along with local folders on my PC.
    For selection, if I clicked on the network folders, is there a way I could differentiate if it was one of the mapped network folders or a regular file on the file system? I dont see any of the folders underneath my network folder, it just doesnt seem to work right.
    Also the mapped network folder is username password protected which comes up with the Username Password prompt dialog the first time I access it through the open / save dialogs, where exactly does it store this information.
    Any help would be highly appreciated.
    Regards

    I'm assuming that we are still talking about mapped network drives
    under "My Computer", as opposed to navigating "Network Neighborhood"
    and using UNC paths.
    Are you saying that, in order to know if its a network folder i have
    to search for " on " in the display name, and if its a web folder
    search for a ".", in order to determine if the difference. Is this the
    only way I could determine if its a network / web folder as compared
    to the local folders on my PC :(
    I was looking in for some kind of property that would help me determine it.I still don't understand where you want to test for this. Do you have
    a listener on the JFileChooser to catch directory changes, or did
    you set it up to only select directories, or are you talking about
    determining this after the user has chosen a file?
    No, there is no way in Java to determine whether a path that starts
    with a drive letter is in fact a mapped network folder. My suggestion
    was pretty ugly, as I said. I don't understand what you mean by "web
    folder". JFileChooser doesn't support URL paths. If you mean UNC paths
    then just test for f.getAbsolutePath().beginsWith("\\\\").
    Also why dont I see the directory structure underneath the webfolder
    or network folder from my JFileChooser?If the folder is not currently mapped because it requires a password
    or the host is not responding, then JFileChooser will display an empty
    folder. We may look into fixing this in a future release.
    One last thing: For password protected web folders, when I select them
    through my JFileChooser, the "Enter Network Password" window pops up,
    and this happens only once in the applications lifetime, I presume its
    storing this information somewhere, do you have any idea where exactly
    i should be searching for these values? I didn't see this dialog pop up from JFileChooser until the new 1.4.2
    release that we're working on. In any case, it is handled by the
    operating system and our code knows nothing about it. I'm sure there
    is no way to ask the operating system for stored passwords as that
    would compromise security.
    /Leif

  • JFilechooser Issues with Current Directory

    Hi,
    Actually I am getting strange error while using JFileChooser.
    I am trying to set current directory in applet as:
    private static File visitedDir = null;
    JFileChooser fc = fileAccess.newJFileChooser();
    fc.setDialogType (JFileChooser.OPEN_DIALOG);
    if (visitedDir != null) {
    fc.setCurrentDirectory(visitedDir);
    File file = fc.getSelectedFile();
    visitedDir = file.getParentFile();
    And when i open the Dialog Box and browse any directory and then in that directory in textbox if I type any file name to create the file. and then say open.And again if open the dialog box,as visited directory is static field it remains initialized. and dialog box shows me directory name in drop down.But it doesn't show me the full traverse path of directory.It only shows that directory name in dialog box.So I cant traverse to any other directory.
    Please help.

    It works for me - I'm guessing fileAccess.newFileChooser() already shows the dialog, so you only set the current directory after the user picked a file.
    public class TestFileChooser {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    JFileChooser chooser = new JFileChooser();
                    while(chooser.showOpenDialog(null) ==
                              JFileChooser.APPROVE_OPTION) {
                        File file = chooser.getCurrentDirectory();
                        chooser = new JFileChooser();
                        chooser.setCurrentDirectory(file);
    }

  • JFileChooser issue

    In a file chooser, when one types a network path or name of some mapping, it doesn't explore it further (like it does when u type d:\ and press enter), it just disposes the file chooser dialog. windows file chooser does the exploring. can any ine suggess something how to make it word?
    regards,
    anshu

    2) We may decide that the 'fix' is to write our own
    filechooser. Has anybody done this before? Is it
    difficult or even possible?Since a JFileChooser already exist, yes, I'd think it is possible. ;)
    Would this fix the
    problem? I bet it not only doesn't, but adds a few more. I have a bad feeling baout your code.
    I am not sure how I would go about this. A debugger would be a good start.

  • JFileChooser (again!) slow in JRE 1.6.14 on some machines, not others

    I am running ImageJ (from the NIH) on several of our machines and on some machines JFileChooser is lightning fast, while others exhibit the same slowness spoken of in another JFileChooser thread that is now in a locked state. We open large image files (tif, png) located on our SAN and from the network traffic I see in Windows Task Manager while opening a folder containing the images I would guess that JFileChooser is actually opening the files (intentionally or not), not just obtaining a folder listing. It's similar to the same issue of opening a large folder of images with the view set to thumbnails - it takes about the same amount of time. I have tried the suggestions in that thread to no avail - the environment the machines are running is:
    Windows XP SP3
    Java JRE 1.6.0_14
    Can anyone comment on what JFileChooser is doing and how I can get it to stop this? Is it a Windows environment setting so that the native API calls made by JFileChooser will behave differently? Thoughts?
    Thanks,
    Tom

    I can't be absolutely sure, but we have several seemingly identical machines used for the purpose of reading medical images and several of them appear to work correctly (very fast loading and population of the folder's contents) and others don't. I have been using eclipse to enhance the software tool we're using (ImageJ) and using the debugger I can see that when the JFileChooser object is being instantiated and populated with entries a tremendous amount of network traffic occurs. This network traffic is equivalent to the amount I see when the same folder is opened in My Computer using a thumbnails view of the folder contents. Apparently, the network is delivering approximately 300-400 MB of images. As far as configuration of the Windows machines is concerned I haven't found a significant difference yet, though I admit I am not a Windows desktop admin and may not know of some configuration item that could be responsible. I assume (though could be mistaken) that both My Computer and JFileChooser are ultimately using similar API calls to get the folder content entries?

  • Issue with launching Java Program - Java Library Problem?

    I hope this is the right forum, I apologize if it isn't. I am having issues launching a program for a video game that uses java. One of the devs told me to post my issue here, as he doesn't know how much more help he can give with this issue. Using the java -jar command, this is the printout I get:
    Microsoft Windows [Version 6.0.6002]
    Copyright (c) 2006 Microsoft Corporation.  All rights reserved.
    C:\Users\vecdran>java -version
    java version "1.6.0_20"
    Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
    Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
    C:\Users\vecdran>chdir C:\Games\Steam\Steamapps\common\Crysis\mods\mwll\actionma
    pper\dist
    C:\Games\Steam\steamapps\common\crysis\Mods\mwll\Actionmapper\dist>java -jar Act
    ionmapper.jar
    Jun 18, 2010 2:25:19 PM org.jdesktop.application.Application$1 run
    *SEVERE: Application class mwllactionmapper.MWLLActionmapperApp failed to launch*
    *java.lang.NullPointerException*
    at javax.swing.ImageIcon.<init>(Unknown Source)
    at javax.swing.ImageIcon.<init>(Unknown Source)
    at sun.swing.WindowsPlacesBar.<init>(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.updateUseShellFo
    lder(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponent
    s(Unknown Source)
    at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(Unknow
    n Source)
    at javax.swing.JComponent.setUI(Unknown Source)
    at javax.swing.JFileChooser.updateUI(Unknown Source)
    at javax.swing.JFileChooser.setup(Unknown Source)
    at javax.swing.JFileChooser.<init>(Unknown Source)
    at javax.swing.JFileChooser.<init>(Unknown Source)
    at mwllactionmapper.model.ActionmapsFileModel.getMWLLDocumentsFolder(Act
    ionmapsFileModel.java:141)
    at mwllactionmapper.model.ActionmapsFileModel.getMWLLProfiles(Actionmaps
    FileModel.java:160)
    at mwllactionmapper.MWLLActionmapperView.doSelectProfile(MWLLActionmappe
    rView.java:603)
    at mwllactionmapper.MWLLActionmapperView.<init>(MWLLActionmapperView.jav
    a:75)
    at mwllactionmapper.MWLLActionmapperApp.startup(MWLLActionmapperApp.java
    :21)
    at org.jdesktop.application.Application$1.run(Application.java:171)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Exception in thread "AWT-EventQueue-0" java.lang.Error: Application class mwllac
    tionmapper.MWLLActionmapperApp failed to launch
    at org.jdesktop.application.Application$1.run(Application.java:177)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.NullPointerException
    at javax.swing.ImageIcon.<init>(Unknown Source)
    at javax.swing.ImageIcon.<init>(Unknown Source)
    at sun.swing.WindowsPlacesBar.<init>(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.updateUseShellFo
    lder(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponent
    s(Unknown Source)
    at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(Unknow
    n Source)
    at javax.swing.JComponent.setUI(Unknown Source)
    at javax.swing.JFileChooser.updateUI(Unknown Source)
    at javax.swing.JFileChooser.setup(Unknown Source)
    at javax.swing.JFileChooser.<init>(Unknown Source)
    at javax.swing.JFileChooser.<init>(Unknown Source)
    at mwllactionmapper.model.ActionmapsFileModel.getMWLLDocumentsFolder(Act
    ionmapsFileModel.java:141)
    at mwllactionmapper.model.ActionmapsFileModel.getMWLLProfiles(Actionmaps
    FileModel.java:160)
    at mwllactionmapper.MWLLActionmapperView.doSelectProfile(MWLLActionmappe
    rView.java:603)
    at mwllactionmapper.MWLLActionmapperView.<init>(MWLLActionmapperView.jav
    a:75)
    at mwllactionmapper.MWLLActionmapperApp.startup(MWLLActionmapperApp.java
    :21)
    at org.jdesktop.application.Application$1.run(Application.java:171)
    ... 8 more
    C:\Games\Steam\steamapps\common\crysis\Mods\mwll\Actionmapper\dist>As you can see, my Java is completely up to date, and this is the only program I appear to have problems launching. I have no idea what to do from here. :(
    PS.
    I had to add the Java path to my System -> Environmental Variables -> Path variable, as it was not there from the start, and before adding it command prompt wouldn't recognize java commands. Don't know whether this indicates anything.
    Edited by: vecdran on Jun 20, 2010 11:23 AM

    [Bug ID 4711700|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4711700] is eerily similar to what you're experiencing. Although the bug was reported against an older version of the JDK the last comment provides a workaround to the problem that may be helpful. Good luck.

  • JFileChooser problem with Windows Vista

    Hi,
    I running into the following problem.
    I am using JFileChooser in some of the JInternalFrames in my application. When I using Windows XP everthing works perfectly.
    Now Here is the issues, I have a new user using the application. His computer is Windows Vista and the error comes when I am using JFileChooser.
    I need to know I need to put another file or update ANYTHING ON WINDOWS VISTA FOR THIS JFileChooser to work.
    I appreacite your help and time.
    Wilfer
    CDC

    That's not an error from Java, as far as I know. Something else is producing it. Look over these search results for a case that matches what you see:
    http://www.google.com/search?q=error+31849

  • JFileChooser question regarding the order of the files in a folder

    I was hoping someone had a way around this issue I am having with the JFileChooser. I have a folder that has filenames in it like text1.txt, text2.txt, and so forth all the way up to text300.txt. When the filechooser shows these files it shows the order of them as:
    text1.txt
    text10.txt
    text11.txt
    text2.txt
    text20.txt
    text21.txt
    and so forth.
    How come it doesn't list them like they would be in a folder window like:
    text1.txt
    text2.txt
    text3.txt
    text150.txt
    text151.txt
    text299.txt
    text300.txt
    Actually I know why JFileChooser does it this way, it is because it sorts them as Strings without taking into account the number at the end of a similar string.
    Anyway, I was wondering if anyone had some ideas of how I could alter the JFileChooser to list the contents of a folder like this in the "right" order. Hopefully that made sense. :) Thanks.

    Thank u for ur reply.... actually the thing is mine's one of the pre-ordered iphones n it's reaching me by 2moro i think. so are the pre-ordered iphone's already activated? or m i in trouble if it's not activated out of the box (if i have to activate it myself). ?

  • Folders that having non-ascii chars are not displaying on MAC using JFileChooser

    On MAC OS X 10.8.2, I have latest Java 1.7.25 installed. When I run my simple java program which allows me to browse the files and folders of my native file system using JFileChooser, It does not show the folders that having non-ascii char in there name. According this link, this bug had been reported for Java 7 update 6. It was fixed in 7 Update 10. But I am getting this issue in Java 1.7.21 and Java 1.7.25.
    Sample Code-
    {code}
    public class Encoding {
    public static void main(String[] arg) {
    try {
    //NOTE : Here at desktop there is a folder DKF}æßj having spacial char in its name. That is not showing in file chooser as well as while is trying to read for FILE type, it is not identify by Dir as well as File - getting File Not Found Exception
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (IllegalAccessException ex) {
    Logger.getLogger(Encoding.class.getName()).log(Level.SEVERE, null, ex);
    } catch (UnsupportedLookAndFeelException ex) {
    Logger.getLogger(Encoding.class.getName()).log(Level.SEVERE, null, ex);
    } catch (ClassNotFoundException ex) {
    Logger.getLogger(Encoding.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
    Logger.getLogger(Encoding.class.getName()).log(Level.SEVERE, null, ex);
    JFileChooser chooser = new JFileChooser(".");
    chooser.showOpenDialog(null);
    {code}

    Hi,
    Did you try this link - osx - File.list() retrieves file names with NON-ASCII characters incorrectly on Mac OS X when using Java 7 from Oracle -…
    set the LANG environment variable. It's a GUI application that I want to deploy as an Mac OS X application, and doing so, the LSEnvironment setting
    <key>LSEnvironment</key> <dict> <key>LANG</key> <string>en_US.UTF-8</string> </dict>

  • JFileChooser applet doesn't work on all platforms

    We have a signed Java applet which works perfectly on Windows XP and Linux but malfunctions on Windows 7 and MacOS 10.5.
    The part which does not work is opening up a JFileChooser (which opens up fine) which then permits the user to browse local files only but not folders on network drives. When the user double-clicks on a network folder or clicks the Open button, nothing happens. The folder is not opened and there are no exceptions reported in the console.
    Obviously it presents as some kind of security violation/exception but, as I said, there are no exceptions in the console and it works fine on some OSes but not others. I have examined the permissions on a folder that does open and one that doesn't (i.e. a network folder) and they certainly are different but I can't spot any obvious problems. All machines have the exact same version of Java (i.e. 1.6.0_20) and it doesn't appear to a 32-bit vs. 64-bit issue as there is a mix of architectures that are working and not working.
    Can anyone suggest how I might go about debugging this or perhaps suggest a resolution? Given that the code that is being executed at the time is Swing code and not application code I am at a bit of a loss as to how to solve this problem.
    The Logical Animal

    It could be the JFileChooser code is being altered or displayed on a thread other than the EDT. OTOH that more typically manifests as a random bug on instances of the application on all platforms/JREs.

  • Help: Design Issues in Swing

    Hi Friends
    I developed an application in swings way back in 2000-01. However then there were serious issues of Memory leakage with Swings. Hence the strategy we adopted was to use a cache of Swing components rather than creating new objects everytime.
    Now again in 2004, i am back to swings.
    Now are there still issues with the swings?
    What are the other things, we need to keep in mind during the design?
    I heard that listeners create problem with the components since component get registered with the Listeners and are not able to get released.
    And there are problems of lot of internal objects being created.. Is this true.. if yes.. how do we tackle the problem??

    hi,
    I'm using swing in some programs of my own, and I've not experienced any serious problems yet.
    Some points need to be mentioned however:
    - Instantiating heavyweight components (such as JFileChooser) tends to be slow, try instantiating only one JFileChooser for your application and reuse it by just hiding/showing it.
    - Most programs instantiate all their components (visible and invisible) at startup. This slows down the startup time and the performance feeling of your program. Try using lazy-instantiation (do not initialise the component at the beginning but only initialise the component when it is called upon for the first time). Some more specific instantiation-schemes can be used, for instance for image- or sound-loading.
    Of course the splash-screen with small animations tends to ease the pain to wait for the user.
    - caching can also be used to improve performance, but here I think you should always first measure the performance of the component to be cached (using a profiler). Using a cache on a well performing object might also reduce it's performance.
    To reduce the memory-footprint of the cache, you could combine it with the lazy-instantiation and perhaps even use WeakReferences to hold this objects in order not to let the cache be a memory-bottleneck.
    This can be especially useful when using large quantities of equal objects (what also happens for String) or when using a decent amount of very memory-consuming objects such as images.
    Normally (for the remaining optimization) it is adviced to not optimize while programming, and only start to optimize for performance and memory usage when problems show up. For doing this you should use some serious profiler, instead of blindly optimizing what seems slow.
    Also try reading the book about java performance which can be found using the link below:
    http://java.sun.com/docs/books/performance/1st_edition/html/JPTOC.fm.html
    This book gives many of the advices I've given above and explains the total process of performance-tuning. Another advantage of this book is that it uses Swing as an example for it's optimizations, and that the author has cooperated in programming (parts of) Swing.
    Kind regards,
    Koen

Maybe you are looking for