File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Another issue in a GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Another issue in a GUI" Watch "Another issue in a GUI" New topic

Another issue in a GUI

Marcelo Bordolli
Ranch Hand

Joined: Sep 03, 2012
Posts: 46

i have GUI whit a jtextfield that search for a match in text file that i got saved somewere. but the thing is that i just realize that search like this

this is my text file and ive marked what is seen by my search and what is not:
Alfredo Garcia 34353454 (Not seen)
Richard Blemen 23525342 (seen)
Mick Jagger 24523523 (Not seen)
Robert Pattinson 65434518 (seen)
Hayden Pannetiere 36486712 (not seen)
Alice Eve 97246590 (seen)
Hugo Beaven 28288282 and it keeps like this trough the hole file ,seen one and the next not seeing it
Beavis Acdc 54545445
Buthead Acdc 12121221
Mathias Oviedo 78787887
Marcos Viera 29292992
Wesker Almond 33333333
Trinity Gogo 22222222
Tia Carrera 44444444
Kristen Stweart 66666666
Charlize Theron 77777777
Denzel Washington 99999999
Angus Young 23312323
Malcom Young 23311332
Jhon Lennon 57575775
Jason Statam 83838383
Mario Bros 91291291
Luigi Bros 48297538
Amy Adams 98239832
Isla Fisher 20202020

this is my code wen i press search button:

I know is only java
Kemal Sokolovic

Joined: Jun 19, 2010
Posts: 825

What do you mean by "seen" and "not seen"? Those lines are never read at all? Did you try to run it through debugger and check you Tex variable in each iteration to be sure about that?

EDIT: Wow, my bad! You are invoking readLine twice in each iteration, that's why you get only every 2nd line. You should assign to Tex in your while loop, something we've already done yesterday in your code:

The quieter you are, the more you are able to hear.
Marcelo Bordolli
Ranch Hand

Joined: Sep 03, 2012
Posts: 46

Ok Kemal now i fix that problem whit your hint.
But now i know what was the thing whit the my text file wen i search it search for everything now the to the above, but wen i try to modify, it works perfectly to the lines the the code above use to show , but wen i try to modify the new names that now i can see thanks to the code above it change it but it also add the 0s and some time 3s or 7s many many of them. the issue must be in the search action button or in the modify action button. ill put both of them here:

I agree. Here's the link:
subject: Another issue in a GUI
It's not a secret anymore!