右键单击JFreeChart [英] Right-clicking on a JFreeChart
问题描述
在我看来,仅当用户在图表上单击鼠标左键时,才会调用chartMouseClicked
方法.当用户右键单击图表并显示弹出菜单时,该怎么称呼?当用户在显示弹出菜单之前右键单击时,我想在后台执行某些操作.谢谢!
It seems to me that the chartMouseClicked
method gets called only when the user left-clicks on a chart. What's being called when the user right-clicks on a chart and the popup menu is displayed? I want to do something in the background when the user right-clicks before the popup menu is displayed. Thanks!
推荐答案
ChartPanel
实现MouseListener
以显示上下文菜单.为了适应不同的平台,它会在两者 mousePressed()
和 mouseReleased()
.您可能需要覆盖这两种方法.
ChartPanel
implements MouseListener
to display the context menu. To accommodate disparate platforms, it checks isPopupTrigger()
in both mousePressed()
and mouseReleased()
. You may need to override both methods.
这篇关于右键单击JFreeChart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!