似乎 JTable 只能允许复选框。如何将无线电组放入 JTable 上的单元格中?
1 回答
your question is quite short, so i could have misinterpreted, but anyway A Boolean is by default registered with the jtable to be rendered/edited by a checkbox.
Depending on the cells'datatype the renderer/editor are retrieved when painting the cells. you could base a editor/renderer on a JPanel containing two radiobuttons which are grouped using a ButtonGroup. Depending on what data you want to store in the datamodel, you have various choices. if for example your datamodel contains ints, then your new editor/renderer should be able to work with that.