EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
restoreAllVisitedPages();
KongaDialog dlg = createDialog(ui);
dlg.setVisible(true);
if (dlg.wasOkPressed()) {
apply(dlg.getOwner());
}
}
private KongaDialog createDialog(Ui ui) {
JComponent content = BorderLayoutBuilder.fillWith(ui);
content.setOpaque(true);
UiUtils.setPanelBackgrounds(content, Colors.NEUTRAL_BACKGROUND);
KongaDialog dialog = new WizardStyleDialog(parent, "Preferences", content);
dialog.setFocusedComponent(ui);
dialog.manageLocation(PreferencesViewer.class);
Dimension size = dialog.getSize();
dialog.setSize(new Dimension(Math.max(800, size.width), Math.max(600, size.height)));
dialog.getOKButton().setToolTipText("Save all changes and close this dialog");
dialog.getCancelButton().setToolTipText("Close this dialog without saving any changes");
dialog.setOkButtonAsDefault();
return dialog;
}
});
}