JTable rendering JPanel

前端 未结 2 800
无人及你
无人及你 2021-01-21 11:32

I have a one column JTable to which I set a custom TableCellRenderer that return a custom JPanel in its getTableCellRendererComponen

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-21 12:24

    Why do you need your cell selection in your editor ?

    isent it enough that you know row and column you are currently editing ?

    if yes then just set them where you set your editor value

    @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
            renderer.setComp((Comp) value, row, column );
            return renderer;
        }
    

提交回复
热议问题