The first time I select an option from the list, the value is displayed on the jtextarea The second time I select an option, the value doesn't change. Is there a refresh option? Or a better approach for this problem? Thanks!
Here's a snippet of the code:
String[] choices = {"Apple","Orange", "Pear"};
String fruit= (String) JOptionPane.showInputDialog(null, "Select Fruit:","Select Fruit", JOptionPane.QUESTION_MESSAGE, null, choices, choices[0]);
if (fruit!= null){
jtextarea.append("Name\t: " + fruit.getName() + "\n");
jtextarea.append("Color\t: " + fruit.getColor() + "\n");
}