com.alee.extended.label
Class WebLinkLabel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JLabel
                  extended by com.alee.laf.label.WebLabel
                      extended by com.alee.extended.label.WebLinkLabel
All Implemented Interfaces:
LanguageMethods, Styleable, FontMethods<WebLabel>, SizeMethods<WebLabel>, SwingMethods, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.SwingConstants

public class WebLinkLabel
extends WebLabel
implements LanguageMethods

This custom component provides a link functionality together with default label options. Link could be an internet address, e-mail or some file. You can also specify a custom link action by passing a runnable. Link can also be styled by default using custom L&F icons and default naming.

Author:
Mikle Garin
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JLabel
javax.swing.JLabel.AccessibleJLabel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.util.List<java.awt.event.ActionListener> actionListeners
          Link activation listeners.
protected  java.lang.String actualText
           
protected  boolean colorVisited
           
static javax.swing.ImageIcon EMAIL_ICON
           
protected  java.util.concurrent.ExecutorService executorService
          ExecutorService to limit simultaneously running threads.
protected  java.awt.Color foreground
           
protected  boolean highlight
          Style settings.
protected  java.lang.Runnable link
          Link settings.
static javax.swing.ImageIcon LINK_ICON
          Used icons.
protected  boolean mouseover
          Runtime variables.
protected  boolean onPressAction
           
protected  java.awt.Color visitedForeground
           
protected  boolean visitedOnce
           
 
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.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
WebLinkLabel()
           
WebLinkLabel(javax.swing.Icon image)
           
WebLinkLabel(javax.swing.Icon image, int horizontalAlignment)
           
WebLinkLabel(java.lang.String text)
           
WebLinkLabel(java.lang.String text, javax.swing.Icon icon, int horizontalAlignment)
           
WebLinkLabel(java.lang.String text, int horizontalAlignment)
           
 
Method Summary
 void addActionListener(java.awt.event.ActionListener actionListener)
          Link action listeners
protected  java.lang.Runnable createAddressLink(java.lang.String address)
           
protected  java.lang.Runnable createEmailLink(java.lang.String email)
           
protected  java.lang.Runnable createFileLink(java.io.File file)
           
protected  void fireActionPerformed()
           
 java.lang.String getActualText()
          Link text settings
 java.lang.Runnable getLink()
           
 java.awt.Color getUnvisitedForeground()
          Link foreground settings
 java.awt.Color getVisitedForeground()
           
protected  void initializeSettings()
          Link label settings initialization
 boolean isHighlight()
           
 boolean isOnPressAction()
           
 boolean isVisitedOnce()
          Link settings
 void removeActionListener(java.awt.event.ActionListener actionListener)
           
 void setEmailLink(java.lang.String email)
           
 void setEmailLink(java.lang.String email, boolean setupView)
           
 void setEmailLink(java.lang.String text, java.lang.String email)
           
 void setEmailLink(java.lang.String text, java.lang.String email, boolean setupView)
           
 void setFileLink(java.io.File file)
           
 void setFileLink(java.io.File file, boolean setupView)
           
 void setFileLink(java.lang.String text, java.io.File file)
           
 void setFileLink(java.lang.String text, java.io.File file, boolean setupView)
           
 void setForeground(java.awt.Color foreground)
           
 void setHighlight(boolean highlight)
           
 void setLink(java.lang.Runnable link)
           
 void setLink(java.lang.String address)
           
 void setLink(java.lang.String address, boolean setupView)
           
 void setLink(java.lang.String text, java.lang.Runnable link)
           
 void setLink(java.lang.String text, java.lang.Runnable link, boolean setupView)
           
 void setLink(java.lang.String text, java.lang.String address)
           
 void setLink(java.lang.String text, java.lang.String address, boolean setupView)
           
 void setOnPressAction(boolean onPressAction)
           
 void setText(java.lang.String text)
           
 void setUnvisitedForeground(java.awt.Color foreground)
           
 void setVisitedForeground(java.awt.Color visitedForeground)
           
protected  void updateForeground()
           
protected  void updateText()
           
 
Methods inherited from class com.alee.laf.label.WebLabel
changeFontSize, createTranslatedLabel, createTranslatedLabel, createTranslatedLabel, createTranslatedLabel, createTranslatedLabel, createTranslatedLabel, createTranslatedLabel, createTranslatedLabel, getFontName, getFontSize, getMargin, getMinimumHeight, getMinimumWidth, getPainter, getPreferredHeight, getPreferredSize, getPreferredWidth, getShadeColor, getStyleId, getTransparency, getWebUI, isBoldFont, isDrawShade, isItalicFont, isLanguageSet, isPlainFont, removeLanguage, removeLanguageUpdater, setBoldFont, setBoldFont, setDrawShade, setFontName, setFontSize, setFontSizeAndStyle, setFontSizeAndStyle, setFontStyle, setFontStyle, setItalicFont, setItalicFont, setLanguage, setLanguageUpdater, setMargin, setMargin, setMargin, setMinimumHeight, setMinimumWidth, setPainter, setPlainFont, setPlainFont, setPreferredHeight, setPreferredWidth, setShadeColor, setStyleId, setTransparency, updateLanguage, updateLanguage, updateUI
 
