TableListBoxModel and repaint


#1

Hello Guys,

I am using TableListBoxModel to display some data in a table format. Initially, I display only part of the data in the table and when the user selects “Display All” button it will display all the available data.

In the button listener function I change the number of rows to reflect all the data and call repaint. I understand that calling repaint does not update the component immediately. But I want the component to be updated as soon as the “Display All” is pressed. The component gets updated only if I resize the window, click on the table header, etc.,

I tried using Timer class and calling repaint in the call back function, which doesn’t make sense because I am calling repaint again in the call back function. :frowning:

Any help will be highly appreciated.

Thanks in advance,
Arjunen


#2

Guys,

I got it working by deleting the existing Table object and creating a new table object with the updated rows in the button listener. I am not sure if this is an efficient way of doing it. Still I would like to know any other way of updating the table cells.

Thanks,
Arjunen


#3

Maybe i’m missing something in what you are trying to do… but update your model and then call…

listbox->updateContent();
listbox->repaint();

[quote]/** Causes the list to refresh its content.

    Call this when the number of rows in the list changes, or if you want it
    to call refreshComponentForRow() on all the row components.[/quote]

#4

Justin,

This is what I was exactly looking for. ListBox->updateContent and repaint did the job. :slight_smile: Thanks a lot, Justin.

Thanks Again,
Arjunen