Hi Everyone
I am working with an OSGI device that uses AWT as the GUI API. I've used it extensively but I have run across something that I can't figure out.
I have a component that I add a mouse listener to. I create an inner class that extends off of MouseAdapter to handle the events. In the mousePressed(MouseEvent e) method I use e.getSource() to get the component that fired the event.
I take that object and compare it to the original reference.
If I do this inside of a panel, everything is hunky dory. The objects are equal. However, when I place the same component into a panel that resides within a scroll pane, the objects don't test equal. Here are a couple of debug lines; the first is the source object from the MouseAdapter and the second line is the component object that I store when I instantiate it.
com.canon.meap.ctk.awt.CLabel[canvas23,420,44,67x20]
com.canon.meap.ctk.awt.CLabel[canvas24,420,44,67x20]
You can see that the canvases don't match and essentially I have two different objects. It has got to do with adding it to the panel in the scrollpane, but I don't understand why. It should be the same object; where I place it shouldn't make any difference.
Here are some code snippets that hopefully help illustrate what it is that I have
Build The ScrollPane and add the Panel
Instantiate the component
Handle the event
I guess that somehow adding the component to the panel within the scrollpane is somehow generating a new object and modifying it. That's the way it appears anyway. Just curious if someone can help me understand whats going on here. Thanks