JComboBox fails to expand in JTable TableHeader

前端 未结 2 1263
旧巷少年郎
旧巷少年郎 2021-01-13 07:22

I have read through the majority of the JTable/JComboBox responses to other questions of this ilk, but haven\'t yet found a solution to my problem.

I have created a

相关标签:
2条回答
  • 2021-01-13 08:03

    Here is an example that uses a JComboBox in a JTable TableHeader.

    For other types of components is easier, have a look here.

    enter image description here

    0 讨论(0)
  • This actually works exactly as expected. I think the clue is TableCellRenderer.

    Renderer's are typically non-interactive components. They are usually just a "snap-shot" of the component painted on to a surface and there is typically no way for a user to interact with them.

    This is the expected behavior.

    In order to supply editable functionality to the table header, you're going to need to supply your implementation of a JTableHeader

    Have a look at this example for some ideas

    0 讨论(0)
提交回复
热议问题