/** Отображает данные о товаре по выбранному в списке идентификатору */ protected void showProductData() { try { // забираем значение, выбранное в списке // идентификаторов товаров Integer productId = (Integer) comboId.getSelectedItem(); if (productId != null) { // получаем товар по идентификатору Product product1 = new Product( productId, txtDescription.getText(), Float.parseFloat(txtRate.getText()), Integer.parseInt(txtQuantity.getText()), 5); List<Product> product = (List<Product>) client.showProductData(product1); // List<Product> product = productDAO.getProductById(productId); // заполняем текстовые поля значениями // параметров товара for (int i = 0; i < product.size(); i++) { txtId.setText(String.valueOf(product.get(i).getId())); txtDescription.setText(product.get(i).getDescription()); txtRate.setText(String.valueOf(product.get(i).getRate())); txtQuantity.setText(String.valueOf(product.get(i).getQuantity())); } } } catch (Exception e) { e.printStackTrace(); // JOptionPane.showMessageDialog(this, e.getMessage()); } }