views:

35

answers:

1

Hey,

I have this frame:

alt text

Here is what happens:

  1. When I'm over the Pinkish panel, the scroll pane works just fine.
  2. When I put the mouse over the Darker gray JTextArea the scroll pane does not get the event.

In general my question is how can I make sure the parent of a component receives the event if the component didn't handle that specific event, even if the component has a listener and is enabled?

Perhaps a specific example will do.

You can see the calculator, the calculator is drawn on a scalable image panel, and can zoom in and out by the Ctrl + Wheel event, but when I don't press Ctrl, I would like the scroll pane to receive the event and scroll the view port. (I think this sums it)

Adam.

+1  A: 

While not entirely "neat", my answer in this question might be adapted to do what you want to do.

Instead of a MOUSE_EVENT_MASK you'd use a AWTEvent.MOUSE_WHEEL_EVENT_MASK, and pass the event to the scrollpane when the control key state is appropriate.

(With any luck someone will post a "real" mechanism to forward an event to the parent component).

Ash
No exactly what I had in mind, I'll see how I do this... Thanks for the Idea.
TacB0sS