简体   繁体   English

在Java GUI中显示文件预览

[英]Display file preview in Java GUI

I have a dialog box which contains a browse button. 我有一个对话框,其中包含一个浏览按钮。 I have a requirement where I need to browse through a location in my local system and then whatever file the user selects(it may be pdf,doc,excel etc) he/she should be able to preview it in the dialog box itself. 我有一个要求,我需要浏览本地系统中的某个位置,然后用户选择的任何文件(可能是pdf,doc,excel等),他/她都应该能够在对话框本身中进行预览。 Can anyone help me out with this.Any help is appreciated. 任何人都可以帮我解决这个问题。

In JFileChooser you can use setAccessory : http://docs.oracle.com/javase/7/docs/api/javax/swing/JFileChooser.html#setAccessory%28javax.swing.JComponent%29 JFileChooser您可以使用setAccessoryhttp : //docs.oracle.com/javase/7/docs/api/javax/swing/JFileChooser.html#setAccessory%28javax.swing.JComponent%29

Though you'll have to write the preview component yourself. 虽然您必须自己编写预览组件。 And when it comes to docs and excels it won't be a breeze. 而对于文档和卓越文档来说,这并非易事。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM