NullException when setUI on JFileChooser

I wrote a sub class of MetalFileChooserUI, and set it for my file chooser. but when i show the file chooser dialog, the icons for the files is disappeared. if i click the file list item, NullException occur. why?
MY code:
public class MyChooser extends JFileChooser {
public MyChooser(String file) {
super(file);
setUI(new MyChooserUI());
public class MyChooserUI extends MetalFileChooserUI {
public MyChooserUI(JFileChooser fc) {
super(fc);
Error Message:
Exception occurred during event dispatching:
java.lang.NullPointerException
     at javax.swing.plaf.metal.MetalFileChooserUI$FileRenderer.getListCellRendererComponent(MetalFileChooserUI.java:536)
     at javax.swing.plaf.basic.BasicListUI.paintCell(BasicListUI.java:87)
     at com.incors.plaf.kunststoff.KunststoffListUI.paintCell(KunststoffListUI.java:91)
     at javax.swing.plaf.basic.BasicListUI.paint(BasicListUI.java:149)
     at com.incors.plaf.kunststoff.KunststoffListUI.update(KunststoffListUI.java:72)
     at javax.swing.JComponent.paintComponent(JComponent.java:395)
     at javax.swing.JComponent.paint(JComponent.java:687)
     at javax.swing.JComponent.paintChildren(JComponent.java:498)
     at javax.swing.JComponent.paint(JComponent.java:696)
     at javax.swing.JViewport.paint(JViewport.java:668)
     at javax.swing.JComponent.paintWithBuffer(JComponent.java:3878)
     at javax.swing.JComponent._paintImmediately(JComponent.java:3821)
     at javax.swing.JComponent.paintImmediately(JComponent.java:3672)
     at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:370)
     at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:124)
     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:337)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
     at java.awt.Dialog.show(Dialog.java:380)
     at javax.swing.JFileChooser.showDialog(JFileChooser.java:614)
     at javax.swing.JFileChooser.showOpenDialog(JFileChooser.java:517)

I think JFileChooser is a platform independent solution and Network Neighbourhood is a Windows implementation.
You can use use a FileDialog, I think it uses the Window native open dialog.
Use code something like this:
File Dialog fileDialog = new FileDialog( parent frame );
fileDialog.setMode(FileDialog.LOAD);
fileDialog.show();
if (fileDialog.getFile() == null)
return;
File file = new File( fileDialog.getDirectory(), fileDialog.getFile() );

Similar Messages

  • NullException when I launch the midlet

    I can run the program in the WTK IDE using "Run" button. After that, I use "*project--->package---->create package*" to create a jar and jad file for my project. Then I goto the bin diretory and open the jad file, emulator opened it successfully and the phone window showed. Nevertheless, when I click the "launch" command to launch the app, it prompted me *"+AppName, AppName+*
    *+Exception:java.lang.NullPointerException+*".
    It seems the emulator didn't find the app's midp class which is the entry point and derives from Midlet. It's very strange, because when I used "jar -xf AppName.jar" to extract the jar file, the AppName.class is right there. What's wrong? Is there any limitation for the classes in the .jar file?
    In addition, I didn't touch the .jad/.jar file at all, they were created by WTK.
    Any comments are welcome and many thanks!

    Do you mean I need add a package?No, I don't mean you need to add a package statement :-) but the only ways I could reproduce your problem were
    -- by omitting a package statement and placing the .java file in a subfolder of src.
    -- by including a package statement and placing the .java file in the src folder.
    Now I add a package name test in the source filesIf by that you mean the first line of your source files ispackage test;then the files have to be in the folder src\test (*nix src/test). Did you take care of that?
    and I modified the jad fileDon't modify the jad file, just Project->Package->Create Package again.
    If you still have problems, post back.
    db

  • JFileChooser throws NullPointerException when in a non-traversable Dir

