呵呵,LZ这是官方文档:http://java.sun.com/docs/books/tutorial/uiswing/components/table.html PS:自己动手,百度吧。谷歌吧分多你就散吧,我是专业消灭零回复String[][] BookInfo = { {"JAVA","james","one"}, {"SQL","jacky","two"} }; String [] ColumnName = {"Col1","Col2","Col3"};DefaultTableModel dm = new DefaultTableModel(); dm.setDataVector(BookInfo,ColumnName);JTable table = new JTable( dm ); table.addKeyListener(new CTableKeyAdapter(table)); TableCellEditor tableCellEditor=table.getDefaultEditor(String.class); if (tableCellEditor!=null) { if (tableCellEditor instanceof DefaultCellEditor) { ((DefaultCellEditor)tableCellEditor).setClickCountToStart(2); } }
table.addKeyListener(new CTableKeyAdapter(table)); 这一行似乎编译 不过去啊····"tableCellEditor.java": cannot find symbol; symbol : class CTableKeyAdapter, location: class test.tableCellEditor at line 36, column 27
呵呵,LZ这是官方文档:http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
PS:自己动手,百度吧。谷歌吧分多你就散吧,我是专业消灭零回复String[][] BookInfo =
{
{"JAVA","james","one"},
{"SQL","jacky","two"}
};
String [] ColumnName = {"Col1","Col2","Col3"};DefaultTableModel dm = new DefaultTableModel();
dm.setDataVector(BookInfo,ColumnName);JTable table = new JTable( dm );
table.addKeyListener(new CTableKeyAdapter(table));
TableCellEditor tableCellEditor=table.getDefaultEditor(String.class);
if (tableCellEditor!=null) {
if (tableCellEditor instanceof DefaultCellEditor) {
((DefaultCellEditor)tableCellEditor).setClickCountToStart(2);
}
}
table.addKeyListener(new CTableKeyAdapter(table));
这一行似乎编译 不过去啊····"tableCellEditor.java": cannot find symbol; symbol : class CTableKeyAdapter, location: class test.tableCellEditor at line 36, column 27