我有一个问题,无法使用代码中的以下两种方法专注于文本字段。
public void tableChanged(TableModelEvent e) {
if (e.getType() == TableModelEvent.UPDATE) {
int column = e.getColumn();
if (column == 2 ) {
pricetext.setText(Integer.toString(calculatesum()));
}
}
textsearch.grabFocus();
// textsearch.requestFocus();
}
);
当我执行方法(grabFocus()或requestFocus())时,光标设置在搜索文本字段上,但随后又丢失并设置到表的单元格中。 谢谢