else if(e.getSource()==btnSelect){//전체 선택/해제 버튼 이벤트
     System.out.println("?????");
     int checkedCount = 0; 
     boolean[] flags = new boolean[tableL.getRowCount()];
                for (int i = 0; i < tableL.getRowCount(); i++) {
                    flags[i] = ((Boolean) tableL.getValueAt(i, 0)).booleanValue(); 
         
                        checkedCount++;
                        if(checkedCount== tableL.getRowCount()){
                    bool.setSelected(true);  
                }
                         if(checkedCount!= tableL.getRowCount()){
                   bool.setSelected(false);    
                }    } 
    }

table에 있는 체크박스들을  버튼으로 전체 선택하려고합니다. c#,자바스크립트로 된 많은 예제들을 보고 일단 해봤는데 안되네요. 자바스크립트는 참간단하게 되던데;

조언좀 부탁드려도 될까요?