This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Another issue in a GUI" Watch "Another issue in a GUI" New topic
Author

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
BUT I LIKE IT!!!
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

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 0s.in 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:

 
 
subject: Another issue in a GUI
 
Similar Threads
Problem reading a file
BufferedReader
Text Search on a file from a JSP page?????
issue in a gui
searching for a content in a file