I need my program to set the text in the textField_price
to the price of the product, but all I get is error. It seems p.getPrice()
does not work but I have no idea how to fix it??? Have tried a bunch of ways... I understand it's the setText
that is wrong, since I'm dealing with a double not a String, but I have no clue what to do???
String productName = textField_productName.getText();
Product p = controller.findProduct(productName);
if (productName.isEmpty())
textArea_product.setText("Vänlig fyll i produktnamn.");
else if (p != null) {
textField_productName.setText(p.getProductName());
textField_kategory.setText(p.getKategory())
textField_price.setText(p.getPrice());
textArea_product.setText("Produkten " + p.getProductName().toUpperCase() + " hittad.");
} else {
textField_price.setText("---");
textField_kategory.setText("---");
textArea_product.setText("Produkten med produktnamnet " + productName + " hittas ej");
}
}