public class HyperlinkEvent extends EventObject
警告:序列化该类的对象与以后的Swing版本不兼容。当前的序列化支持适用于短期贮藏或RMI运行相同Swing版本的应用程序之间。为1.4,为所有JavaBeans™长期存储的支持已被添加到java.beans
包。请看XMLEncoder
。
Modifier and Type | Class and Description |
---|---|
static class |
HyperlinkEvent.EventType
定义了进入、退出,和激活的事件类型,以及它们所返回的字符串表示,tostring()。
|
source
Constructor and Description |
---|
HyperlinkEvent(Object source, HyperlinkEvent.EventType type, URL u)
创建一个表示超文本链接事件的新对象。
|
HyperlinkEvent(Object source, HyperlinkEvent.EventType type, URL u, String desc)
创建一个表示超文本链接事件的新对象。
|
HyperlinkEvent(Object source, HyperlinkEvent.EventType type, URL u, String desc, Element sourceElement)
创建一个表示超文本链接事件的新对象。
|
HyperlinkEvent(Object source, HyperlinkEvent.EventType type, URL u, String desc, Element sourceElement, InputEvent inputEvent)
创建一个表示超文本链接事件的新对象。
|
Modifier and Type | Method and Description |
---|---|
String |
getDescription()
获取链接的描述作为一个字符串。
|
HyperlinkEvent.EventType |
getEventType()
获取事件的类型。
|
InputEvent |
getInputEvent()
返回链接的
InputEvent 触发事件。
|
Element |
getSourceElement()
返回对应于事件的源
Element 。
|
URL |
getURL()
获取链接所指向的网址。
|
getSource, toString
public HyperlinkEvent(Object source, HyperlinkEvent.EventType type, URL u)
source
负责该事件的对象
type
-事件类型
u
-受影响的URL
public HyperlinkEvent(Object source, HyperlinkEvent.EventType type, URL u, String desc)
source
负责该事件的对象
type
-事件类型
u
-受影响的URL。如果无法创建有效的网址,这可能是无效的。
desc
-链接的描述。这可能是有用的试图形成一个URL时,导致malformedurlexception。描述提供了在试图形成网址时使用的文本。
public HyperlinkEvent(Object source, HyperlinkEvent.EventType type, URL u, String desc, Element sourceElement)
source
负责该事件的对象
type
-事件类型
u
-受影响的URL。如果无法创建有效的网址,这可能是无效的。
desc
-链接的描述。这可能是有用的试图形成一个URL时,导致malformedurlexception。描述提供了在试图形成网址时使用的文本。
sourceElement
-代表锚文档元素
public HyperlinkEvent(Object source, HyperlinkEvent.EventType type, URL u, String desc, Element sourceElement, InputEvent inputEvent)
source
负责该事件的对象
type
-事件类型
u
-受影响的URL。如果无法创建有效的网址,这可能是无效的。
desc
-链接的描述。这可能是有用的试图形成一个URL时,导致malformedurlexception。描述提供了在试图形成网址时使用的文本。
sourceElement
-代表锚文档元素
inputEvent
- inputevent触发事件的超链接
public HyperlinkEvent.EventType getEventType()
public String getDescription()
public URL getURL()
public Element getSourceElement()
Element
。这通常是代表一个
Element
锚。如果一个构造函数,使用不指定源
Element
,或null指定为源
Element
,则返回null。
public InputEvent getInputEvent()
InputEvent
触发事件。这通常是一个
MouseEvent
。如果一个构造函数的使用并没有指定一个
InputEvent
,或“{零}代码指定为
InputEvent
,返回
null
。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.