Skip to main content

LWUIT Table

5 replies [Last post]
dark_light_555
Offline
Joined: 2010-03-31

Hello,

I'm creating a mobile application based on LWUIT. One of the forms contains a Table component. My question is how can I make the table rows selectable? What I want to achieve and enabling the user to select the table rows individually and the application should be able to detect which row was selected.

Regards.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
badboy70
Offline
Joined: 2012-10-23

dark_light_555 wrote:
Hello,

I'm creating a mobile application based on LWUIT. One of the forms contains a Table component. My question is how can I make the table rows selectable? What I want to achieve and enabling the user to select the table rows individually and the application should be able to detect which row was selected.

Regards.

badboy70
Offline
Joined: 2012-10-23

badboy70 wrote:
dark_light_555 wrote:
Hello,

I'm creating a mobile application based on LWUIT. One of the forms contains a Table component. My question is how can I make the table rows selectable? What I want to achieve and enabling the user to select the table rows individually and the application should be able to detect which row was selected.what I want change Background column select.

dark_light_555
Offline
Joined: 2010-03-31

Thank you for your reply. Your idea makes sense, but can you please give me some guidelines as to how I can create a column of Checboxes and how I can change the style according to the user selection.

vprise
Offline
Joined: 2003-11-07

In the model for the table just use Boolean objects which will automatically create checkboxes.

If you want to change the style you can override the tables createCell method and bind a listener to every check box item returned. When the checkbox is activated you can just change the style for the other components in the row. Finding the other components in the row is slightly trickier you can loop over the entire table (getComponentCount,getComponentAt) and ask getCellRow() for every component.

vprise
Offline
Joined: 2003-11-07

I suggest adding a column of checkboxes to enable row selection. You can even change the bgColor/style of the components in the row to indicate selection based on that.