Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filling ComboBox with Loads of Data

Status
Not open for further replies.

kohinoor2007

Programmer
Mar 21, 2007
69
DE
Hi Guys,

I have a JCombobox which must be filled in with a large number of Data(May be millions of elements).

So It will take a lot of time to load the combobox.The data to load the combobox is got from the server.

So I have decided to implement the "Value List Handler" pattern which gives always a sublist of the whole list of data.

Following is a link of the "value list handler" pattern link.


It has methods for getting a sublist from the whole list.


So my real problem or what I need is as follows:


The JComboBox on loading will be initially populated ,with the values it gets from the "valueListIterator"(a subList).But the scrollbar should look in a way that the combobox is filled with the whole list.

When the user scrolls down or moves up the other sublists are got from the server(Using the Iterator) & the combobox must have to be filled in with this sublist.

So In short the combobox gets its values in pieces while scrolling up & down the list either using the scroll bar or using the up,down arrow keys.

For the end user, the behaviour of the combobox is as if the whole list of data is loaded into the comboBox.

Another thing is,When should be the new sublists loaded into the comboBox ,I mean which is the scrollBar level, when the newsublists should be loaded..

How Can I achieve the above behaviour in the JComboBox.Any help or tips in this direction is appreciated.


Thanks
K
 
I would suggest a proxy pattern.

Actually I would suggest a redesign. But it's up to you.

Christiaan Baes
Belgium

My Blog
"In a system where you can define a factor as part of a third factor, you need another layer to check the main layer in case the second layer is not the base unit." - jrbarnett
 
Iam committed to this pattern and I want my JComboBox to behave in the way,I have described.

Do you have any tips for that...A sample code could be really helpful...
 
By the way which listener should I add to the JComboBox component,If I have to listen to the
scrollBar events.

Thanks
 
I hope you have a 40 miles screen to display the Combo once it's filled ...

Cheers,
Dian
 
Dont,think so...When the combo drop down may contains n number of datas.But by setting the "SetMaximumRowCount"" the dropdown window length could be controlled.
 
Then you will need half an hour to scroll to what you're looking for, providing you know it's there. And I hop you have enough RAM to justify you're loading a bunch of data in the memory, not mentioning data transfer from wherever the data is coming from.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top