// Time format
YBoxPanel timeFormatPanel = new YBoxPanel();
timeFormatPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("prefs_dialog.time")));
time12RadioButton = new PrefRadioButton(Translator.get("prefs_dialog.time_12_hour")) {
public boolean hasChanged() {
String timeFormat = MuConfigurations.getPreferences().getVariable(MuPreference.TIME_FORMAT);
return isSelected() != (timeFormat.equals(HOUR_12_TIME_FORMAT) || timeFormat.equals(HOUR_12_TIME_FORMAT_WITH_SECONDS));
}
};
time12RadioButton.addActionListener(this);
PrefRadioButton time24RadioButton = new PrefRadioButton(Translator.get("prefs_dialog.time_24_hour")) {
public boolean hasChanged() {
String timeFormat = MuConfigurations.getPreferences().getVariable(MuPreference.TIME_FORMAT);
return isSelected() != (timeFormat.equals(HOUR_24_TIME_FORMAT) || timeFormat.equals(HOUR_24_TIME_FORMAT_WITH_SECONDS));
}
};
time24RadioButton.addActionListener(this);
String timeFormat = MuConfigurations.getPreferences().getVariable(MuPreference.TIME_FORMAT);
if(timeFormat.equals(HOUR_12_TIME_FORMAT) || timeFormat.equals(HOUR_12_TIME_FORMAT_WITH_SECONDS))
time12RadioButton.setSelected(true);
else
time24RadioButton.setSelected(true);
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(time12RadioButton);
buttonGroup.add(time24RadioButton);
timeFormatPanel.add(time12RadioButton);
timeFormatPanel.add(time24RadioButton);
timeFormatPanel.addSpace(10);
showSecondsCheckBox = new PrefCheckBox(Translator.get("prefs_dialog.show_seconds")) {
public boolean hasChanged() {
return isSelected() != (MuConfigurations.getPreferences().getVariable(MuPreference.TIME_FORMAT).indexOf(":ss")!=-1);
}
};
showSecondsCheckBox.setSelected(timeFormat.indexOf(":ss")!=-1);
showSecondsCheckBox.addItemListener(this);
timeFormatPanel.add(showSecondsCheckBox);
timeFormatPanel.addSpace(10);
gridPanel.add(timeFormatPanel);
dateTimeFormatPanel.add(gridPanel);
// Date/time preview
tempPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
tempPanel.add(new JLabel(Translator.get("example")+": "));
previewLabel = new JLabel();
Calendar calendar = Calendar.getInstance();
calendar.set(calendar.get(Calendar.YEAR)-1, 11, 31, 23, 59);
exampleDate = calendar.getTime();
updatePreviewLabel();
tempPanel.add(previewLabel);
dateTimeFormatPanel.add(tempPanel);
mainPanel.add(dateTimeFormatPanel);
add(mainPanel, BorderLayout.NORTH);
languageComboBox.addDialogListener(parent);
time12RadioButton.addDialogListener(parent);
time24RadioButton.addDialogListener(parent);
dateFormatComboBox.addDialogListener(parent);
dateSeparatorField.addDialogListener(parent);
showSecondsCheckBox.addDialogListener(parent);
showCenturyCheckBox.addDialogListener(parent);
}