如何使用事件监听Java(JFreeChart)中的点击? [英] how to listen for clicks in Java (JFreeChart) using events?
本文介绍了如何使用事件监听Java(JFreeChart)中的点击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我目前正在使用的代码:
This is the code I'm currently using:
@Override
public void mouseExited(MouseEvent e) {
System.out.println("detectado");
}
推荐答案
你可以使用 addChartMouseListener()
添加 ChartMouseListener
到 ChartPanel
。例如,在 BarChartDemo1
,添加以下内容:
You can use addChartMouseListener()
to add a ChartMouseListener
to your ChartPanel
. For example, in BarChartDemo1
, add the following:
chartPanel.addChartMouseListener(new ChartMouseListener() {
public void chartMouseClicked(ChartMouseEvent e) {
System.out.println(e.getEntity());
}
public void chartMouseMoved(ChartMouseEvent e) {}
});
这篇关于如何使用事件监听Java(JFreeChart)中的点击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文