Hello All, I am thinking about what is the appropriate way to provide GUI to user for searching. I see two possibilities: 1. with JComboBox 2. with JTextField Both of them have positive and negative sides. With ComboBox user cannot enter the bad data, it simplifies the search. But the choice of the correct item will be complicated by having too many items in the database. Accordingly to the assignment the database file will be used also by another program. And if a new record will be added from another program to the database the combobox will not have the actual data. With TextField we will have always the search of the actual data. But user can enter the bad data and this complicates the search. My favorit is the second one TextField. But I am not sure.
How do you think what is the best way? ComboBor or TextFields? Could you help me to choose the correct way? Thanks a lot! Olena
I would go with the JTextField. By the way, what do you mean by "bad data"? If the user enters some jibberish (e.g. "&^&%^&aaevadf^%^%"), well just search for that and if there's nothing in the database that matches that just display a message (e.g. "Nothing found.").
posted 13 years ago
Hello Jeroen, Cleverson, David and Yevgeniy , thanks a lot for your comments!
Cleverson, It's a gread idea, but SUN will not grade my application with additonal points if i implement both. But I like your idea! Thanks again.
Dave, I read a lot of topics where i found that some ppl use ComboBox and TextField. Therefor I ask this question. But I think also that both are correct.
Yevgeniy, I just make one example. And this example was stuppid With this i meant for example that the user will tipp the names with aphostrophe or special characters or another encoding, that cann cause the problem if this special case will not be handled in code. For example if the user enters some data with the special character and the client will sent this to server-side in xml-form (Don't worry I will not implement XML-staff, it's just example . And the Server uses one parser to receive the information from xml. And if the parser will found some special character it will throw some exception. Olena