Source Code Cross Referenced for HyperlinkEvent.java in  » 6.0-JDK-Core » swing » javax » swing » event » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing.event 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 1997-2001 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025        package javax.swing.event;
026
027        import java.util.EventObject;
028        import java.net.URL;
029        import javax.swing.text.Element;
030
031        /**
032         * HyperlinkEvent is used to notify interested parties that 
033         * something has happened with respect to a hypertext link.
034         * <p>
035         * <strong>Warning:</strong>
036         * Serialized objects of this class will not be compatible with
037         * future Swing releases. The current serialization support is
038         * appropriate for short term storage or RMI between applications running
039         * the same version of Swing.  As of 1.4, support for long term storage
040         * of all JavaBeans<sup><font size="-2">TM</font></sup>
041         * has been added to the <code>java.beans</code> package.
042         * Please see {@link java.beans.XMLEncoder}.
043         *
044         * @version 1.25 05/05/07
045         * @author  Timothy Prinzing
046         */
047        public class HyperlinkEvent extends EventObject {
048
049            /**
050             * Creates a new object representing a hypertext link event.
051             * The other constructor is preferred, as it provides more
052             * information if a URL could not be formed.  This constructor
053             * is primarily for backward compatibility.
054             *
055             * @param source the object responsible for the event
056             * @param type the event type
057             * @param u the affected URL
058             */
059            public HyperlinkEvent(Object source, EventType type, URL u) {
060                this (source, type, u, null);
061            }
062
063            /**
064             * Creates a new object representing a hypertext link event.
065             *
066             * @param source the object responsible for the event
067             * @param type the event type
068             * @param u the affected URL.  This may be null if a valid URL
069             *   could not be created.
070             * @param desc the description of the link.  This may be useful
071             *   when attempting to form a URL resulted in a MalformedURLException.
072             *   The description provides the text used when attempting to form the
073             *   URL.
074             */
075            public HyperlinkEvent(Object source, EventType type, URL u,
076                    String desc) {
077                this (source, type, u, desc, null);
078            }
079
080            /**
081             * Creates a new object representing a hypertext link event.
082             *
083             * @param source the object responsible for the event
084             * @param type the event type
085             * @param u the affected URL.  This may be null if a valid URL
086             *   could not be created.
087             * @param desc the description of the link.  This may be useful
088             *   when attempting to form a URL resulted in a MalformedURLException.
089             *   The description provides the text used when attempting to form the
090             *   URL.
091             * @param sourceElement Element in the Document representing the
092             *   anchor
093             * @since 1.4
094             */
095            public HyperlinkEvent(Object source, EventType type, URL u,
096                    String desc, Element sourceElement) {
097                super (source);
098                this .type = type;
099                this .u = u;
100                this .desc = desc;
101                this .sourceElement = sourceElement;
102            }
103
104            /**
105             * Gets the type of event.
106             *
107             * @return the type
108             */
109            public EventType getEventType() {
110                return type;
111            }
112
113            /**
114             * Get the description of the link as a string.
115             * This may be useful if a URL can't be formed
116             * from the description, in which case the associated
117             * URL would be null.
118             */
119            public String getDescription() {
120                return desc;
121            }
122
123            /**
124             * Gets the URL that the link refers to.
125             *
126             * @return the URL
127             */
128            public URL getURL() {
129                return u;
130            }
131
132            /**
133             * Returns the <code>Element</code> that corresponds to the source of the
134             * event. This will typically be an <code>Element</code> representing
135             * an anchor. If a constructur that is used that does not specify a source
136             * <code>Element</code>, or null was specified as the source
137             * <code>Element</code>, this will return null.
138             *
139             * @return Element indicating source of event, or null
140             * @since 1.4
141             */
142            public Element getSourceElement() {
143                return sourceElement;
144            }
145
146            private EventType type;
147            private URL u;
148            private String desc;
149            private Element sourceElement;
150
151            /**
152             * Defines the ENTERED, EXITED, and ACTIVATED event types, along
153             * with their string representations, returned by toString().
154             */
155            public static final class EventType {
156
157                private EventType(String s) {
158                    typeString = s;
159                }
160
161                /**
162                 * Entered type.
163                 */
164                public static final EventType ENTERED = new EventType("ENTERED");
165
166                /**
167                 * Exited type.
168                 */
169                public static final EventType EXITED = new EventType("EXITED");
170
171                /**
172                 * Activated type.
173                 */
174                public static final EventType ACTIVATED = new EventType(
175                        "ACTIVATED");
176
177                /**
178                 * Converts the type to a string.
179                 *
180                 * @return the string
181                 */
182                public String toString() {
183                    return typeString;
184                }
185
186                private String typeString;
187            }
188        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.