how-to-adjust-rowHeights への回答ではありませんが、私のコメントで言及されている代替案については、完全な rowHeight を更新する代わりに、editorComponent を「オーバーサイズ」するだけです (これはユーザーにとって刺激的すぎると思いますが、決定するのはあなた次第です)。 、 もちろん :)
// fake a bigger editing component
JTextField oversized = new JTextField() {
@Override
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.height *= 5;
return dim;
}
};
TableCellEditor editor = new DefaultCellEditor(oversized);
JTable table = new JTable(new AncientSwingTeam()) {
@Override
public boolean editCellAt(int row, int column, EventObject e) {
boolean result = super.editCellAt(row, column, e);
if (result) {
// adjust cell bounds of the editing component
Rectangle bounds = getEditorComponent().getBounds();
bounds.height = getEditorComponent().getPreferredSize().height;
getEditorComponent().setBounds(bounds);
}
return result;
}
@Override
public void removeEditor() {
int editingColumn = getEditingColumn();
super.removeEditor();
if (editingColumn >= 0) {
// cleanup
repaint();
}
}
};
table.getColumnModel().getColumn(0).setCellEditor(editor);