• Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing search  RSS feed

 
Rayt Leeop
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all,
I want to build a search function that can search the following name:

AAA, 1,2,3
BBB,1,3,4
.........

AAA/BBB...is in text file. I need to search AAA from the text file so that the data related to AAA can be showed. I did the following


Can anyone hlpe me how to implement search function. The above just shows the frame. Many thanks.
 
Kristjan Toots
Ranch Hand
Posts: 59
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello mate,
You really should put your code between the code tags. It will make reading much more easier.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kristjan is right. In future, while posting code, please UseCodeTags I have edited your post this time. As you can see, the tags make the code much more readable and easy to understand.

Regarding your problem.
You will need to read the contents of the file. Based on what you posted, each line starts with the name.
In pseudo code
1) Open the file and start reading line by line
2) If the read line starts with the name you want (you will have to handle the case conversions for the user input name), parse the line and process the data.
3) Close the file handle.

Check out BufferedReader API docs.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!