Home > Back-end >  How to implement Java in the text box input name and then after the query output query results in a
How to implement Java in the text box input name and then after the query output query results in a

Time:09-19

Do is an address book page system, used to store your name and phone
 
Public void actionPerformed (an ActionEvent e) {
If (um participant etSource ()==b1) {
String name=a3. GetText ();
String tel=a.s earchByName (name);
System. The out. Println (tel);
A4. SetText (tel);


}

 
Public String searchByName (String name) {
for(int i=0; i{
If (name. Equals (STR) get (I)) getName ()))
{
Return the STR. Get (I). GetTelnumber ();
}
}
return null;
}

The problem is that the query name output number, whatever I input name, enter phone is null, ask tall person to give directions

CodePudding user response:

Db: no, you can choose on a file or memory variables

CodePudding user response:

This kind of things, your side, to know the reason, debugging a.s earchByName (name); Returns null, what is the name is not received, or there is no deposit in STR

CodePudding user response:

You said "enter name and then after a query... "Now that is a query, you want to go somewhere to check to the program guide, according to what condition, you don't want to save the database, can save the file, is also possible to save the entire collection of objects or background map data (temporary), and then to query the corresponding data save data,

CodePudding user response:

After debugging found STR deposited in the value of the later suddenly become empty, do not know what reason! ?

CodePudding user response:

/headache/headache/headache
  • Related