JList as Jtable Render and editor

E

evgchech

Hello everyone
I am using Jlist as Table Render And Editor and run in to some strange
selection behavior.
Scenario:
Jtable has 1 row and 2 columns.
Cell (0,0) contains simple label as cell render
Cell (0,1) has JList as cell render and editor. Jlist has 3 items.

Column1 | Column2 |
----------------------------------------
| List Item1 |
Simple Lable| List Item2 |
| List Item3 |
----------------------------------------
1. Click on cell (0,0) -> cell (0,0) selected
2. Click on ListItem2 -> ListItem1 selected instead ( THE PROBLEM )
3. Click on ListItem2 once again -> now ListItem2 is selected

I noticed that if the JList is not in focus, does not meter on which
list item i will click it will always select the first one.I have
registered to value changed event of Jlist and also noised that it is
being called twice during the first selection.Once from table mouse
event and once from Jlist mouse event.( Jtable mouse event propagates
the event to the render).As long as JList is in focus the list item
selection works just fine.

Please help me to solve bullet 2
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top