更新时间:2023-12-03 11:30:34
请勿为此创建新类.只需更改DefaultCellEditor的属性即可:
Don't create a new class for this. Just change the property of the DefaultCellEditor:
JTextField textField = new JTextField();
textField.setFont(new Font("Verdana", 1, 12));
textField.setBorder(new LineBorder(Color.BLACK));
DefaultCellEditor dce = new DefaultCellEditor( textField );
myTable.getColumnModel().getColumn(1).setCellEditor(dce);