本文整理匯總了Java中javax.swing.JTable.getClientProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java JTable.getClientProperty方法的具體用法?Java JTable.getClientProperty怎麽用?Java JTable.getClientProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JTable
的用法示例。
在下文中一共展示了JTable.getClientProperty方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTableCellEditorComponent
import javax.swing.JTable; //導入方法依賴的package包/類
/**
* It sets the cursot at the beginnig of edited cell, in case of searching it highlights the found text.
* At the end it request for focus so the editor component (JTextField) has it, not the table.
* This is also a hack with reason to figure out which cell is going to be edited, if a key or a value.
*/
@Override
public Component getTableCellEditorComponent(JTable table,
Object value, boolean isSelected, int row, int column) {
// Key or value? Only in the first column are keys.
isKeyCell = (column == 0) ? true : false;
valueComponent.getDocument().removeDocumentListener(listener);
commentComponent.getDocument().removeDocumentListener(listener);
final JTextField textField = (JTextField)super.getTableCellEditorComponent(table, value, isSelected, row, column);
valueComponent.getDocument().addDocumentListener(listener);
commentComponent.getDocument().addDocumentListener(listener);
Caret caret = textField.getCaret();
caret.setVisible(true);
caret.setDot(0);
textField.setFont(settings.getFont());
// Check for search results.
// If search was performed, highlight the found string.
int[] result = (int[])table.getClientProperty(FindPerformer.TABLE_SEARCH_RESULT);
if(result != null && row == result[0] && column == result[1]) {
table.putClientProperty(FindPerformer.TABLE_SEARCH_RESULT, null); // removes property
caret.setDot(result[2]);
caret.moveDot(result[3]);
}
return textField;
}