G
gajo
Hi, I have two questions considering Java Swing.
1) I have a button and I want to use it to stop my JApplet. I tried
applet.stop() but it didn't do a thing (no errors, nothing). How can I do
this?
2) When I click on another button I want a JFileChooser dialog to show up so
I can open a file. I've read Sun's tutorial but their example doesn't work
either, so I have the feeling it might have to do with me using J2SE 1.2 and
not 1.4 the newest version. However, I cannot switch to the newest version,
so can someone help me how to solve this problem? Here's the code I'm trying
to use:
JFileChooser dijalog = new JFileChooser(); // this is where the exception
occurs!
int returnVal = dijalog.showOpenDialog(getContentPane());
if(returnVal == JFileChooser.APPROVE_OPTION) {
fajl = dijalog.getSelectedFile().getName();
}
I can't quote the entire stack thread cause it gets lost out of the screen,
so I've made a JTextArea and put the exception.getMessage() string in it. It
says the following:
access denied (java.util.PropertyPermission user.dir read)
Do I need to set some permissions, or is this because I'm using an older
version of Java? I'm not trying out my applet in a browser, but by starting
appletviewer, so there shouldn't be any security issues AFAIK...
Gajo
1) I have a button and I want to use it to stop my JApplet. I tried
applet.stop() but it didn't do a thing (no errors, nothing). How can I do
this?
2) When I click on another button I want a JFileChooser dialog to show up so
I can open a file. I've read Sun's tutorial but their example doesn't work
either, so I have the feeling it might have to do with me using J2SE 1.2 and
not 1.4 the newest version. However, I cannot switch to the newest version,
so can someone help me how to solve this problem? Here's the code I'm trying
to use:
JFileChooser dijalog = new JFileChooser(); // this is where the exception
occurs!
int returnVal = dijalog.showOpenDialog(getContentPane());
if(returnVal == JFileChooser.APPROVE_OPTION) {
fajl = dijalog.getSelectedFile().getName();
}
I can't quote the entire stack thread cause it gets lost out of the screen,
so I've made a JTextArea and put the exception.getMessage() string in it. It
says the following:
access denied (java.util.PropertyPermission user.dir read)
Do I need to set some permissions, or is this because I'm using an older
version of Java? I'm not trying out my applet in a browser, but by starting
appletviewer, so there shouldn't be any security issues AFAIK...
Gajo