Java search in text file with joptionpane? -
im new java. im quite lost here, im working on project should search in text file corresponding word, line line. got little someone, there´s errors gui in joptionpane.
this have until now. gui:
private void jmenuitemlookupactionperformed(java.awt.event.actionevent evt) { joptionpane.showoptiondialog(null, "title", "message", joptionpane.default_option, joptionpane.plain_message, null, options.toarray(new string[] {}), options.get(0)); }
and code search.
public string lookup(string question){ list<string> options = new arraylist<>(); (object value : data.values()) { if (value.tostring().startswith(question)) { options.add((string) value); } }
move list<string> options = new arraylist<>();
outside lookup
method , make class variable. compiler cannot find options object.
Comments
Post a Comment