开发者

Hyperlink in JTextField

Is there some way to display text as hyperlink in JTextField so that when u开发者_开发问答ser presses it opens the link in a browser


You can't do that. Instead you want to use a JEditorPane:

http://download.oracle.com/javase/tutorial/uiswing/components/editorpane.html


Technically, you can override some methods of JTextField, like onClick(..), so you can check what you clicked at and if it starts with "www" or "http", open default web browser with that link as a parameter. But try to look at other text components, probably there will be some that can open link "by default".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