I am using JFrame for my program Photo of program. When you enter value of a quantity in the text field and selects another item from the Jlist, the value stays and doesn't empty the text field. So what i want to happen is emptying the text field when I am about to choose another item from the list.
Here is the code for that portion:
if (selected == "SBCA Jacket"){
photo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jacket.jpg")));
double p = 700;
String price = Double.toString(p);
priceField.setText(price);
int s = 500;
String stock = Integer.toString(s);
stockField.setText(stock);
int qty = Integer.parseInt(qtyField.getText());
int rstock = s - qty;
rstockField.setText(Integer.toString(rstock));
double total = p * qty;
totalField.setText(Double.toString(total));
}else if (selected == "SBCA T-shirt"){
...