Results 1 to 3 of 3
Thread: Adding a search bar
- 12-03-2011, 05:45 PM #1
Member
- Join Date
- Nov 2011
- Posts
- 2
- Rep Power
- 0
Adding a search bar
Hello guys,
So i have a java swing list in a j panel, this list contains a list of people with their names,
on the top of that list i created a search bar, now i want the program once run, to search for me in the list of that people according to the name inserted in the search bar i created,
my question is, as i am a very very beginner in java and netbeans, what is the source code i put for this specific bar in order to make it a search bar, thank you in advance
-
Re: Adding a search bar
If you wish to search with the press of a JButton, then in the button's ActionListener have code that gets the JList's model (via getModel()), then use a for loop to iterate through the model getting each item with the model's getElementAt(int index) method, and checking if the element is a String that matches the one in your search bar's JTextField.
You'll need to go through the Swing tutorials to find out how to code all of these things but with effort you will succeed.
- 12-03-2011, 08:42 PM #3
Re: Adding a search bar
Starting a new thread instead of replying to a response on an earlier thread isn't the best way to continue to get help on a forum.
How to ad a search function
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Any advice - java search algorithms which accept multiple search parameters
By Alfster in forum New To JavaReplies: 4Last Post: 03-24-2011, 11:50 PM -
Binary search tree search method
By chopo1980 in forum New To JavaReplies: 2Last Post: 12-10-2009, 01:42 AM -
Not able to highlight the search key work in wild card search
By annappa in forum LuceneReplies: 0Last Post: 10-29-2009, 09:28 AM -
Code for adding search function in an application
By Avdhut in forum Threads and SynchronizationReplies: 5Last Post: 03-03-2009, 10:15 AM -
make search function ike eclipse search in window->preference
By i4ba1 in forum Advanced JavaReplies: 5Last Post: 08-26-2008, 03:43 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks