I'm making a cash register.
I would like to set the text of the label (cost) when the text in the textfield (receipt) is "chocolate".
private void dodaj_produktActionPerformed(java.awt.event.ActionEvent evt)
{
product_name.getText();
String str = product_name.getText();
receipt.setText(str);
String chocolate="chocolate";
if(str == chocolate){
Double cena=3.50;
String cena_tabliczka = Double.toString(cena);
cost.setText(cena_tabliczka);
}
}