File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes sorting and filtering in jcombobox binded with database in netbeans 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 » Beginning Java
Bookmark "sorting and filtering in jcombobox binded with database in netbeans" Watch "sorting and filtering in jcombobox binded with database in netbeans" New topic
Author

sorting and filtering in jcombobox binded with database in netbeans

Neha Kaushik
Greenhorn

Joined: Apr 03, 2013
Posts: 29
hello...
i hava a problem in sorting and filtering in jcombobox binded with database in netbeans . i have done binding of this jcombobox with database table using netbeans.
that jcombobox contains department names in it. now i want to show this jcombobox data sorted in ascending order.
i also want autosuggestion in it.
for eg
Press "T" -> It will drop-down display everything beginning with "T"

Press "i" -> It will drop-down display everything that begins with "Ti"

Press "m" -> It will drop down display everything that has "Tim" at the beginning.

here is my code which i tried...

private void sort(){
ComboBoxModel Lmodel = comboDeprtmnt.getModel();
List list = new ArrayList<>();

for(int i= 0 ; i <comboDeprtmnt.getItemCount() ; i++)
{
String obj = (Lmodel.getElementAt(i).toString());
char[] arr = obj.toCharArray();
list.add(obj);
Arrays.sort(arr);
System.out.println(list);

Arrays.binarySearch(arr, c);
}

}

i get the character as...
char c;
private void comboDeprtmntKeyReleased(java.awt.event.KeyEvent evt) {
c= evt.getKeyChar();

}



please help i am new in java ...
any help will be appreciated.....
 
jQuery in Action, 2nd edition
 
subject: sorting and filtering in jcombobox binded with database in netbeans
 
Similar Threads
JComboBox that reduces list with typing
JComboBox
problem in simple bubble sort logic..
Urgent need Help Sorting Collections
JComboBox and keypress