One can easily set up JFace dialogs to remember their size and position. Furthermore, if the dialog was previously partially off the screen, it will be moved to be fully visible. Just do the following:
For example:
package mainPackage; import java.io.IOException; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.DialogSettings; import org.eclipse.jface.dialogs.IDialogSettings; ... public class ExampleDialog extends Dialog { private final String settingsFilename = "ExampleDialog.txt"; DialogSettings dialogSettings; protected IDialogSettings getDialogBoundsSettings(){ return dialogSettings; } protected int getDialogBoundsStrategy(){ return DIALOG_PERSISTLOCATION | DIALOG_PERSISTSIZE; } @Override public boolean close() { boolean result = super.close(); try { dialogSettings.save(settingsFilename); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; } public ExampleDialog(Shell parentShell) { super(parentShell); dialogSettings = new DialogSettings("settings"); try { dialogSettings.load(settingsFilename); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.setShellStyle(getShellStyle() | (SWT.RESIZE | SWT.SHELL_TRIM)); } }
Title | Date |
EBTCalc (Android) Version 1.53 is now available | May 19, 2024 |
Vault 3 Security Enhancements | October 24, 2023 |
Vault 3 is now available for Apple OSX M2 Mac Computers! | September 18, 2023 |
Vault (for Desktop) Version 0.77 Released | March 26, 2023 |
EBTCalc (Android) Version 1.44 is now available | October 12, 2021 |
Vault (Desktop) Version 0.72 Released | October 6, 2021 |
EBT Compass is Now Available for Android Devices | June 2, 2021 |