aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes need help in searchin Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "need help in searchin" Watch "need help in searchin" New topic
Author

need help in searchin

Abhi Chat
Ranch Hand

Joined: Oct 10, 2004
Posts: 57
I am new to saerchin and was wondering what could i do to get familiar with it...in scjd what is it expected...normal checkin of databases or using regular expressions to get results......

please advice


SCJP 1.4<br />Preparing for <br />SCJD and SCWCD
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Well you could use regular expressions, if you are just using JTextFields in your search lookup. However, you will want to use JComboBoxes instead. Actually, that is kind of wrong, in that you can still use regular expressions , but in most cases the values in the JComboBox will be all the full values possible, and so you wouldn't need the regular expressions since you will have the whole string anyway.



Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Abhi Chat
Ranch Hand

Joined: Oct 10, 2004
Posts: 57
Thanx Mark...

Would you able to provide me an example code snippet of a regular expression which can do searchin from textfields

Assuming the file is:

ID NAME LOCATION PRICE DATEOF ISSUe

now if i type in a name = "Fre"....i want all the names and their correspondin values begining with "FRE"

or suppose location = " LA"... or vice versa...
Jared Chapman
Ranch Hand

Joined: Feb 23, 2004
Posts: 81
Hi,

Look at the Pattern class in the Java 1.4 API.

To find out if String myString begins with "Fre", you could do:


B.S. University of Wisconsin<br />SCJP 1.4 (85%)<br />SCJD 1.4 (92%) B&S Contractors
Jared Chapman
Ranch Hand

Joined: Feb 23, 2004
Posts: 81
Mark,

As of now I am using JTextFields. Just wondering what your reasoning is for using JComboBoxes is instead. I know they are a lot more convenient for the user, but as far as this assignment is concerned, aren't JTextFields good enough?
Jared Chapman
Ranch Hand

Joined: Feb 23, 2004
Posts: 81
Oh, and I almost forgot - congrats on #6000, Mark!
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Well, actually I feel it is much easier to code that way. I believe that there are points regarding GUI and user interface, and providing a nice GUI for the operators that make it easier to use would get more points.

Abhi, actually AI don't use regular expressions, and never memorized the patterns for them and the two classes and methods that are used to run a regular expression on a String. Sorry.

Mark
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: need help in searchin