473,320 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Listener and events

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
0 1165

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: - ions | last post by:
Hello, i am relatively new to programming, Java being the first language im learning. At the moment im having trouble changing the setEnable value of a button, relative to the state of a JTextArea,...
1
by: Cherrish Vaidiyan | last post by:
sir, I have a small error in Listener configuration.I have two system with a database in each. I am using Red Hat 9 and Oracle 9i. so i shall anme the database and system. system 1 - node2 ...
3
by: Bill | last post by:
When vb6 Winsock.RemoteHost is set to "127.0.0.1", c# socket listener cannot hear connect request (my old vb6 winsock listener could hear it...). Why doesn't this work, and is there a work...
4
by: VK | last post by:
Anyone who's interested. I implemented my own way to always get the right registered event listener in case of nested elements *without* using intrinsic handlers (so say you want to keep your...
6
by: Steve Teeples | last post by:
I have been perplexed by how to best treat an event that spans different classes. For example, I have a form which a user inputs data. I want to broadcast that data via an event to another...
6
by: Jeremy | last post by:
I want each instance of an object to be able to listen for input events. When the event occurs, a method of the object should be called, such that "this" is in scope and refers to the object...
1
by: elrondrules | last post by:
Hi Am new to python and I am trying to do the following: 1. Write a Http Listener (listening on a particular port) that subscribes to a process. 2. This process posts events as xml docs. 3....
4
by: jackwootton | last post by:
Hello, Currently I use setInterval to call a function every 1.5 seconds. The function checks the content of 6 divs on a page. The content of each div is retrieved use innerHTML. If the...
10
by: eedarley | last post by:
Is there a way to force the consumer of my object to handle events that I've fired off? I don't care how they handle the event, just that they do. I think in c# there is a way but not sure about...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.