private boolean addBrand() throws ClassNotFoundException, SQLException { String brandId = brandIdTextField.getText(); String brand = brandTextField.getText(); if (brand.isEmpty()) { JOptionPane.showMessageDialog(this, "Brand type can't be empty"); isBrandEmpty = true; // isBrandEmpty->true when brandTextField is empty return false; } else { isBrandEmpty = false; // //isBrandEmpty->false when brandTextField is not empty } return BrandController.addBrandCategory(new Brand(brandId, brand)); }