I have the following question: I want my JTable to be able to edit large text in some of the cells, so that when user clicks on a cell it should expand (like JComboBox expands), and alow the user to edit text in this larger window (JTextArea). If anybody have any ideas, please let me know. I really apreciate any help. Thanks.
Rajan: I am using TableCellRenderer and also TableCellEditor. The problem is that when I am editing the cell with JTextArea, is shown completely in the cell rectangle. I want this JTextArea to be larger than other cells. In the case of JComboBox it works fine, it is shown over other cells when you edit it. What do you think the problem here? Thanks for you respond.
See, I don't want to reseize whole row, I want to make this JTextArea to be visible over other cells,when the user edits it. Like people do with JComboBox - it overlapps other cells. Or JPopup menu, it is a pop-up window. So, now I need to figure out how to make JTextArea a pop-up type of windo. Do know how can I do it? Thanks for your help.
One of the parameters in the get table cell renderer component is the flag isSelected. You can check for this flag, and if it is selected you can change the way the component looks. That is you can change its size, font, background and so on...
Sayuri: Yes, I check for isSelected. But the end, any changes I've made will disappear, because JTable puts my JTextArea in the cell area, so it is still in the cell rectangle, and it doesn't look like JTextArea. Could you please advise me something in this case? Thanks. Ilya.
If you want the cell to expand only when editing, you could use your own table cell editor (more or less the same concept as the cell renderer) But if you want the cell to always have the same "look", then you will need to change the row height of the table, and make the appropriate changes in your renderer to always have the same preferred size... Sayuri
Originally posted by illya figotin: Sayuri: Yes, I check for isSelected. But the end, any changes I've made will disappear, because JTable puts my JTextArea in the cell area, so it is still in the cell rectangle, and it doesn't look like JTextArea. Could you please advise me something in this case? Thanks. Ilya.
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
a bit of art, as a gift, the permaculture playing cards