JFileChooser use within JApplet
JApplet use a
JFileChooser so that the user can select a file on his hard-drive? Or would this violate Java applet security? (I'm assuming that the default security settings are being used. I don't want to ask my users to grant me extra permissions.)
Asked by: Kimberly808 | Posted: 28-01-2022
This thread indicates that you need to digitally sign your applet before a
JFileChooser is permitted.
As mentioned, you need to sign your applet, which result in a "vague security warning" when the user is presented the applet. When the user accept to run this applet, the applet is given full access and functions like an ordinary application with it's obvious security implications. I'm in the same dilemma regarding a web application I'm working on and is not yet sure if it'll get deployed.
You could alternatively use the built-in filebrowser in the webbrowser and bounce back the file-content from your server if you're working with smaller files.
Also, some security measures you can make regarding a signed applet are:
Validating the origin of the applet code.
URL appletUrl = MyApplet.class.getProtectionDomain().getCodeSource().getLocation(); if(appletUrl.toString().equalsIgnoreCase(safeAppletUrl) == false) return false;
Verifying the base URL from which the applet was run.
URL documentUrl = this.getDocumentBase(); if(documentUrl.toString().equalsIgnoreCase(safeDocumentUrl) == false) return false;
In that case (of using default settings), you're correct, the default security manager does not allow access to local files.Answered by: Elise720 | Posted: 01-03-2022
You will probably have to use PrivilegedAction to read anything from the user's hard drive. Just as @mmyers said you'll have to sign your applet as well.
So your answer is yes, I've done this before so I know it can be done.Answered by: Madaline422 | Posted: 01-03-2022
java - JFileChooser embedded in a JPanel
I am writing a java program that needs a file open dialog. The file open dialog isn't difficult, I'm hoping to use a JFileChooser. My problem is that I would like to have a dual pane JFrame (consisting of 2 JPanels). The left panel would have a JList, and the right panel would have a file open dialog. When I use JFileChooser.showOpenDialog() this...
interface - How do I setup up JFileChooser for single click behavior in java Swing?
How do I change the JFileChooser behavior from double-click selection to single-click selection mode? I'm developing an application to run with either a single-click interface (nothing requires a double-click, just like the KDE interface mode) or a double-click interface (the default Windows interface mode or the regular GNOME interface mode). I want the Java application to behave just like the rest of...
java - JFileChooser hangs sometimes
I am running into the problem of the "hanging JFileChooser" as described in the following threads: http://forums.sun.com/thread.jspa?threadID=5309960 http://forums.sun.com/thread.jspa?threadID=724817
java - JFileChooser for Python?
I was wondering if there is something similar to Java's JFileChooser for Python? JFileChooser is a graphical front end to choose a file. Preferably something that is already with Python. Maybe with Tkinter.
java - Alternative to JFileChooser
I've a request to make some changes to a little applet that currently use a JFileChooser. One of the main complaints is that the file chooser is a pain in the ass to use because it behaves differently than the native widget, especially for navigating up to the root level. So, knowing that and all the other issue JFileChooser suffer (like the zip file caching on windows...), I was wondering that a viable alterna...
java - JFileChooser on OS X
JFileChooser looks nothing like the native widget. I seem to remember reading some hack to get it look like the native widget but searching for it know i can't seem to find it again i came across posts that suggest using java.awt.FileChooser but that class does not seem to be in the distribution. How can i make JFileChooser make look like the native widget?
java - Part of path returned from Directories Only JFileChooser is sometimes duplicated
In my application, I want the user to be able to select a directory to store stuff in. I have a text field that I'm using to display the directory they've chosen. If they just click on a directory (don't browse it), everything is fine. However, if they double click on the directory and look inside it, the directory name is duplicated. Ex. They're in the home directory, single click the folder Desktop...path returne...
java - How can we set the exit button of JFileChooser?
we use setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) for JFrame and those classes that implements JFrame. what can we do like this for JFileChooser?(the window that suddenly when you push browse button will pups up)
java - JFileChooser for directories on the Mac: how to make it not suck?
The JFileChooser in "directories only" mode on the Mac has two serious, crippling problems: 1) You cannot create directories with it 2) You cannot switch drives This is rather a huge problem for my installer app. As far as I can tell, Apple provides no way around this problem, you can't even activate the non-native directory chooser ... so the only alternative is to find a free/open source pure-Java...
java - JFileChooser browsing a remote file system
I am trying to Implement a JFileChooser that allows a user to select files on a remote system via ftp. Everything I've read says this can be accomplished by extending FileSystemView so that all the file system methods (getFiles, etc) are overridden and routed across ftp. I haven't had any luck implementing this, as FileSystemView appears to still be calling local functions. Can anyone confirm that t...
Still can't find your answer? Check out these amazing Java communities for help...
Java Reddit Community | Java Help Reddit Community | Dev.to Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)