|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLabel
net.sourceforge.doyen.URLLabel
Label to display a URL and handle opening it in a browser Uses the BrowserLauncher component
Nested Class Summary |
Nested classes inherited from class javax.swing.JLabel |
JLabel.AccessibleJLabel |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
private int |
mBegin
The index of the beginning of the linked text |
private int |
mEnd
The index after the linked text |
private static Logger |
mLogger
Private storage for a reference to the Logger |
private String |
mURL
The URL for the link |
Fields inherited from class javax.swing.JLabel |
labelFor |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Container |
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
URLLabel(String url)
Constructor for a URL with no other text |
|
URLLabel(String url,
String text)
Constructor for a url with different text (all of which is linked) |
|
URLLabel(String url,
String preText,
String linkText,
String postText)
Constructor for a url with text before and after the link text |
Method Summary | |
private String |
buildHTML(String preText,
String linkText,
String postText)
Creates an HTML formatting for the specified text |
private String |
escapeChars(String str)
Escapes chars for HTML (<, >) |
private boolean |
isWithinLink(Point p)
Tests whether the specified point is within the link text section |
void |
mouseClicked(MouseEvent e)
Handles clicks by opening the URL in the default browser |
void |
mouseDragged(MouseEvent e)
Unused |
void |
mouseEntered(MouseEvent e)
Sets the cursor appropriately |
void |
mouseExited(MouseEvent e)
Sets the cursor appropriately |
void |
mouseMoved(MouseEvent e)
Sets the cursor appropriately |
void |
mousePressed(MouseEvent e)
Unused |
void |
mouseReleased(MouseEvent e)
Unused |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private String mURL
private int mBegin
private int mEnd
private static Logger mLogger
Constructor Detail |
public URLLabel(String url)
url
- the urlpublic URLLabel(String url, String text)
url
- the urlpublic URLLabel(String url, String preText, String linkText, String postText)
url
- the urlpreText
- the text to display before the linklinkText
- the text to linkpostText
- the text to display after the linkMethod Detail |
private String buildHTML(String preText, String linkText, String postText)
preText
- the text before the linklinkText
- the text to link (blue underlined)postText
- the text after the linkprivate String escapeChars(String str)
str
- the string to escape
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
e
- the click eventpublic void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
e
- the eventpublic void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
e
- the eventpublic void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
e
- the eventprivate boolean isWithinLink(Point p)
p
- the point to test
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
e
- the eventpublic void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
e
- the eventpublic void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
e
- the event
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |