posted 15 years ago
Hi,
I would like to display(and allow edit) lines of data in a table which not looks like as a table but more likely looks like as if the cells were normal textfields, checkboxes, comboboxes. I can start from the ground and build a custom component which creates header and layout the components as if it were a table(but I use a hierarchical table which extends jtable so in that case I would have to implement some table hierarchy handling also). First I thought that's the slow/bad way but I'm not so sure at the moment. The other more obvious solution would be to use a table and modify it's behavior to achieve the result. I've spent several hours to achieve this but I still have problems what I wasn't able to solve.
I turned off horizontal and vertical lines and added intercell spacing so the components not look like as a table anymore. This was the easy part. I think I need the following things to achieve what I want:
1. Make a custom renderer for JTextField which uses a JTextField as a renderer, and displays the same border as the normal JTextField
2. Create a cell editor which uses JTextField and displays the same border as a normal cell editor(even if it is selected).
3. Select textfield's content on becoming selected
4. Automatically start editing a cell when become selected(mouse, keyboard)
5. Open combobox's dropdown with space and down arrow
I managed to do 1-3 but I wasn't able to solve 4 and 5. Can anybody help with that?
Thanks in advance.