Methods inherited from class javax.swing.JLabel
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setUI, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.alee.managers.language.LanguageMethods
isLanguageSet, removeLanguage, removeLanguageUpdater, setLanguage, setLanguageUpdater, updateLanguage, updateLanguage
 

Field Detail

LINK_ICON

public static final javax.swing.ImageIcon LINK_ICON
Used icons.


EMAIL_ICON

public static final javax.swing.ImageIcon EMAIL_ICON

executorService

protected java.util.concurrent.ExecutorService executorService
ExecutorService to limit simultaneously running threads.


actionListeners

protected java.util.List<java.awt.event.ActionListener> actionListeners
Link activation listeners.


highlight

protected boolean highlight
Style settings.


onPressAction

protected boolean onPressAction

colorVisited

protected boolean colorVisited

foreground

protected java.awt.Color foreground

visitedForeground

protected java.awt.Color visitedForeground

link

protected java.lang.Runnable link
Link settings.


actualText

protected java.lang.String actualText

mouseover

protected boolean mouseover
Runtime variables.


visitedOnce

protected boolean visitedOnce
Constructor Detail

WebLinkLabel

public WebLinkLabel()

WebLinkLabel

public WebLinkLabel(javax.swing.Icon image)

WebLinkLabel

public WebLinkLabel(javax.swing.Icon image,
                    int horizontalAlignment)

WebLinkLabel

public WebLinkLabel(java.lang.String text)

WebLinkLabel

public WebLinkLabel(java.lang.String text,
                    int horizontalAlignment)

WebLinkLabel

public WebLinkLabel(java.lang.String text,
                    javax.swing.Icon icon,
                    int horizontalAlignment)
Method Detail

initializeSettings

protected void initializeSettings()
Link label settings initialization


getUnvisitedForeground

public java.awt.Color getUnvisitedForeground()
Link foreground settings


setUnvisitedForeground

public void setUnvisitedForeground(java.awt.Color foreground)

setForeground

public void setForeground(java.awt.Color foreground)
Overrides:
setForeground in class javax.swing.JComponent

getVisitedForeground

public java.awt.Color getVisitedForeground()

setVisitedForeground

public void setVisitedForeground(java.awt.Color visitedForeground)

updateForeground

protected void updateForeground()

getActualText

public java.lang.String getActualText()
Link text settings


setText

public void setText(java.lang.String text)
Overrides:
setText in class javax.swing.JLabel

updateText

protected void updateText()

isVisitedOnce

public boolean isVisitedOnce()
Link settings


getLink

public java.lang.Runnable getLink()

setLink

public void setLink(java.lang.Runnable link)

setLink

public void setLink(java.lang.String text,
                    java.lang.Runnable link)

setLink

public void setLink(java.lang.String address)

setLink

public void setLink(java.lang.String address,
                    boolean setupView)

setLink

public void setLink(java.lang.String text,
                    java.lang.String address)

setLink

public void setLink(java.lang.String text,
                    java.lang.String address,
                    boolean setupView)

setLink

public void setLink(java.lang.String text,
                    java.lang.Runnable link,
                    boolean setupView)

setEmailLink

public void setEmailLink(java.lang.String email)

setEmailLink

public void setEmailLink(java.lang.String email,
                         boolean setupView)

setEmailLink

public void setEmailLink(java.lang.String text,
                         java.lang.String email)

setEmailLink

public void setEmailLink(java.lang.String text,
                         java.lang.String email,
                         boolean setupView)

setFileLink

public void setFileLink(java.io.File file)

setFileLink

public void setFileLink(java.io.File file,
                        boolean setupView)

setFileLink

public void setFileLink(java.lang.String text,
                        java.io.File file)

setFileLink

public void setFileLink(java.lang.String text,
                        java.io.File file,
                        boolean setupView)

isHighlight

public boolean isHighlight()

setHighlight

public void setHighlight(boolean highlight)

isOnPressAction

public boolean isOnPressAction()

setOnPressAction

public void setOnPressAction(boolean onPressAction)

addActionListener

public void addActionListener(java.awt.event.ActionListener actionListener)
Link action listeners


removeActionListener

public void removeActionListener(java.awt.event.ActionListener actionListener)

fireActionPerformed

protected void fireActionPerformed()

createAddressLink

protected java.lang.Runnable createAddressLink(java.lang.String address)

createEmailLink

protected java.lang.Runnable createEmailLink(java.lang.String email)

createFileLink

protected java.lang.Runnable createFileLink(java.io.File file)