I hava a DirectoryDialog
like this:
private static void openFiles() {
Display display = new Display();
Shell shell = new Shell(display);
DirectoryDialog directoryDialog = new DirectoryDialog(shell, SWT.OPEN | SWT.MULTI);
directoryDialog.setFilterPath("c:\\");
Files[] files = new File(directoryDialog.open().listFiles());
shell.close();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
And how`can I now for example set the minimum size?
I've tryed out shell.setMinimumSize(500, 500)
, but it didn't work!
You cannot set the size of a DirectoryDialog
. The size and position are determined by the OS.
Related: https://www.eclipse.org/forums/index.php/t/142845/
If you absolutely need to enforce a minimum size, you will need to implement your own. For custom dialogs I would recommend taking a look at a JFace Dialog
and its subclasses.
Here is a good article about SWT and JFace dialogs: http://www.vogella.com/tutorials/EclipseDialogs/article.html#jface-dialogs .
I also found a custom directory dialog which is just implemented using a Shell
, so you would naturally have full control over size and position: http://esus.com/creating-an-swt-directorydialog/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.