List<ValidationInfo> () { List<ValidationInfo> result = new ArrayList<>(); if (myPanel.field1.getText().isEmpty()) result.add(ERRORS[0]); if (!Pattern.compile("[0-9]{5}").matcher(myPanel.field2.getText()).matches()) result.add(ERRORS[1]); if (myPanel.field3.getSelectedItem() == null || "".equals(myPanel.field3.getSelectedItem())) result.add(ERRORS[2]); if (!myPanel.field4A.isSelected() && !myPanel.field4B.isSelected()) result.add(ERRORS[3]); if (!myPanel.field5.isSelected()) result.add(ERRORS[4]); if (myPanel.comboBox.getSelectedItem() == null || "".equals(myPanel.comboBox.getSelectedItem()) || myPanel.comboBox.getEditor().getItem() == null) result.add(ERRORS[5]); Object value = myPanel.spinner.getValue(); try { int iv = Integer.parseInt(String.valueOf(value)); if (value == null || iv < 20 || iv > 30) result.add(ERRORS[6]); } catch (NumberFormatException nfe) { result.add(ERRORS[6]); } return result; }