用于远程服务器的 JFilechooser
我有一个 java 应用程序,在某个阶段,使用 JFileChooser.showOpenDialog() 从本地文件系统中选择文件。
现在我想要它在客户端-服务器设置中。这意味着打开一个 GUI(文件浏览器)来选择服务器上的文件。我已经尝试了几种方案来继续使用 JFileChooser,但我无法让正确的设置工作。
如果我知道文件浏览器需要提前默认的路径,有谁知道如何在远程服务器上构建文件浏览器? 例如:如果服务器地址是“http://sand.int.group.com:9083”,并且在此地址上我想要默认的目录位于“/home/myDir/”。如何显示文件浏览器窗口,以便列出位于该服务器上目录中的文件?
I have a java application that, at some stage, select files from the local filesystem using JFileChooser.showOpenDialog().
Now I want it in a client-server setup. This means opening a GUI(file browser) for selecting files on the server. I have already tried several scenarios to keep using the JFileChooser, but I cant get the correct setup working.
Does anyone know how to construct a file browser on the remote server if i know the path the file browser needs to default to in advance?
So for eg: if the server address is "http://sand.int.group.com:9083" and on this address the directory that i want to default to is at "/home/myDir/". How can I display the file browser window so that it lists the files located in the directory on this server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
JFileChooser
无法加载 URL。您需要在想要浏览文件的计算机上映射网络共享。JFileChooser
can't load a URL. You will need to map a network share on the machine that wants to browse to the files.我相信,这将为您服务: http://vfsjfilechooser.sourceforge.net/index.html
基于 JFileChooser 代码的远程文件选择器...
This will serve you purpose, I believe: http://vfsjfilechooser.sourceforge.net/index.html
A remote file chooser based on JFileChooser code...
AFAIK 这不是开箱即用的。本地 JFileChooser 不知道位于服务器端的文件。
以WebSphere为例,使用Websphere管理工具您可以将本地EAR/WAR文件部署到服务器,IBM正在使用JFileChooser来做到这一点。但是,当您要部署远程服务器上的文件时,您会得到完全不同的用户界面。所以这看起来非常棘手。
一种可能的方法可能是实现您自己的 FileSystemView,但我不确定,这只是一个想法。
AFAIK this is not working out of the box. The local JFileChooser has no idea about files located on server side.
Take WebSphere for example, with the Websphere admin tool you can deploy local EAR/WAR files to the server, IBM is doing this with a JFileChooser. But when you are going to deploy a file which is on the remote server you get a completely different UI. So it seems to be very tricky.
One possible way might be to implement your own FileSystemView, but I am not sure, this is just an idea.