}
int height = Integer.parseInt(getHeightREd().getText());
if (height < MIN_SIZE) {
throw new Exception("Height must be at least " + MIN_SIZE + " pixels");
}
ResolutionProfile profile;
if (editStatus == EditStatus.NEW) {
profile = new ResolutionProfile();
}
else {
profile = (ResolutionProfile) getProfileCmb().getSelectedItem();
}
profile.setWidth(width);
profile.setHeight(height);
profile.setDefaultProfile(getDefaultCBx().isSelected());
if (editStatus == EditStatus.NEW) {
refreshing = true;
try {
getProfileCmb().addItem(profile);
getProfileCmb().setSelectedItem(profile);
}
finally {
refreshing = false;
}
}
if (profile.isDefaultProfile()) {
for (int i = 0; i < getProfileCmb().getItemCount(); i++) {
ResolutionProfile lProfile = (ResolutionProfile) getProfileCmb().getItemAt(i);
if (lProfile != profile) {
lProfile.setDefaultProfile(false);
}
}
}
getProfileCmb().requestFocus();
editStatus = EditStatus.BROWSE;