1. 程式人生 > >JTableHeader新增全選, 反選checkbox

JTableHeader新增全選, 反選checkbox

{
            
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) {
            }

        }