void () { String inputString = myComboBox.getSelectedItem().toString().trim(); if (myValidator == null || myValidator.checkInput(inputString) && myValidator.canClose(inputString)) { super.doOKAction(); } }