Skip to main content

FocusListener on header in JTable

No replies
douglasalipio
Offline
Joined: 2012-11-08
Points: 0

This does not work. How do I run this event?

public void mouseClicked(MouseEvent evt) {

table = ((JTableHeader) evt.getSource()).getTable();

table.getTableHeader.addFocusListener(new FocusListener() {
            @Override
            public void focusGained(FocusEvent e) {
                System.out.println("focus");
            }

            @Override
            public void focusLost(FocusEvent e) {
     
                System.out.println("lost");
            }
});
}