简体   繁体   English

如何重写Java SWT FileDialog类的“打开”按钮

[英]How to override the Open button of Java SWT FileDialog class

I want the file selction dialog to be popping up when i press a button.For this i am using org.eclipse.swt.widgets.FileDialog class and opening the dialog. 我希望在按下按钮时弹出文件选择对话框。为此,我正在使用org.eclipse.swt.widgets.FileDialog类并打开对话框。 By default there are two buttons "Open"(the button we press after selecting the file) and "Cancel" button. 默认情况下,有两个按钮“打开”(我们在选择文件后按下的按钮)和“取消”按钮。

I want the name on the button to change from "Open" to "Import". 我希望按钮上的名称从“打开”更改为“导入”。

Is it possible to override this button on FileDialog? 是否可以在FileDialog上覆盖此按钮?

SWT uses OS resources. SWT使用OS资源。 The file dialog you see is the typical OS dialog for opening files. 您看到的文件对话框是打开文件的典型OS对话框。 You can't change the button's text without implementing your own dialog. 如果不实现自己的对话框,则无法更改按钮的文本。

The only alternative to Open is Save by using the style bit: Open的唯一替代方法是使用样式位Save

SWT.SAVE

instead of 代替

SWT.OPEN

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

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