I am trying to show the list of words which start with the letter specified by the user input.
So for example if I add three words to my list, cat, corn and dog, and the user inputs the letter c, the output on the Java applet should be cat, corn.
However, I have no idea on how to go about this.
public void actionPerformed(ActionEvent e){
if (e.getSource() == b1 ){
x = textf.getText();
wordList.add(x);
textf.setText(null);
}
if (e.getSource() == b2 ){
}
}
b1
is adding all the user input into a secretly stored list, and I now want to make another button when pressed to show the words that start with the specified letter by the user.
textf = my text field
wordList = my list I created
x = string I previously defined