csalem01
asked on
java JFileChooser crashes firefox
I have an applet that crashes firefox (by crash I mean completely freezes up and I have to open the task manager and kill the process) most of the time when a dialog from JFileChooser is created. the applet is signed and it works fine in IE. Does anyone know of a workaround for this, or another class that I can use? Here's my java code:
import java.security.AccessContro ller;
import java.security.PrivilegedAc tion;
import javax.swing.JApplet;
import javax.swing.JFileChooser;
public class TestJFileChooser extends JApplet{
public void init(){}
public void selectLocalFiles(){
AccessController.doPrivile ged(new PrivilegedAction<Object>() {
public Object run() {
JFileChooser jfc = new JFileChooser();
jfc.setMultiSelectionEnabl ed(true);
int returnval = jfc.showOpenDialog(null); //this is where it crashes
if(returnval == JFileChooser.APPROVE_OPTIO N){
}
return null;
}
});
}
}
and here's the html page:
<html>
<body>
<applet id='imagemgr' name='imagemgr' code='TestJFileChooser.cla ss' archive="TestJFileChooser3 .jar" mayscript='mayscript' width=0 height=0></applet>
<a href="javascript: addAttachment()">Test JFileChooser</a>
<script>
function addAttachment(){
var selectedfile = new Array();
var startpos = 0;
document.getElementById("i magemgr"). selectLoca lFiles();
}
</script>
</body>
</html>
import java.security.AccessContro
import java.security.PrivilegedAc
import javax.swing.JApplet;
import javax.swing.JFileChooser;
public class TestJFileChooser extends JApplet{
public void init(){}
public void selectLocalFiles(){
AccessController.doPrivile
public Object run() {
JFileChooser jfc = new JFileChooser();
jfc.setMultiSelectionEnabl
int returnval = jfc.showOpenDialog(null); //this is where it crashes
if(returnval == JFileChooser.APPROVE_OPTIO
}
return null;
}
});
}
}
and here's the html page:
<html>
<body>
<applet id='imagemgr' name='imagemgr' code='TestJFileChooser.cla
<a href="javascript: addAttachment()">Test JFileChooser</a>
<script>
function addAttachment(){
var selectedfile = new Array();
var startpos = 0;
document.getElementById("i
}
</script>
</body>
</html>
ASKER
It actually crashes more often with the update. Seems to crash everytime now.
It only appears to crash if I call the selectLocalFiles() function from javascript. I added a button to the applet that calls that function and it works fine.
It only appears to crash if I call the selectLocalFiles() function from javascript. I added a button to the applet that calls that function and it works fine.
Let Mozilla know about this.
;JOOP!
;JOOP!
ASKER
I reported it to mozilla. So they'll probably get to it 3 years from now, if ever :(
Can you think of any workaround, or anything besides the JFileChooser that I can use?
Do you think I should report this to Sun as well, I wasn't sure if this would be a bug in firefox or the java plug-in?
Some clients have been complaining about this, so any workaround you can think of would be helpfull
Can you think of any workaround, or anything besides the JFileChooser that I can use?
Do you think I should report this to Sun as well, I wasn't sure if this would be a bug in firefox or the java plug-in?
Some clients have been complaining about this, so any workaround you can think of would be helpfull
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hopefully java 6u10 fixes the problem, since they're completely changing how applets work.
FireFox: Help-> check for updates ......
;JOOP!