Hanging on JFileChooser

I am trying to convert a small application from JBuilder to JDeveloper 10.1.3.0.4. It runs fine in JBuilder, but hangs in JDeveloper.
The main window comes up, and I make a menus section to bring up the file selection dialog. I get as far as the line below, but when that executes the program hangs, and I see javaw.exe taking 99% cpu time.
JFileChooser fileChooser = new JFileChooser(".");
I made sure I have the latest jdk, and have moved this statement into different modules just to see if that made a difference. The app compiles fine, but always hangs.
Any suggestions would be appreciated.

look for any audio stuff that begins with "AU" and move it to another place or temporarily re-name it.

Similar Messages

  • 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

  • JFileChooser in Applet hangs ie7 and vm

    Hello
    First of all, excuse my poor english.
    In my website I have a problem with an applet.
    This applet is used to select files from the client computer.
    My JRE version is 1.5.0_10 Java HotSpot(TM) Client VM
    The browser is IE 7
    The OS is WinXP SP2
    First time the page is loaded works fine, but when the page is reloaded it crashes when it makes a new instance of JFileChooser.
    This hangs the ie and the vm.
    I've tried it in other computer that uses the 1.5.0_07 and ie 7, and it works fine.
    This is the code:
    shpFileChooser = new javax.swing.JFileChooser();
    shpFileChooser.setFileSelectionMode(javax.swing.JFileChooser.DIRECTORIES_ONLY);
    int retOutbox = shpFileChooser2.showOpenDialog(null);
    if(retOutbox==JFileChooser.APPROVE_OPTION){
    path = shpFileChooser2.getSelectedFile().getPath();
    else {
    path = "";
    Please Help me.

    I'm also have the problem with JFileChooser spiking the CPU in an applet -- with JRE 6 Update 2, which I just installed (did not happen with Update 1).
    When new JFileChooser() is hit, the CPU usage spikes to 100% for about 15 seconds until the control appears. Then as I navigate through folders, I get a similar spike for each click.
    This is happening for both IE7 and FireFox 2.0.0.5 on WinXP SP2.
    Any insights are much appreciated.

  • JFileChooser - FireFox on OS X - showSaveDialog returns immediately or hang

    I have a singed applet that uses the JFileChooser to allow the suer to pick a file location. This works with FF and IE on Windows, works with Safari on OS X and used to work with FF on OS X. However a bug was just discovered where it no longer works with FF on OS X.
    JFileChooser chooser = new JFileChooser();
    // ask the user where we should save the file
    chooser.setCurrentDirectory(new File(System.getProperty("user.home")));
    System.out.println("*************************** "+System.getProperty("user.home"));
    chooser.setSelectedFile(new File(attachmentName));
    chooser.setDialogTitle("Save Attachment - " + attachmentName);
    int returnVal = chooser.showSaveDialog(null);
    System.out.println("*************************** "+returnVal);
    Doing the above I either get a complete hange of the broswer and VM or the showSaveDialog call returns immediately with a value of ERROR_OPTION and then the dialog is displayed.
    It doesn't seems to make a difference where I put the above code.
    We were supposed to do a release of the software today but this is a show stopper. Any help would be great.

    I've now tried the following:
    public void doit() {
    Runnable getTextFieldText = new Runnable() {
    public void run() {
    System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%% 1 "+ SwingUtilities.isEventDispatchThread() );
    JFileChooser chooser = new JFileChooser();
    System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%% 2 "+ SwingUtilities.isEventDispatchThread() );
    chooser.setCurrentDirectory(new File(System.getProperty("user.home")+"/Desktop/"));
    System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%% 3 "+ SwingUtilities.isEventDispatchThread() );
    chooser.setSelectedFile(new File("fred"));
    System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%% 4 "+ SwingUtilities.isEventDispatchThread() );
    chooser.setDialogTitle("Save Attachment - ");
    System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%% 5 "+ SwingUtilities.isEventDispatchThread() );
    int returnVal = chooser.showSaveDialog(null);
    System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@ "+returnVal);
    try{
    SwingUtilities.invokeLater(getTextFieldText);
    }catch(Exception x){
    x.printStackTrace();
    Which works everywhere except FF which hang after the user dismisses the dialog. I'm begging for any insight here.

  • JFileChooser hang when brosing root directory of Truecrypt Encrypted drive

    Hi,
    I have been consistently having a problem with netbeans where if I try to browse to the root directory of my encrypted drive, it hangs for a long time (say 5 - 10 minutes). It then eventually comes back with the correct file choose dialog.
    At first I thought this was just a Netbeans issues. However, I was also developing a Java Swing app (in eclipse) that uses a JFileChooser dialog. If I browse a standard drive I have no problems. If I then go to browse my encrypted file, I get this hang. When I compared the netbeans scenario with this, the only thing in common is that I was trying to browse my encrypted drive.
    This only seems to happen when I want to browser to the root directory of this drive. If I am able to get the dialog to open (on a normal drive) and I directly enter a sub directory of the encrypted drive into the file name field, I can browse there without the hang.
    So just wondering if anyone else has had this problem. I know it isolated to swing JFIleChooser, to at least swing on Windows XP as I don't get this problem through the native file chooser, or through the native file chooser via SWT.
    My drive was encrypted using Truecrypt.
    Truecrypt details
    Size: 41943039488 bytes
    Type: Normal
    Encryption Agorithm: AES
    Key Size: 256 bits
    Block Size: 128 bits
    Mode of Operation: LRW
    Can anyone give me some idea of what might be happening here?
    Regards
    Steve

    I don't know if this is what you are looking for.
    If you need the real roots, you can use this
    File[] file = File.listRoots();
    It should return the available filesystem roots.

  • JFileChooser hangs when clicking OK or CANCEL

    I have created an applet to run primarily in Netscape 6 with JRE 1.3.1. I have also adjusted the policy file to give my applet all permissions on the local system. In my Applet I want the user to select a file from the local hard drive. To achieve this I am using the JFileChooserClass however after I select a file from the FileChooser and click OK the dialog does not disappear and Netscape hangs.
    Has anyone else seen this behaviour? Is there a way to workaround it?
    I have included my code just in case I am doing something wrong.
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.filechooser.*;
    System.setSecurityManager(null);
    int returnVal = 0;
    String fileName = "";
    //Create a file chooser
    final JFileChooser fc = new JFileChooser();
    returnVal = fc.showOpenDialog(this.getParent());
    if (returnVal == JFileChooser.APPROVE_OPTION) {
    File file = fc.getSelectedFile();
    fileName = file.getAbsolutePath();
    Thanks,
    Anthony

    Hi,
    I am having a similar problem. We have a signed applet that presents a JFileChooser and the user selects a file to open. The JFileChooser hangs IE. The applet worked fine on JRE1.3.0.2. The problem arose when we upgraded to JRE1.3.1. Down grading to 1.3.0.2 is not an option for us. Does anyone have a workaround ?
    regards,
    Joag

  • JFileChooser hangs sometimes

    Hi,
    When I open a JFileChooser save dialog the EDT thread hangs indefinitely. From the stack trace I can see that it is waiting indefinitely when it tries to check if a file is a link or not. This happens only sometimes.The default selected directory(My Documents) does not contain any links or shortcuts.
    Following is the stack trace of AWT-EventQueue thread:
    "AWT-EventQueue-2" prio=6 tid=0x039c9400 nid=0x1210 waiting on condition [0x0400e000..0x0400fb94]
    java.lang.Thread.State: WAITING (parking)
         at sun.misc.Unsafe.park(Native Method)
         - parking to wait for <0x0ae38cd0> (a java.util.concurrent.FutureTask$Sync)
         at java.util.concurrent.locks.LockSupport.park(Unknown Source)
         at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source)
         at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(Unknown Source)
         at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(Unknown Source)
         at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
         at java.util.concurrent.FutureTask.get(Unknown Source)
         at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Unknown Source)
         at sun.awt.shell.Win32ShellFolder2.hasAttribute(Unknown Source)
         at sun.awt.shell.Win32ShellFolder2.isLink(Unknown Source)
         - locked <0x0ae38b00> (a sun.awt.shell.Win32ShellFolder2)
         at javax.swing.filechooser.FileSystemView.isFileSystem(Unknown Source)
         at javax.swing.filechooser.FileSystemView.getSystemDisplayName(Unknown Source)
         at javax.swing.plaf.basic.BasicFileChooserUI$BasicFileView.getName(Unknown Source)
         at javax.swing.JFileChooser.getName(Unknown Source)
         at sun.swing.FilePane$FileRenderer.getListCellRendererComponent(Unknown Source)
         at javax.swing.plaf.basic.BasicListUI.updateLayoutState(Unknown Source)
         at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(Unknown Source)
         at javax.swing.plaf.basic.BasicListUI.getPreferredSize(Unknown Source)
         at javax.swing.JComponent.getPreferredSize(Unknown Source)
         at javax.swing.ScrollPaneLayout.layoutContainer(Unknown Source)
         at java.awt.Container.layout(Unknown Source)
         at java.awt.Container.doLayout(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validate(Unknown Source)
         - locked <0x0914e040> (a java.awt.Component$AWTTreeLock)
         at java.awt.Dialog.conditionalShow(Unknown Source)
         - locked <0x0914e040> (a java.awt.Component$AWTTreeLock)
         at java.awt.Dialog.show(Unknown Source)
         at javax.swing.JFileChooser.showDialog(Unknown Source)
         at javax.swing.JFileChooser.showSaveDialog(Unknown Source)
         at com.text.SaveApp.launchExportDialog(ActionManager.java:1356)
         at com.text.SaveApp.actionPerformed(ActionManager.java:608)
         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.AbstractButton.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.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)
    "Basic L&F File Loading Thread" prio=6 tid=0x03413800 nid=0x1438 waiting on condition [0x0503f000..0x0503fd94]
    java.lang.Thread.State: WAITING (parking)
         at sun.misc.Unsafe.park(Native Method)
         - parking to wait for <0x0ae389c0> (a java.util.concurrent.FutureTask$Sync)
         at java.util.concurrent.locks.LockSupport.park(Unknown Source)
         at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source)
         at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(Unknown Source)
         at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(Unknown Source)
         at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
         at java.util.concurrent.FutureTask.get(Unknown Source)
         at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Unknown Source)
         at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run0(Unknown Source)
         at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run(Unknown Source)
    "Swing-Shell" daemon prio=6 tid=0x03b8e800 nid=0x7e4 waiting for monitor entry [0x0437f000..0x0437fb14]
    java.lang.Thread.State: BLOCKED (on object monitor)
         at sun.awt.shell.Win32ShellFolder2.isFileSystem(Unknown Source)
         - waiting to lock <0x0ae38b00> (a sun.awt.shell.Win32ShellFolder2)
         at sun.awt.shell.Win32ShellFolder2.equals(Unknown Source)
         at java.util.AbstractList.equals(Unknown Source)
         at java.util.Vector.equals(Unknown Source)
         - locked <0x0ae38b90> (a java.util.Vector)
         at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread$1.call(Unknown Source)
         at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread$1.call(Unknown Source)
         at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
         at java.util.concurrent.FutureTask.run(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Let me know if any one has faced similar problems.

    "AWT-EventQueue-2"
    - locked <0x0ae38b00> (a sun.awt.shell.Win32ShellFolder2)
    "Swing-Shell"
    - waiting to lock <0x0ae38b00> (a sun.awt.shell.Win32ShellFolder2)
    That's definitely a symptom of the problem. AWT-EventQueue-2 has not released that lock because it is:
    - parking to wait for <0x0ae38cd0> (a java.util.concurrent.FutureTask$Sync)
    Can you find that object "0x0ae38cd0" somewhere else in the thread dump? It might be revealing to see who has ahold of it and why they haven't released it yet.

  • JFileChooser hanging problem

    I am developing an application in which I use JFileChooser. It was working for a while and then (after a recent new application instal) it started to hang every time it attempted to execute the line
    JFileChooser fc = new JFileChooser();
    I tried creating a trivial new application, tried stepping into the library code and tried re-installing NetBeans 4.1 - all with no success.
    Can you suggest what else I might try?

    Thanks for the suggestion. I had not tried printing before and after so I tried it as follows:
    I put the following lines:
    System.out.println("starting new call");
    JFileChooser fc = new JFileChooser();
    System.out.println("ended new call");
    iand I got the following when I ran it:
    nit:
    deps-jar:
    compile:
    run:
    starting new call
    I then had to interrupt the process because it hung and I got:
    Java Result: 1073807364
    I had already tried it with the debugger and stepped into the code invoked by the call to new JFileChooser(). It eventually reached the Toolkit function getDefaultToolkit and never successfully returned from there. It repeatedly executed the test
    if (toolkit == null)
    as false and went straight to the final line
    return toolkit;
    Stepping on or trying to step out of that function simply returned execution to the function's opening line:
    if (toolkit == null)
    This appears to loop.
    I had a problem with Star Office not long before this problem surfaced. It reported that it had failed to save a file as I closed the application. Since it is Java based (and I am ignorant of whether there could be interference) I wonder whether that could have resulted in an overwrite of something in NetBeans. That was why I tried a re-instal - but with no beneficial effect.

  • JFileChooser causes hang

    I have written a Java application that I run on Unix and PC. In PC (Windows 2000, JVM version 1.4.1_01), sometimes my application will hang at the following line:
    fileChooser = new JFileChooser(System.getProperty("user.dir")+
    System.getProperty("file.separator");
    If I reboot my PC, it will work again. But I would like to know the real reason. Is there a bug in Java Hotspot?
    BTW, it never has any problem in Solaris Unix.
    Any help would be appreciated.

    Hello,
    do you are sure to get installed the JRE 1.4.1 correctly ?
    It looks like an incompatibility of the DLL's of your operating system (Windows NT ?) with the JRE.
    regards
    rko

  • Hang when using UIManager.getSystemLookAndFeelClassName() and JFileChooser

    i encountered this wierd problem when i used UIManager.getSystemLookAndFeelClassName() and JFileChooser on a machine with win2002 (no service pack installed) and on another machine with winxp (no service pack installed). the code works perfectly fine with other pc but apparently our client did something to make it hang whenever either of these were called. i was just wondering how this can happen since its no longer a code problem but rather betwen java and windows. our program runs on java 1.4.x.
    for more info about this problem here's a simple test program that doesnt work on the said machines:
    === code start ===
    import java.io.File;
    import javax.swing.JFileChooser;
    import javax.swing.UIManager;
    public class Test {
    public static void main(String[] args) throws Exception {
    // this portion works fine. this is to prove that there is no problem with IO on java
    File file = new File(".");
    String files[] = file.list();
    System.out.println(file.getAbsolutePath());
    for(int i=0;i<files.length;i++)
    System.out.println(files);
    // program hangs on this part. see thread dump of JFileChooser below
    System.out.println("init JFileChooser");
    JFileChooser fileChooser = new JFileChooser ();
    // when code above is commented out, program also hangs on this part. see thread dump of UIManager below
    System.out.println("init UILookAndFeel");
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    System.out.println("done");
    === code end ===
    thread dump of JFileChooser:
    === thead dump start ===
    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
    === thead dump ends ===
    thread dump of UIManager:
    === thead dump start ===
    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
    === thead dump ends ===
    hope someone can clarify me with this wierd anomaly.
    thanks.
    - ian
    [email protected]

    Try to move the following line of ur code to the first statement in main()
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }

  • JFileChooser hangs Netscape but not IE

    Hi,
    Sorry to be asking so many questions but I am in a bit of a fix for the moment.
    I have created a JApplet which creates a JFileChooser. This works fine in IE5 but in Netscape 7.0 whenever I press the OK or Cancel buttons Netscape stops dead.
    I know other people have seen this behaviour - does anyone have a solution ?
    Thanks for reading,
    BadLands

    I think it's got something to do with the netscape security policy.
    Does anyone know I to change it ?
    BadLands

  • Jfilechooser hangs

    Hi - not sure if this is the right forum - but
    Ive written a small applet ans singed it to select a few files and put them in a list . All initated by java script calls.
    The trouble is as soon as the jfilechooser dialog is shown the applet freezes for up to 10 mins maybe more ?
    I've downloaded the latest jdk and jre -- any help is gratefuly received. I get the same effect using IE7 and firefox
    import java.net.*;
    import java.io.*;
    import java.awt.*;
    import java.lang.String.*;
    import java.beans.*;
    import javax.swing.*;
    import java.util.List;
    public class PictDeskUploader extends JApplet //implements ActionListener
         public static final long serialVersionUID = 1L;
         private DefaultListModel listModel; // We need a model to adjust the list     
         public JList pictFileList; // the Jlist object that will hold the list of files
         Container contentpane; // used to reference where the list will be placed
         public JFileChooser fc; // file chooser
         private File[] files; // Array to hold the file chooser results
         public void init ()
              //evt.start();
    try {
    javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              fc = new JFileChooser();
              contentpane = this.getContentPane();
              contentpane.setLayout(new FlowLayout());
              listModel = new DefaultListModel();
              pictFileList = new JList(listModel);
              pictFileList.setSelectedIndex(0);
              pictFileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
              contentpane.add(new JScrollPane(pictFileList));
         }catch(Exception e){
                        e.printStackTrace();
         public int addFiles()
              int i; //array loop counter
              String fname ;
              fc.setMultiSelectionEnabled(true); // Allow for multiple selections
              fc.showOpenDialog (this); // Show the file chooser dialog to the user
              files=fc.getSelectedFiles(); // Load the file array with the current selected files
              //evt.start();
              for ( i = 0; i < files.length; i++) { //loop through the array of files and only add if we havent got it already
                   fname=files.getPath() ;
                   if (pictFileList.getModel().getSize() > 0 )
                   if ( pictFileList.getNextMatch(fname, 0, javax.swing.text.Position.Bias.Forward) == -1 )
                        listModel.addElement ( fname );
                        } else
                   listModel.addElement ( fname );
         // File Add files
                   return 0;
         public int deleteFiles()
              int i; //array loop counter     // File remove code
                   if (pictFileList.getModel().getSize() > 0 ){   // only if more than 1 file     
                        for(i = 0; i < pictFileList.getModel().getSize(); i++) {
                        int index = pictFileList.getSelectedIndex();
                        listModel.remove(index);
                   return 0;

    Have you tried this in a non-applet program? If it works well there, then this could be due to Java applet's inherent limitation on access to client's data.
    from Google:
    if untrusted, it (an applet) has severely limited access to the user's system - in particular having no direct access to the client's disk or clipboard.

  • JFileChooser hangs around

    Hi,
    I have a JFileChooser so I can choose a file... but then I do some processing during the course of which the JFrame, JPanel etc. fields are meant to be updated. But JFileChooser just won't go away and return focus/control/whatever to the main Objects in my program (i.e. JFrame etc.). So the fields only get updated at the end of the processing, at which time the Jfilechooser also goes away.
    I have tried so many things to try and get rid of it: grabfocus, setVisible, disable, etc. etc. But I just can't get rid of it when it's done its job!
    any help much appreciated
    Mike

    if so, the problem is that your swing event loop is busy doing the processing of the file that is picked by the JFileChooser.
    to fix this, simply kick off your processing in it's own thread. and then if you want your thread to update the JFrame then you will need to use the SwingUtilities.invokeLater(runnable) method. to do that, you create little Runnables that have a reference to the item you want to update, such as a TextField and you would put the update in there, such as jTextField.setText("something");

  • Why is my applet hanging?

    Can anyone give me some insight as to why my applet is hanging? I just get the grey rectangle and no output in the java plugin console as to any kind of errors. I think it may have to do with hte ContentPane in both the main() and init() but I am not sure. I have been struggling with this problem for a couple of days now and I am not sure how to resolve it. Thanks in advance
    import java.awt.*;
    import java.lang.*;
    import java.io.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.filechooser.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    import java.awt.image.*;
    import javax.swing.text.*;
    import com.tpg.base.MileMessages;
    public class BlackBoxUIApplet extends JApplet implements ActionListener{
         public static int WIDTH = 800;
         public static int HEIGHT = 450;
         private boolean inAnApplet = true;
         //public static String TITLE = "Turnpike BlackBoxUI";
         //public static String input;
         Container frameContainer;
         JPanel[] panels = new JPanel[4];
         JMenuBar menuBar = new JMenuBar();
         JMenu fileMenu = new JMenu("File");
         JMenuItem fileExit = new JMenuItem("Exit");
         //Icon openIcon = new ImageIcon("C:\\Dave\\Java Swing\\open.gif");
         JLabel statusLabel = new JLabel();
         //Icon statusIcon = new ImageIcon("flashing_red_button.gif");
         JButton pushButton1 = new JButton("Process File");
         JButton pushButton2 = new JButton("Process Folder");
         JButton pushButton3 = new JButton("One More Button");
         JButton openButton = new JButton("Open a File");
         //JLabel pbLabel = new JLabel("Processing.....");
         JTextArea textArea = new JTextArea(30,90); //rows,cols
         JScrollPane areaScrollPane = new JScrollPane(textArea);          
         JTextField inputFile = new JTextField(32);
         JTextField status = new JTextField(20);
         JTextField status1 = new JTextField(20);
         //JProgressBar pb = new JProgressBar();
         PipedInputStream piOut;
    PipedOutputStream poOut;
         String inputValue;
         MileMessages messages;
         //pb.setIndeterminate(true);
         //to avoid message about system event access
         public BlackBoxUIApplet() throws IOException
              this(true);
         //public BlackBoxUIApplet(boolean inAnApplet)
         public BlackBoxUIApplet(boolean inAnApplet) throws IOException
         //super(TITLE);
         //input = inputValue;
         this.inAnApplet = inAnApplet;
              if(inAnApplet)
                   getRootPane().putClientProperty("defeatSystemEventQueueCheck",
                                                                                              Boolean.TRUE);
                   // Set up System.out
    piOut = new PipedInputStream();
    poOut = new PipedOutputStream(piOut);
                        messages = new MileMessages();
    System.setOut(new PrintStream(poOut, true));
                        // Create reader threads
    new ReaderThread(piOut).start();
         public void init()
         setContentPane(buildGUI());
         //addWindowListener(new WindowHandler());
         fileExit.addActionListener(new MenuItemHandler());
         pushButton1.addActionListener(this);
         pushButton2.addActionListener(this);
         pushButton3.addActionListener(this);
         openButton.addActionListener(this);
         //setupEventHandlers();
         setSize(WIDTH, HEIGHT);
         setBackground(Color.darkGray);
         inputValue = JOptionPane.showInputDialog("Please input your ctxURL: (eg. //localhost:8080/main/InboundXMLServlet)");
         messages.runMilesMessages(inputValue);
         //show();
         public void actionPerformed(ActionEvent e)
              String cmd = e.getActionCommand();
              System.out.println("Command is: " + cmd);
              if(cmd.equals("Process File"))
                   textArea.append("I am processing!" + "\n");
                   System.out.println("ctxURL is: " + inputValue);
                   //status.setText("Currently processing " + inputValue + "....");
              else if(cmd.equals("Open a File"))
                        //final JFileChooser fc = new JFileChooser(new File(System.getProperty("user.dir"))); //goes up two levels from invoking directory
                        //final JFileChooser fc = new JFileChooser("../.."); //goes up two levels from invoking directory
                        final JFileChooser fc = new JFileChooser("../..");
                        fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
                        int returnVal = fc.showOpenDialog(this);
                        if (returnVal == JFileChooser.APPROVE_OPTION)
                             File file = fc.getSelectedFile();
                             inputFile.setText(file.getPath());
              else if(cmd.equals("Process Folder"))
              else if(cmd.equals("One More Button"))
         public Container buildGUI()
              setupMenuBar();
              Container tempContainer = layoutComponents();
              return (tempContainer);
         void setupMenuBar()
              fileMenu.add(fileExit);
              menuBar.add(fileMenu);
              setJMenuBar(menuBar);
         public Container layoutComponents()
              for(int i=0; i<panels.length;++i)
                   panels[i] = new JPanel();
                   panels[0].setBorder(new TitledBorder("Push Buttons"));
                   //panels[0].setBorder(BorderFactory.createEtchedBorder());
                   panels[0].setLayout(new FlowLayout(1, 10, 90)); //center with horz gap of 10 and vert gap of 60
                   //panels[0].setLayout(new BorderLayout());
                   //panels[0].setLayout(new GridLayout(3,1));
                   //use setPreferredSize(Dimension) to change size of each panel
                   //panels[0].setAlignmentX((float) 20);
                   pushButton1.setMargin(new Insets(5,10,5,10));
                   pushButton1.setVerticalTextPosition(AbstractButton.CENTER);
                   pushButton1.setHorizontalTextPosition(AbstractButton.LEFT);
                   pushButton1.setToolTipText("Process a File");
                   pushButton2.setMargin(new Insets(5,10,5,10));
                   pushButton2.setVerticalTextPosition(AbstractButton.CENTER);
                   pushButton2.setHorizontalTextPosition(AbstractButton.LEFT);
                   pushButton2.setToolTipText("Process a Folder");
                   pushButton3.setMargin(new Insets(5,10,5,10));
                   pushButton3.setVerticalTextPosition(AbstractButton.CENTER);
                   pushButton3.setHorizontalTextPosition(AbstractButton.LEFT);
                   pushButton3.setToolTipText("Tip3");
                   //panels[0].add(Box.createVerticalStrut(2));
                   panels[0].add(pushButton1);
                   //panels[0].add(pushButton1, BorderLayout.NORTH);
                   //panels[0].add(Box.createVerticalStrut(2));
                   panels[0].add(pushButton2);
                   //panels[0].add(pushButton2, BorderLayout.CENTER);
                   //panels[0].add(Box.createVerticalStrut(2));
                   panels[0].add(pushButton3);
                   //panels[0].add(pushButton3, BorderLayout.SOUTH);
                   panels[1].setBorder(new TitledBorder("Status"));
                   panels[1].setLayout(new FlowLayout(1,10,60));
                   //panels[1].setBorder(BorderFactory.createEtchedBorder());
                   //panels[1].setLayout(new GridLayout(2,1));
                   status.setEditable(false);
                   status1.setEditable(false);
                   //statusLabel.setIcon(statusIcon);
                   panels[1].add(statusLabel);
                   status.setText("Server is OK.");
                   status1.setText("File is OK.");
                   panels[1].add(status);
                   panels[1].add(status1);
                   //panels[1].add(pbLabel);
                   //pb.setIndeterminate(true);
                   //panels[1].add(pb);
                   //pb.setValue(0);
                   //pb.setStringPainted(true);
                   panels[2].setBorder(new TitledBorder("File Input"));
                   //panels[2].setBorder(BorderFactory.createEtchedBorder());
                   //panels[2].setLayout(new BoxLayout(panels[2], BoxLayout.X_AXIS));
                   panels[2].setLayout(new FlowLayout(1,50,20));
                   //panels[2].setLayout(new GridLayout(1,2));
                   //panels[2].add(Box.createHorizontalStrut(5));
                   panels[2].add(inputFile);
                   //panels[2].add(Box.createVerticalStrut(5));
                   panels[2].add(openButton);
                   //panels[2].add(Box.createHorizontalStrut(15));
                   panels[3].setBorder(new TitledBorder("Output"));
                   //panels[3].setBorder(BorderFactory.createEtchedBorder());
                   panels[3].setLayout(new GridLayout(1,1));
                   textArea.setFont(new Font("Serif", Font.PLAIN, 16));
                   textArea.setMargin(new Insets(5,5,5,5));
                   textArea.setLineWrap(true);
                   textArea.setWrapStyleWord(true);
                   textArea.setEditable(false);
                   areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
                   areaScrollPane.setPreferredSize(new Dimension(50, 50));
                   panels[3].add(areaScrollPane);
                   frameContainer = getContentPane();
                   frameContainer.setLayout(new GridLayout(2,2));
                   //frameContainer.setLayout(new FlowLayout());
                   for(int i=0;i<panels.length;++i)
                        frameContainer.add(panels);
                        //frameContainer.add(Box.createHorizontalStrut(5));
                   return (frameContainer);
         //void setupEventHandlers()
              //addWindowListener(new WindowHandler());
              //fileExit.addActionListener(new MenuItemHandler());
              //pushButton1.addActionListener(new ButtonHandler());
              //pushButton2.addActionListener(new ButtonHandler());
              //pushButton3.addActionListener(new ButtonHandler());
              //openButton.addActionListener(new OpenHandler());
              //inputFile.setActionCommand(textFieldString);
              //inputFile.addActionListener(new TextHandler());
              //cmdField.addAncestorActionListener(new TextAreaHandler());
              //status.addAncestorActionListener(new TextAreaHandler());
         public static void main(String[] args)
              JFrame frame = new JFrame();
              frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
              try
                   BlackBoxUIApplet app = new BlackBoxUIApplet(true);
              frame.setContentPane(app.buildGUI());
              frame.pack();
              frame.setVisible(true);
              catch (IOException e)
         public class MenuItemHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   String cmd = e.getActionCommand();
                   if(cmd.equals("Exit")) System.exit(0);
         class ReaderThread extends Thread {
    PipedInputStream pi;
    ReaderThread(PipedInputStream pi) {
    this.pi = pi;
    public void run() {
    final byte[] buf = new byte[1024];
    try {
    while (true) {
    final int len = pi.read(buf);
    if (len == -1) {
    break;
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    textArea.append(new String(buf, 0, len));
    // Make sure the last line is always visible
    textArea.setCaretPosition(textArea.getDocument().getLength());
    // Keep the text area down to a certain character size
    int idealSize = 100000;
    int maxExcess = 500;
    int excess = textArea.getDocument().getLength() - idealSize;
    if (excess >= maxExcess) {
    textArea.replaceRange("", 0, excess);
    } catch (IOException e) {

    I think I figured out why the applet is hanging. It is right after I call messages.MileMessage(inputValue). That method search the drive for a certain file type. the only problem is that I want to repaint the applet after that method is called and I don't understand how the method is called before I input hte "inputValue" variable! Is there any way to stall the method call until after everything is painted and the inputValue is entered? Sorry, but you hve to look to the previous post for the code.
    -Dave

  • JFileChooser Does not respond

    Folks, Just taking a shot at swing. I have an signed applet running in plugin. The applet has no visual
    components to be shown . When a user clicks a button on the html page i try to call a function in the applet,
    which then opens a jfilechooser. I can select drill down and select required file . But as soon as i select open or cancel button , the button remains clicked and nothing happens and i have to kill the browser to stop it.
    To add to the twist if i call the same function from the init method i can select the file without any problem. I
    have tried to pass "this", "getparentFrame" etc etc. but nothing works. I am sure i missing something silly here.

    Here is the Code folks. I am using jdk 1.3.1. If i call getFile()from within init i can get to my file. I call the same function from javascript JFileChooser just hangs.
    public class SwingTest extends javax.swing.JApplet{
    public void init() {
         try {
              // No Visual components at all
              applet = (Applet) this;
              // For javascript-java-javascript communication
    win = JSObject.getWindow(this);
              doc = (JSObject) win.getMember("document");
         }catch (Exception e){ e.printStackTrace();}     
    } // End of init
    public void getFile()
         JFrame jframe = new JFrame("Select Your File");
         JFileChooser chooser = new JFileChooser("Select Your File .....");
         chooser.showDialog(jframe,"Select Certificate");
         System.out.println("FileChooser returns " + returnVal);
    if(returnVal == JFileChooser.APPROVE_OPTION) { 
         System.out.println("You chose to open this file: " +
    chooser.getSelectedFile().getName()); }
         String mydir = chooser.getSelectedFile().getPath();
    String myname = chooser.getSelectedFile().getName();
    }// End of getFile     
    }// End of SwingTest

Maybe you are looking for

  • Adobe9.3.1

    Ok, I started noticing problem using adobe to open abobe files. Instead of getting the 'adobe' content, the file will open with 'windows', but with right click and 'open with' with adobe option, files open fine. So, I uninstalled adobe 9.3.1, and tri

  • Dashboard component related Query

    Hello, I have a pie chart and 5 column charts and a combo box which drives column charts in my dashboard. I want to add a functionality for column charts where if user clicks on it it reset all column charts. do you know how i can accomplish this? Th

  • Witch Rol Server Should I Install SQL Server 2008 R3 Service Pack 3

    Hello    My enviroment SQL Server has 3 Servers       One Server for DataBase Engine      One Server for SSIS & SSAS      One Server for SSRS  I need to install Service Pack 3 for SQL Server 2008 R2, but have a doubt , Do I need install service pack

  • Data Migration Errors

    Hi, I am trying to migrate the data from CRM 4.0 to CRM 7.0. I am using the XIF Adapters and the related IDOC 's for migrating the data. When trying to replicate an activity which has a followon Sales Order in ECC I am receiving the following error.

  • HT4913 My itunes says my computer is not authorized...how do I add it to the authorized list??

    I cant figure out how to add my new computer to my authorized devices...please help!!