public boolean hasChanged() {
return !getText().equals(MuConfigurations.getPreferences().getVariable(MuPreference.DATE_SEPARATOR));
}
};
// Limit the number of characters in the text field to 1 and enforces only non-alphanumerical characters
PlainDocument doc = new PlainDocument() {
@Override
public void insertString(int param, String str, javax.swing.text.AttributeSet attributeSet) throws javax.swing.text.BadLocationException {
// Limit field to 1 character max
if (str != null && this.getLength() + str.length() > 1)
return;
// Reject letters and digits, as they don't make much sense,
// plus letters would be misinterpreted by SimpleDateFormat
if (str != null) {
int len = str.length();
for(int i=0; i<len; i++)
if(Character.isLetterOrDigit(str.charAt(i)))
return;
}
super.insertString(param, str, attributeSet);
}
};
dateSeparatorField.setDocument(doc);
dateSeparatorField.setText(separator);
doc.addDocumentListener(this);
tempPanel.add(dateSeparatorField);
tempPanel.add(Box.createHorizontalGlue());
dateFormatPanel.add(tempPanel);
showCenturyCheckBox = new PrefCheckBox(Translator.get("prefs_dialog.show_century")) {