I am making a text based game in Java. I have a text field, enter button, and a label.
What code do i use to scan the text field once the button is clicked and respond?
So that if I type in (launch missile) the label should say (missile launched).
I will be listening to a button actionperformed
or maybe a mouseclick event . Something like this
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
if (Text field says: launch missile)
{print on label:Missile launched}
or
if (text field says: invade)
{Print on label: Invasion started}