use of com.alibaba.druid.support.jconsole.model.RowHeaderTable in project druid by alibaba.
the class DruidSQLPanel method tableDataProcess.
@Override
protected void tableDataProcess(ArrayList<LinkedHashMap<String, Object>> data) {
table = new JTable() {
private static final long serialVersionUID = 1L;
@Override
protected JTableHeader createDefaultTableHeader() {
return new GroupableTableHeader(columnModel);
}
};
data = preProcess(data);
// System.out.println(SHOW_LIST);
tableModel = new DruidTableModel(data, REAL_SHOW_LIST);
// System.out.println(data.toString());
table.setModel(tableModel);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
addTableGroup();
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
// 点击几次,这里是双击事件
int row = table.getSelectedRow();
String id = ids.get(row);
new DruidSqlDetailFrame(id, conn);
}
}
});
RowHeaderTable header = new RowHeaderTable(table, 20);
scrollPane.setRowHeaderView(header);
scrollPane.setViewportView(table);
JLabel jb = new JLabel("N", SwingConstants.CENTER);
jb.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
scrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, jb);
}
Aggregations