01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: /**
18: * @author Evgeniya G. Maenkova
19: * @version $Revision$
20: */package javax.swing.event;
21:
22: import java.net.URL;
23: import java.util.EventObject;
24: import javax.swing.text.Element;
25:
26: public class HyperlinkEvent extends EventObject {
27:
28: public static final class EventType {
29: public static final EventType ACTIVATED = new EventType(
30: "ACTIVATED");
31: public static final EventType ENTERED = new EventType("ENTERED");
32: public static final EventType EXITED = new EventType("EXITED");
33:
34: private final String name;
35:
36: private EventType(final String name) {
37: this .name = name;
38: }
39:
40: public String toString() {
41: return name;
42: }
43: }
44:
45: private final EventType type;
46: private final String description;
47: private final Element sourceElement;
48: private final URL url;
49:
50: public HyperlinkEvent(final Object source, final EventType type,
51: final URL url) {
52: this (source, type, url, null, null);
53: }
54:
55: public HyperlinkEvent(final Object source, final EventType type,
56: final URL url, final String desc) {
57: this (source, type, url, desc, null);
58: }
59:
60: public HyperlinkEvent(final Object source, final EventType type,
61: final URL url, final String desc,
62: final Element sourceElement) {
63: super (source);
64: this .type = type;
65: this .url = url;
66: this .description = desc;
67: this .sourceElement = sourceElement;
68: }
69:
70: public String getDescription() {
71: return description;
72: }
73:
74: public EventType getEventType() {
75: return type;
76: }
77:
78: public Element getSourceElement() {
79: return sourceElement;
80: }
81:
82: public URL getURL() {
83: return url;
84: }
85: }
|