Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override the Open button of Java SWT FileDialog class

Tags:

java

swt

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. 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?

like image 277
kk331317 Avatar asked Jan 18 '13 09:01

kk331317


1 Answers

SWT uses OS resources. The file dialog you see is the typical OS dialog for opening files. 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:

SWT.SAVE

instead of

SWT.OPEN
like image 102
Baz Avatar answered Sep 20 '22 02:09

Baz