我已经编写了这个监听器:
playlistTable.addMouseListener(new MouseAdapter() {
private boolean ignoreDoubleClicks = false;
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2 && !ignoreDoubleClicks) {
this.ignoreDoubleClicks = true;
System.out.println(ignoreDoubleClicks);
JTable target = (JTable)e.getSource();
int row = target.getSelectedRow();
videoTableModel = new VideoTableModel(playlistService.getMoviesOfPlaylist(row));
target.setModel(videoTableModel);
//TODO enables the table
//movieTable.setEnabled(false);
createPlaylist.setEnabled(false);
setButtonIcon("icons\\playlist_grau.png", createPlaylist, "createPlaylist");
removePlaylist.setEnabled(false);
setButtonIcon("icons\\bin_grau.png", removePlaylist, "removePlaylist");
algoButton.setEnabled(false);
setButtonIcon("icons\\glyphicons_137_cogwheels_grau.png", algoButton, "algoButton");
// playlistTable.setEnabled(false);
revalidate();
}
}
});
但是,当我第一次双击播放列表时,我会看到电影。当我用另一个按钮返回并再次双击播放列表表时,它不再是可点击的。为什么?
更新
问题是 this.ignoreDoubleClicks = true;
但是,为什么它没有设置为false?