    Hi all
    I think I found a bug of JFileChooser. Unless one of you knows the issue and the corresponding workaround.
    It occurs when one extends JFileChooser and overrides isTraversable() to dissalow the navigation to specific
    directories. When the user then uses the JComboBox of the JFilechooser dialog to navigate to a non-allowed
    directory and from there tries to again select a not allowed directory, the following Exception gets thrown
    within the JFileChooser.showDialog method.
    To reproduce this try:
    import java.io.File;
    import javax.swing.JFileChooser;
    public class   yxJFileChooser
           extends   JFileChooser
        public boolean isTraversable(File _f)
                 if  (_f == null)       return false;
            else if (!_f.isDirectory()) return false;
            String fileToCheck = _f.getAbsolutePath().toLowerCase();
            if (fileToCheck.startsWith("c:\\windows")) return true;
            else                                       return false;
    }the try:
             yxJFileChooser fc = new yxJFileChooser();
             int ret = fc.showDialog(null,"try the combo twice. Choose both times a non traversable dir");Once you have chosen for the second time a non-valid directory (using the combo) you will get a NullPointerException:
    Is this indeed a Java VM bug or am I doing something wrong?
    My operating system is Windows XP service pack 2 and the java version I am running this with is:
    java version "1.6.0-rc"
    Java(TM) SE Runtime Environment (build 1.6.0-rc-b102)
    Java HotSpot(TM) Client VM (build 1.6.0-rc-b102, mixed mode)

    Here the Exception:
    Exception occurred during event dispatching:
    java.lang.NullPointerException
    at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxAction.actionPerformed(Unknown Source)
    at javax.swing.JComboBox.fireActionEvent(Unknown Source)
    at javax.swing.JComboBox.setSelectedItem(Unknown Source)
    at javax.swing.JComboBox.setSelectedIndex(Unknown Source)
    at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(Unknown Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(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.pumpEventsForFilter(Unknown Source)
    at java.awt.Dialog$1.run(Unknown Source)
    at java.awt.Dialog$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.Dialog.show(Unknown Source)
    at javax.swing.JFileChooser.showDialog(Unknown Source)
    at yx.filearchiver.sh.getFileNameFromUser(Unknown Source)
    at yx.filearchiver.gui.pnl4ActionListener.actionPerformed(Unknown Source)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(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)

  • JFileChooser - setSelectedFile doesn't work

    Hi,
    I'm using J2SE 1.4.1_01
    I want a suggested name to appear in the "File name" box when I use JFileChooser to save a file. I seem to remember this working fine with Java 1.3. I've seen it mentioned that I can use setText() on this, but don't understand how this can work. I've also tried explicitly setting the file as commented in my code
    This is my code....
    final JFileChooser fc = new JFileChooser();
    File outFile = new File("D:/EVA/Recombination/RATData/" + testSequence + ".csv");
    File dir = new File ("D:/EVA/Recombination/RATData");
    fc.setCurrentDirectory(dir);
    int returnVal = fc.showSaveDialog(null);
    if (returnVal == JFileChooser.APPROVE_OPTION)
    fc.setSelectedFile(outFile);
    /*also tried...
    fc.setSelectedFile(new File "D:/EVA/Recombination/RATData"+testSequence + ".csv"))*/
    try
    PrintWriter writ = new PrintWriter(new FileWriter(outFile));
    etc, etc.......
    Any suggestions?
    Cheers

    Thanks. It now works I had to change the PrintWriter to a BufferedWriter for it to work. I've posted working code below
    final JFileChooser fc = new JFileChooser();
    fc.addChoosableFileFilter(new FileFilterExt("Excel", new String[]{".csv"}));
    File outFile = new File(testSequence + ".csv");
    File dir = new File("D:/EVA/Recombination/RATData");
    fc.setCurrentDirectory(dir);
    fc.setSelectedFile(outFile);
    int returnVal = fc.showSaveDialog(null);
    if (returnVal == JFileChooser.APPROVE_OPTION)
    try
    String filename = fc.getSelectedFile().getAbsolutePath();
    BufferedWriter bw = new BufferedWriter(new FileWriter(filename));
    bw.write("whatever you want to write");// I'm writting from a Vector here, so this line is in a for loop.
    bw.flush();
    bw.close();
    catch (IOException e)
    System.out.print(e);
    Thanks for your help. My award will be made forwith.
    Cheers!

  • JFileChooser under Java Web Start

    I have a problem when using a JFileChooser - object
    in a Web Start Application:
    I always get the message that there is no disk
    in drive A:,
    even if I create the JFileChooser object
    with a default path String in the constructor
    JFileChosser fileChooser = new JFileChooser("c:\\");
    This does not happen when I start the application
    without Web Start.
    Can anybody help me ?
    Matthias

    Here's the link to bug 4458949
    http://developer.java.sun.com/developer/bugParade/bugs/4458949.html
    The easy workaround (if you have permission) is to call System.setSecurityManager(null). I actually use the following code to minimize the impact:
    SecurityManager backup = System.getSecurityManager();
    System.setSecurityManager(null);
    JFileChooser fileChooser = new JFileChooser(homeDir);
    System.setSecurityManager(backup);
    Rick

  • JFileChooser - can focus be set to textfield?

    when displaying a JFileChooser, focus defaults to the open button.
    is there anyway to change this behavior?
    even a hack, like someway to use the mnemonic for the text field before
    the FileChooser is displayed?
    thanks,
    Greg

    Thanks,
    I didn't know about the getComponent method in container.
    I found the direct subcomponents in JFileChooser are JPanels.
    I went down a second level and found still more Jpanels, which had JLabels but
    no JTextField.
    I tried requesting focus to the JLabel, but this did not work.
    I tried repainting the component, and repainting JFileChooser, still didnt change focus
    from the open button.
    But thanks for getting back to me and getting me in the right direction.
    Try manually finding the JTextField and then
    requesting focus. Assuming that the text field is in
    fact a JTextField, and that it's a direct child of the
    JFileChooser (dig deeper if not), the following should
    work:
    import java.awt.Component;
    import javax.swing.JFileChooser;
    import javax.swing.JTextField;
    JFileChooser myJFileChooser = new JFileChooser();
    Component nextSubComponent;
    for (int i = 0; i <
    i < myJFileChooser.getComponentCount(); i++)
    nextSubComponent =
    ent = myJFileChooser.getComponent(i);
    if ( nextSubComponent instanceof JTextField )
    ((JTextField)nextSubComponent).requestFocus();

  • GUI Update for JDialog/JFileChooser

    Hello, Howdy, Greets, Yo and anything else I missed!
    Lets see if I can explain this well...
    I have a JDialog open in the background. One of the choices on the JDialog is to open the JFileChooser. Whenever I open the JFileChooser the JFileChooser opens in front of the JDialog (like it's supposed to). Therefore there is some overlap of the JFileChooser on top of the JDialog.
    When exiting the JFileChooser (a directory is selected), The JFileChooser GUI partially closes. It closes everywhere but where it overlaps the JDialog. So, for a few seconds it has the GUI of the JFileChooser ONLY where it overlaps the JDialog on the screen. Then after some processing (doing what it does with the JFileChooser data), it finishes removing the JFileChooser GUI that overlaps the JDialog.
    I want the JFileChooser to completely disappear at the same time. I've tried every variation I can think of, to no avail:
    dialog.repaint();
    dialog.validateTree();
    dialog.validate();
    jfc.hide();
    jfc.updateUI();
    jfc.revalidate();
    jfc.repaint();
    Here's an example:
    int choice = jfc.showDialog(new JFrame(), "Select Directory");
    // Tried everything here to hide/remove the jfc GUI
    if (choice == JFileChooser.APPROVE_OPTION )
      // do what it does with the selected directory
    }This happens on every look and feel, so that's probably not the problem. Any ideas?

    Thanks for the advice on threads. I got it working by doing the following...
          int state = jfc.showDialog(new JFrame(), "Select Directory");
          if (state == JFileChooser.APPROVE_OPTION )
            defaultDir = jfc.getSelectedFile();
            Thread myThread=new Thread()
              public void run()
                // Do my other stuff here
            myThread.start();       
          }

  • How does JFileChooser work

    When you use JFileChooser.showDialog, it returns a value as a result of using the dialog. How is this done?
    My guess is that the showDialog method initiates a second runnable thread to display the (modal) dialog, and then does a wait until that thread writes the result back into a shared variable. It can then do a normal return passing the variable to the caller.
    Or maybe it uses callbacks but I have no experience of these.
    I want to write a Chooser dialog very similar to JFileChooser and I'd like to use a similar mechanism to JFileChooser if possible. Does anyone know how it works?
    Thanks,
    Tim

    i mean... what is the implementation of that showDialog() method? i have it now almost kind of sorted out, but if you knew this i would be thankful anyway...

  • Generating virtual files for JFileChooser by implementing FileSystemView

    Hello,
    I'd like to display in a file hierarchy using JFileChooser component of data that I'm fetching from the database. From what I read thus far, I'll need to implement the FileSystemView and FileView abstract classes to generate virtual files on the client. There was also a reported bug for sdk 1.4.1_01 stating that subdirectories could not be viewed when running the JFileChooser. Does anyone know if this bug has been fixed in 1.4.1_02, and could anyone post some sample code how to implement these classes?
    Thanks a lot,
    Ariela

    Hello,
    I'd like to display in a file hierarchy using JFileChooser component of data that I'm fetching from the database. From what I read thus far, I'll need to implement the FileSystemView and FileView abstract classes to generate virtual files on the client. There was also a reported bug for sdk 1.4.1_01 stating that subdirectories could not be viewed when running the JFileChooser. Does anyone know if this bug has been fixed in 1.4.1_02, and could anyone post some sample code how to implement these classes?
    Thanks a lot,
    Ariela

  • JFileChooser displays annoying "Drive A" message

    When I use JFileChooser's showOpenDialog() method with JWS, my app displays a dialog box that says:
    "There is no disk in the drive. Please insert a disk into drive A:"
    I've tried setting a current directory and I still get the message. How do I get rid of this message?

    This is a known bug:
    http://developer.java.sun.com/developer/bugParade/bugs/4458949.html
    Please vote for it to be fixed!

  • Help JFilechooser

    When coding a JfileChooser in an applet it works fine in JBuilder but when I run it from a browser everything else works fine but the JFileChooser will not show up. Curiously though my floppy drive light comes on so it's looking for something.

    Here's the workaround:
    SecurityManager backup = System.getSecurityManager();
    System.setSecurityManager(null);
    JFileChooser fileChooser = new JFileChooser(homeDir);
    System.setSecurityManager(backup);
    The default security manager for JWS checks the floppy for some reason. The latest JDK fixes this.

  • JFileChooserProblem with jdk1.4.0

    When i initialize jFileChooser,My application got the following exception ;
    java.lang.NullPointerException
         at javax.swing.ImageIcon.<init>(ImageIcon.java:161)
         at javax.swing.ImageIcon.<init>(ImageIcon.java:147)
         at com.sun.java.swing.plaf.windows.WindowsFileChooserUI$ShortCutPanel.<init>(WindowsFileChooserUI.java:603)
         at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponents(WindowsFileChooserUI.java:361)
         at javax.swing.plaf.basic.BasicFileChooserUI.installUI(BasicFileChooserUI.java:130)
         at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(WindowsFileChooserUI.java:176)
         at javax.swing.JComponent.setUI(JComponent.java:449)
         at javax.swing.JFileChooser.updateUI(JFileChooser.java:1701)
         at javax.swing.JFileChooser.setup(JFileChooser.java:345)
         at javax.swing.JFileChooser.<init>(JFileChooser.java:320)
         at javax.swing.JFileChooser.<init>(JFileChooser.java:273)
    at run time ..I use jdk1.4.0..i also install jdk1.4.2 and try to run application with it but nothing was changed .Also i run any kind of application with jfilechooser and it doesn't work .(but this applications was working two weeks ago )In addition this error occured only on my computer.
    � use win 2000 pro and implements codes with jDeveloper..
    Can anyone help about this problem?
    Thanks..

    Maybe it's a bug. You can report it, or look to see if it is documented at:
    http://developer.java.sun.com/developer/bugParade/index.jshtml

  • Error in kernel32.dll

    does anyone know when and how an error in kernel32.dll for
    windows (win2000) occurs? im using java 1.4.x.
    thanks in advance.
    - ian

    well i just had one saying that Java has caused an error in kernel 32.dll.
    after running trying and trying it again this message didnt appear anymore
    but the program hanged now with no error. before ive encountered another
    wierd problem where in java hangs whenever i get the default look and feel
    of windows or when i create JFileChooser. i was just wondering if the kernel
    error i got has something to do with there errors.
    here are the thread dump for each. see if you guys can find something wierd in these.
    ==== HANG AT UILookAndFeel ====
    Full thread dump Java HotSpot(TM) Client VM (1.4.2_03-b02 mixed mode):
    "AWT-Windows" daemon prio=7 tid=0x02e29d88 nid=0x960 runnable [725f000..725fd8c]
    at sun.awt.windows.WToolkit.eventLoop(Native Method)
    at sun.awt.windows.WToolkit.run(WToolkit.java:262)
    at java.lang.Thread.run(Thread.java:534)
    "Signal Dispatcher" daemon prio=10 tid=0x009c8da8 nid=0x2a8 waiting on condition [0..0]
    "Finalizer" daemon prio=9 tid=0x00990a10 nid=0x784 in Object.wait() [2b4f000..2b4fd8c]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x1050f430> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
    - locked <0x1050f430> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
    "Reference Handler" daemon prio=10 tid=0x0098f5e0 nid=0x350 in Object.wait() [2b0f000..2b0fd8c]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x1050f498> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:429)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:115)
    - locked <0x1050f498> (a java.lang.ref.Reference$Lock)
    "main" prio=5 tid=0x00034a88 nid=0x934 runnable [7e000..7fc3c]
    at sun.awt.font.NativeFontWrapper.registerFonts(Native Method)
    - locked <0x141ed340> (a java.lang.Class)
    at sun.java2d.SunGraphicsEnvironment.addPathFonts(SunGraphicsEnvironment.java:797)
    at sun.java2d.SunGraphicsEnvironment.registerFonts(SunGraphicsEnvironment.java:643)
    at sun.java2d.SunGraphicsEnvironment.access$200(SunGraphicsEnvironment.java:53)
    at sun.java2d.SunGraphicsEnvironment$2.run(SunGraphicsEnvironment.java:262)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.java2d.SunGraphicsEnvironment.loadFonts(SunGraphicsEnvironment.java:256)
    - locked <0x1050f4a0> (a sun.awt.Win32GraphicsEnvironment)
    at sun.java2d.SunGraphicsEnvironment.mapFontName(SunGraphicsEnvironment.java:504)
    at java.awt.Font.initializeFont(Font.java:312)
    at java.awt.Font.<init>(Font.java:344)
    at sun.awt.windows.WDesktopProperties.setFontProperty(WDesktopProperties.java:157)
    - locked <0x10534da8> (a sun.awt.windows.WDesktopProperties)
    at sun.awt.windows.WDesktopProperties.getWindowsParameters(Native Method)
    at sun.awt.windows.WDesktopProperties.<init>(WDesktopProperties.java:56)
    at sun.awt.windows.WToolkit.initializeDesktopProperties(WToolkit.java:876)
    at java.awt.Toolkit.getDesktopProperty(Toolkit.java:1569)
    - locked <0x1050f268> (a sun.awt.windows.WToolkit)
    at com.sun.java.swing.plaf.windows.XPStyle.getXP(XPStyle.java:75)
    - locked <0x1427fd50> (a java.lang.Class)
    at com.sun.java.swing.plaf.windows.WindowsTreeUI$ExpandedIcon.<init>(WindowsTreeUI.java:123)
    at com.sun.java.swing.plaf.windows.WindowsTreeUI$ExpandedIcon.createExpandedIcon(WindowsTreeUI.java:127)
    at com.sun.java.swing.plaf.windows.WindowsLookAndFeel.initComponentDefaults(WindowsLookAndFeel.java:309)
    at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:81)
    at javax.swing.UIManager.setLookAndFeel(UIManager.java:394)
    at javax.swing.UIManager.setLookAndFeel(UIManager.java:424)
    at Test.main(Test.java:23)
    "VM Thread" prio=5 tid=0x009c76e8 nid=0x92c runnable
    "VM Periodic Task Thread" prio=10 tid=0x009cb5c8 nid=0x944 waiting on condition
    "Suspend Checker Thread" prio=10 tid=0x009c8460 nid=0x940 runnable
    ==== END ====
    ==== HANG AT JFileChooser ====
    Full thread dump Java HotSpot(TM) Client VM (1.4.2_03-b02 mixed mode):
    "AWT-Windows" daemon prio=7 tid=0x02e2ebb8 nid=0x93c runnable [70bf000..70bfd8c]
    at sun.awt.windows.WToolkit.eventLoop(Native Method)
    at sun.awt.windows.WToolkit.run(WToolkit.java:262)
    at java.lang.Thread.run(Thread.java:534)
    "Signal Dispatcher" daemon prio=10 tid=0x009c8da8 nid=0xa74 waiting on condition [0..0]
    "Finalizer" daemon prio=9 tid=0x00990a10 nid=0x860 in Object.wait() [2b4f000..2b4fd8c]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x105103a8> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
    - locked <0x105103a8> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
    "Reference Handler" daemon prio=10 tid=0x0098f5e0 nid=0xa6c in Object.wait() [2b0f000..2b0fd8c]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x10510410> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:429)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:115)
    - locked <0x10510410> (a java.lang.ref.Reference$Lock)
    "main" prio=5 tid=0x00034a88 nid=0xa64 runnable [7e000..7fc3c]
    at sun.awt.font.NativeFontWrapper.registerFonts(Native Method)
    - locked <0x14199820> (a java.lang.Class)
    at sun.java2d.SunGraphicsEnvironment.addPathFonts(SunGraphicsEnvironment.java:797)
    at sun.java2d.SunGraphicsEnvironment.registerFonts(SunGraphicsEnvironment.java:643)
    at sun.java2d.SunGraphicsEnvironment.access$200(SunGraphicsEnvironment.java:53)
    at sun.java2d.SunGraphicsEnvironment$2.run(SunGraphicsEnvironment.java:262)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.java2d.SunGraphicsEnvironment.loadFonts(SunGraphicsEnvironment.java:256)
    - locked <0x10510430> (a sun.awt.Win32GraphicsEnvironment)
    at sun.java2d.SunGraphicsEnvironment.mapFontName(SunGraphicsEnvironment.java:504)
    at java.awt.Font.initializeFont(Font.java:312)
    at java.awt.Font.<init>(Font.java:344)
    at sun.awt.windows.WDesktopProperties.setFontProperty(WDesktopProperties.java:157)
    - locked <0x105367f8> (a sun.awt.windows.WDesktopProperties)
    at sun.awt.windows.WDesktopProperties.getWindowsParameters(Native Method)
    at sun.awt.windows.WDesktopProperties.<init>(WDesktopProperties.java:56)
    at sun.awt.windows.WToolkit.initializeDesktopProperties(WToolkit.java:876)
    at java.awt.Toolkit.getDesktopProperty(Toolkit.java:1569)
    - locked <0x105367c0> (a sun.awt.windows.WToolkit)
    at sun.awt.shell.ShellFolder.<clinit>(ShellFolder.java:208)
    at javax.swing.filechooser.FileSystemView.getRoots(FileSystemView.java:335)
    at javax.swing.filechooser.WindowsFileSystemView.getHomeDirectory(FileSystemView.java:649)
    at javax.swing.plaf.metal.MetalFileChooserUI.installComponents(MetalFileChooserUI.java:214)
    at javax.swing.plaf.basic.BasicFileChooserUI.installUI(BasicFileChooserUI.java:130)
    at javax.swing.plaf.metal.MetalFileChooserUI.installUI(MetalFileChooserUI.java:152)
    at javax.swing.JComponent.setUI(JComponent.java:449)
    at javax.swing.JFileChooser.updateUI(JFileChooser.java:1701)
    at javax.swing.JFileChooser.setup(JFileChooser.java:345)
    at javax.swing.JFileChooser.<init>(JFileChooser.java:320)
    at javax.swing.JFileChooser.<init>(JFileChooser.java:273)
    at Test.main(Test.java:26)
    "VM Thread" prio=5 tid=0x009c76e8 nid=0xa68 runnable
    "VM Periodic Task Thread" prio=10 tid=0x009cb5c8 nid=0x9d0 waiting on condition
    "Suspend Checker Thread" prio=10 tid=0x009c8460 nid=0xa70 runnable
    ==== END ====
    - ian

  • How to output to a file in table format?

    I would like to output my result in table format, for example:
    1, 305,134
    2, 245,98
    1, 34,204
    3, 205,315 etc.
    Any ideas how to do it?
    I have tried PrintWriter class and it work but when I used JFileChooser to choose to load an image file, there is no file output.

    Hi !
    Do something like this :
    try{
    FileWriter fw = new FileWriter("youroutputfilename.txt");
    BufferedWriter buff = new BufferedWriter(fw);
    for(int i=0; i < [end of your loop]; i++){
    buff.write(data1+";"+data2+";"+data3+";"+.....);
    buff.close();
    }catch(IOException e){System.out.println("couldn't write the file");}
    I hope it helps .
    stephane

  • Udated to 6-0-2

    I updated to 6_0_2 and all the JFileChoosers are taking 8 to 9 seconds to display!
    Everything has been working fine. 4 months back I updated to 6_0_1
    and it went smoothly.
    This weekeend I updated to 6_0_2.
    My program no longer works properly. I am pressing a JButton which is
    supposed to create and display a JFileChooser, and it's hanging 8 to 9
    seconds before displaying the JFileChooser.
    I uninstalled 6_0_2 using the Add/Remove programs, went back in and
    compiled the program, and ran it thinking that I would just go back to
    using the 6_0_1.
    It's not working on that now either.
    Is there something else I need to delete to completely remove 6_0_2?
    I am using Eclipse so I went into the Project Properties and specified to use
    the JRE 6_0_1 again, recompiled, and ran it... but it's still now working...
    Any help would be appreciated...

    I believe I found my answer, so I thought I would share ....
    It may not be the update to 6u2 ... When updating to 6u2, I downloaded
    the 6u2 install, documents, and source code bundles from Sun, Firefox
    put the downloaded zip files onto my Desktop.
    Not normally a problem... however, apparently the existance of zip files on
    your Desktop is an issue when instantiating a JFileChooser, and causes considerable delays....
    Bug 6372808, In progress and submitted on 16-JAN-2006.
    Hope this helps someone else.. Hope they fix this soon!
    -Deb

Maybe you are looking for