[英]SWT Filedialog Open into home folder
我想打開FileDialog窗口進入用戶主文件夾(即/ home / user或/ Users / unsername)
我使用System.getProperty讀取了用戶主文件夾:
String homefolder = System.getProperty(user.home);
並且該變量包含正確的主文件夾。 但是,當我在FileDialog中設置filterpath時,它在Linux中僅打開/ home級別,而沒有輸入用戶主目錄。
這是源代碼:
FileDialog dialog = new FileDialog(shell);
dialog.setText("Choose a certificate");
String platform = SWT.getPlatform();
String homefolder = System.getProperty("user.home");
dialog.setFilterPath(homefolder);
任何的想法? 這里的截圖:
您的代碼與SWT 3.6.1完美配合。 這里有一個錯誤報告,指出這是SWT版本<= 3.3中的問題,並已在3.4中修復。
因此,解決方案將是安裝一個Never版本(最好是當前版本)。
由於您提到使用Maven存儲庫,因此這里有一個SWT 3.8:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.