JTableHeader新增全選, 反選checkbox
阿新 • • 發佈:2019-01-26
{
publicvoid mouseClicked(MouseEvent e) {
if (e.getClickCount() >0) {
int selectColumn = tableHeader.columnAtPoint(e.getPoint());
if (selectColumn == tableFirstColumn) {
boolean value =!selectBox.isSelected();
selectBox.setSelected(value);
tblModel.selectAll(value);
tableHeader.repaint();
}
}
}
publicvoid mouseEntered(MouseEvent e) {
}
publicvoid mouseExited(MouseEvent e) {
}
publicvoid mousePressed(MouseEvent e) {
}
publicvoid mouseReleased(MouseEvent e) {
}
}
publicvoid mouseClicked(MouseEvent e) {
if (e.getClickCount() >0) {
int selectColumn = tableHeader.columnAtPoint(e.getPoint());
if (selectColumn == tableFirstColumn) {
boolean value =!selectBox.isSelected();
tblModel.selectAll(value);
tableHeader.repaint();
}
}
}
publicvoid mouseEntered(MouseEvent e) {
}
publicvoid mouseExited(MouseEvent e)
}
publicvoid mousePressed(MouseEvent e) {
}
publicvoid mouseReleased(MouseEvent e) {
}
}