简体   繁体   English

如何在ChartPanel上绘制图形?

[英]How do I draw graphics on top a ChartPanel?

I have a ChartPanel object displaying some information, but I would like to be able to use a MouseListener interface to draw on top of it. 我有一个ChartPanel对象显示一些信息,但我希望能够使用MouseListener接口在其上绘制。 I'd imagine I would just have to call some sort of "repaint()" method at the end of the interface methods and perform some override, but after spending considerable time researching I haven't a clue how to go about doing this. 我想我只需要在接口方法的末尾调用某种“repaint()”方法并执行一些覆盖,但是在花了相当多的时间研究之后,我不知道如何去做这个。 Is this even possible? 这甚至可能吗? Any insight or advice? 任何见解或建议?

You can create a class that implements the Overlay interface and then add it to the ChartPanel using the addOverlay(Overlay) method. 您可以创建一个实现Overlay接口的类,然后使用addOverlay(Overlay)方法将其添加到ChartPanel。 Everything that the overlay draws will be drawn after (so on top of) the chart. 叠加绘制的所有内容都将在图表之后绘制(因此在顶部)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM