By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,737 Members | 1,989 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,737 IT Pros & Developers. It's quick & easy.

Listener and events

P: n/a
Noe
Hello everybody,

I'm currently working on graphics application to draw charts. I have one
class Chart who extends JComponent and differents objects in Chart class
(sub_chart, tool_bar etc. who do not extend JComponent for optimization
reason).

My class chart listens for mouse event, and send these events to each of the
class it contains, depending the coordinate where the mouse is clicked,
dragged... that permits to the other classes to manage their events.

My implementation is :
class Chart extends JComponent implements Observer
with a inner class
private class MouseHandler extends MouseAdapter implements
MouseMotionListener
for mouse events.

then, I have :
class Plot implements PlotDraggedListener

When the Chart receive a MouseEvent inside the bounds of the Plot (by
calling plot.isInPlotBounds(e.getPoint())) the Chart sends a
PlotDraggedEvent to Plot who make a action.

Does it seems a good way to do that ?
Is there another solution ?

Thanks in advance for your responses.
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.