3
Licensed to the Apache Software Foundation (ASF) under one or more
4
contributor license agreements. See the NOTICE file distributed with
5
this work for additional information regarding copyright ownership.
6
The ASF licenses this file to You under the Apache License, Version 2.0
7
(the "License"); you may not use this file except in compliance with
8
the License. You may obtain a copy of the License at
10
http://www.apache.org/licenses/LICENSE-2.0
12
Unless required by applicable law or agreed to in writing, software
13
distributed under the License is distributed on an "AS IS" BASIS,
14
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
See the License for the specific language governing permissions and
16
limitations under the License.
19
package org.apache.batik.swing.gvt;
21
import java.awt.event.MouseWheelEvent;
22
import java.awt.event.MouseWheelListener;
25
* Concrete version of {@link org.apache.batik.swing.gvt.AbstractJGVTComponent}.
27
* This class is used for JDKs >= 1.4, which have MouseWheelEvent
28
* support. For JDKs < 1.4, the file
29
* sources-1.3/org/apache/batik/swing/gvt/JGVTComponent defines a
30
* version of this class that does support MouseWheelEvents.
32
* @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
33
* @version $Id: JGVTComponent.java 475477 2006-11-15 22:44:28Z cam $
35
public class JGVTComponent extends AbstractJGVTComponent {
38
* Creates a new JGVTComponent.
40
public JGVTComponent() {
44
* Creates a new JGVTComponent.
45
* @param eventsEnabled Whether the GVT tree should be reactive
46
* to mouse and key events.
47
* @param selectableText Whether the text should be selectable.
48
* if eventEnabled is false, this flag is ignored.
50
public JGVTComponent(boolean eventsEnabled,
51
boolean selectableText) {
52
super(eventsEnabled, selectableText);
56
* Adds the AWT listeners.
58
protected void addAWTListeners() {
59
super.addAWTListeners();
60
addMouseWheelListener((ExtendedListener) listener);
64
* Creates an instance of Listener.
65
* Override to provide a Listener that can listen for mouse wheel
68
protected Listener createListener() {
69
return new ExtendedListener();
73
* To hide the listener methods.
75
protected class ExtendedListener
77
implements MouseWheelListener {
79
// MouseWheelListener ///////////////////////////////////////////////
82
* Invoked when the mouse wheel has been scrolled.
84
public void mouseWheelMoved(MouseWheelEvent e) {
85
/*selectInteractor(e);
86
if (interactor != null) {
87
interactor.mouseWheelMoved(e);
89
} else*/ if (eventDispatcher != null) {
90
dispatchMouseWheelMoved(e);
95
* Dispatches the mouse event to the GVT tree.
97
protected void dispatchMouseWheelMoved(MouseWheelEvent e) {
98
eventDispatcher.mouseWheelMoved(e);