| | |
Automatic search.
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2008
Posts: 3
Reputation:
Solved Threads: 0
Hi. My problem i guess it is simple but i guess I'm simple as well
. The problem is the flowing: I have a JTextFead and a search method for IDs. The IDs are 7 char long. I want to be able when the user enters 7 chars the search method to be invoked. My first idea was a focus listener and a if statement if the chars are 7 then search, but that requires the txf to lose focus and on the regain then it searches. My other idea was to detect key events but niter is a good idea I guess =/.
. The problem is the flowing: I have a JTextFead and a search method for IDs. The IDs are 7 char long. I want to be able when the user enters 7 chars the search method to be invoked. My first idea was a focus listener and a if statement if the chars are 7 then search, but that requires the txf to lose focus and on the regain then it searches. My other idea was to detect key events but niter is a good idea I guess =/. •
•
•
•
Hi. My problem i guess it is simple but i guess I'm simple as well. The problem is the flowing: I have a JTextFead and a search method for IDs. The IDs are 7 char long. I want to be able when the user enters 7 chars the search method to be invoked. My first idea was a focus listener and a if statement if the chars are 7 then search, but that requires the txf to lose focus and on the regain then it searches. My other idea was to detect key events but niter is a good idea I guess =/.
Key event will work fine from my point of view.
On every key event you can check if the length of value in JTextField is equal to 7.
Example :
java Syntax (Toggle Plain Text)
if(jTextBoxObj.getText().length() == 7){ doSearch(); }
Regards,
Puneet Kalra
www.PuneetK.com
Sun Certified Java Programmer
Admin of Pikk - Object Relational Mapping Framework
www.PuneetK.com
Sun Certified Java Programmer
Admin of Pikk - Object Relational Mapping Framework
![]() |
Similar Threads
- Speed-up Mycomputer (Windows tips 'n' tweaks)
- I keep getting sent to various search engines (HJT Attached) (Viruses, Spyware and other Nasties)
- TNS Search (Viruses, Spyware and other Nasties)
- Office search Services (Windows Software)
- more "home search assistent" fun... (Viruses, Spyware and other Nasties)
- Sound Trouble (PCI and Add-In Cards)
- How do I delete links in IE search bar? (Web Browsers)
- Great search homepage (HIjack log inside) (Viruses, Spyware and other Nasties)
- where can i find a driver for a hitachi GD 2500 (Storage)
Other Threads in the Java Forum
- Previous Thread: jComboBox getSelectedIndex
- Next Thread: Update JTable from String[][]
| Thread Tools | Search this Thread |
2dgraphics android api apple applet application arguments array arrays automation banking binary binarytree bluetooth capture chat chatprogramusingobjects class classes client code color component count database derby design eclipse eclipsedevelopment encryption error event exception fractal game givemetehcodez graphics gridlayout gui html ide if_statement image input integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel julia keyword linux list loop macintosh map method methods midlethttpconnection mobile netbeans newbie object os print printing problem producer program programming project projectideas read recursion reference replaysolutions ria scanner screen server set size sms sort sourcelabs sql stop string swing threads transforms tree ui unicode validation windows





