public MiscPanel(PreferencesDialog parent) {
super(parent, Translator.get("prefs_dialog.misc_tab"));
setLayout(new BorderLayout());
YBoxPanel northPanel = new YBoxPanel();
JRadioButton useDefaultShellRadioButton = new JRadioButton(Translator.get("prefs_dialog.default_shell") + ':');
useCustomShellRadioButton = new PrefRadioButton(Translator.get("prefs_dialog.custom_shell") + ':') {
public boolean hasChanged() {
return isSelected() != MuConfigurations.getPreferences().getVariable(MuPreference.USE_CUSTOM_SHELL, MuPreferences.DEFAULT_USE_CUSTOM_SHELL);
}
};
// Use sytem default or custom shell ?
if(MuConfigurations.getPreferences().getVariable(MuPreference.USE_CUSTOM_SHELL, MuPreferences.DEFAULT_USE_CUSTOM_SHELL))
useCustomShellRadioButton.setSelected(true);
else
useDefaultShellRadioButton.setSelected(true);
useCustomShellRadioButton.addItemListener(this);
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(useDefaultShellRadioButton);
buttonGroup.add(useCustomShellRadioButton);
// Shell panel
XAlignedComponentPanel shellPanel = new XAlignedComponentPanel();
shellPanel.setLabelLeftAligned(true);
shellPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("prefs_dialog.shell")));
// Create a path field with auto-completion capabilities
customShellField = new PrefFilePathField(MuConfigurations.getPreferences().getVariable(MuPreference.CUSTOM_SHELL, "")) {
public boolean hasChanged() {
return isEnabled() && !getText().equals(MuConfigurations.getPreferences().getVariable(MuPreference.CUSTOM_SHELL));
}
};
customShellField.setEnabled(useCustomShellRadioButton.isSelected());
shellPanel.addRow(useDefaultShellRadioButton, new JLabel(DesktopManager.getDefaultShell()), 5);
shellPanel.addRow(useCustomShellRadioButton, customShellField, 10);
shellPanel.addRow(Translator.get("prefs_dialog.shell_encoding"), createShellEncodingPanel(parent), 5);
northPanel.add(shellPanel, 5);
northPanel.addSpace(10);
// 'Show splash screen' option
showSplashScreenCheckBox = new PrefCheckBox(Translator.get("prefs_dialog.show_splash_screen")) {
public boolean hasChanged() {
return isSelected() != MuConfigurations.getPreferences().getVariable(MuPreference.SHOW_SPLASH_SCREEN, MuPreferences.DEFAULT_SHOW_SPLASH_SCREEN);
}
};
showSplashScreenCheckBox.setSelected(MuConfigurations.getPreferences().getVariable(MuPreference.SHOW_SPLASH_SCREEN, MuPreferences.DEFAULT_SHOW_SPLASH_SCREEN));
northPanel.add(showSplashScreenCheckBox);
// 'Check for updates on startup' option
checkForUpdatesCheckBox = new PrefCheckBox(Translator.get("prefs_dialog.check_for_updates_on_startup")) {
public boolean hasChanged() {
return isSelected() != MuConfigurations.getPreferences().getVariable(MuPreference.CHECK_FOR_UPDATE, MuPreferences.DEFAULT_CHECK_FOR_UPDATE);
}
};
checkForUpdatesCheckBox.setSelected(MuConfigurations.getPreferences().getVariable(MuPreference.CHECK_FOR_UPDATE, MuPreferences.DEFAULT_CHECK_FOR_UPDATE));
northPanel.add(checkForUpdatesCheckBox);
// 'Show confirmation dialog on quit' option
quitConfirmationCheckBox = new PrefCheckBox(Translator.get("prefs_dialog.confirm_on_quit")) {
public boolean hasChanged() {
return isSelected() != MuConfigurations.getPreferences().getVariable(MuPreference.CONFIRM_ON_QUIT, MuPreferences.DEFAULT_CONFIRM_ON_QUIT);
}
};
quitConfirmationCheckBox.setSelected(MuConfigurations.getPreferences().getVariable(MuPreference.CONFIRM_ON_QUIT, MuPreferences.DEFAULT_CONFIRM_ON_QUIT));
northPanel.add(quitConfirmationCheckBox);
// 'Enable system notifications' option, displayed only if current platform supports system notifications
if(AbstractNotifier.isAvailable()) {
systemNotificationsCheckBox = new PrefCheckBox(Translator.get("prefs_dialog.enable_system_notifications")+" ("+AbstractNotifier.getNotifier().getPrettyName()+")") {
public boolean hasChanged() {
return isSelected() != MuConfigurations.getPreferences().getVariable(MuPreference.ENABLE_SYSTEM_NOTIFICATIONS,
MuPreferences.DEFAULT_ENABLE_SYSTEM_NOTIFICATIONS);
}
};
systemNotificationsCheckBox.setSelected(MuConfigurations.getPreferences().getVariable(MuPreference.ENABLE_SYSTEM_NOTIFICATIONS,
MuPreferences.DEFAULT_ENABLE_SYSTEM_NOTIFICATIONS));
northPanel.add(systemNotificationsCheckBox);
}
// 'Enable Bonjour services discovery' option
bonjourDiscoveryCheckBox = new PrefCheckBox(Translator.get("prefs_dialog.enable_bonjour_discovery")) {
public boolean hasChanged() {
return isSelected() != MuConfigurations.getPreferences().getVariable(MuPreference.ENABLE_BONJOUR_DISCOVERY,
MuPreferences.DEFAULT_ENABLE_BONJOUR_DISCOVERY);
}
};
bonjourDiscoveryCheckBox.setSelected(MuConfigurations.getPreferences().getVariable(MuPreference.ENABLE_BONJOUR_DISCOVERY,
MuPreferences.DEFAULT_ENABLE_BONJOUR_DISCOVERY));
northPanel.add(bonjourDiscoveryCheckBox);
add(northPanel, BorderLayout.NORTH);
customShellField.addDialogListener(parent);
useCustomShellRadioButton.addDialogListener(parent);