juife
v0.1a

net.sf.juife
Class LinkButton

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.AbstractButton
                  extended by javax.swing.JButton
                      extended by net.sf.juife.LinkButton
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.SwingConstants

public class LinkButton
extends javax.swing.JButton

This class represents a button that acts as a hyperlink.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JButton
javax.swing.JButton.AccessibleJButton
 
Nested classes/interfaces inherited from class javax.swing.AbstractButton
javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener
 
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int BOLD
          The bold style constant.
static java.awt.Color COLOR_VISITED
          The default color for visited links.
static int ITALIC
          The italic style constant.
static int UNDERLINE
          The underline style constant.
 
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
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
LinkButton()
          Creates a new instance of LinkButton.
LinkButton(javax.swing.Action a)
          Creates a new instance of LinkButton where properties are taken from the Action supplied.
LinkButton(java.lang.String text)
          Creates a new instance of LinkButton with the specified text.
 
Method Summary
 java.awt.Color getDisabledColor()
          Gets the font color that is used when the link button is disabled.
 int getDisabledFontStyle()
          Gets the font style to be used when the link button is disabled.
 java.awt.Color getHoverColor()
          Gets the font color that is used when the mouse is over the link button.
 java.awt.Font getHoverFont()
          Gets the font that is used when the mouse is over the link button.
 int getHoverFontStyle()
          Gets the font style to be used when the mouse is over the button.
 java.awt.Color getUnvisitedColor()
          Gets the font color that is used for unvisited links.
 int getUnvisitedFontStyle()
          Gets the font style to be used for a unvisited links.
 java.awt.Color getVisitedColor()
          Gets the font color that is used for already visited links.
 int getVisitedFontStyle()
          Gets the font style to be used for a visited links.
 boolean isVisited()
          Determines the visited state of this link button.
 void setDisabledColor(java.awt.Color c)
          Sets the font color to be used when the link button is disabled.
 void setDisabledFontStyle(int style)
          Sets the font style to be used when the link button is disabled.
 void setEnabled(boolean b)
          Enables/disables the link button.
 void setHoverColor(java.awt.Color c)
          Sets the font color to be used when the mouse is over the button.
 void setHoverFont(java.awt.Font hoverFont)
          Sets the font to be used when the mouse is over the button.
 void setHoverFontStyle(int style)
          Sets the font style to be used when the mouse is over the button.
 void setText(java.lang.String text)
          Sets the button's text.
 void setUnvisitedColor(java.awt.Color c)
          Sets the font color to be used for unvisited links.
 void setUnvisitedFontStyle(int style)
          Sets the font style to be used for a unvisited links.
 void setVisited(boolean visited)
          Sets the visited state of this link button.
 void setVisitedColor(java.awt.Color c)
          Sets the font color to be used for already visited links.
 void setVisitedFontStyle(int style)
          Sets the font style to be used for a visited links.
 
Methods inherited from class javax.swing.JButton
configurePropertiesFromAction, getAccessibleContext, getUIClassID, isDefaultButton, isDefaultCapable, paramString, removeNotify, setDefaultCapable, updateUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, 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, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, 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, 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, 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
 

Field Detail

BOLD

public static final int BOLD
The bold style constant. This can be combined with the other style constants.

See Also:
Constant Field Values

ITALIC

public static final int ITALIC
The italic style constant. This can be combined with the other style constants.

See Also:
Constant Field Values

UNDERLINE

public static final int UNDERLINE
The underline style constant. This can be combined with the other style constants.

See Also:
Constant Field Values

COLOR_VISITED

public static final java.awt.Color COLOR_VISITED
The default color for visited links.

Constructor Detail

LinkButton

public LinkButton()
Creates a new instance of LinkButton.


LinkButton

public LinkButton(javax.swing.Action a)
Creates a new instance of LinkButton where properties are taken from the Action supplied.

Parameters:
a - The Action used to specify the new button.

LinkButton

public LinkButton(java.lang.String text)
Creates a new instance of LinkButton with the specified text.

Parameters:
text - The text of the button.
Method Detail

setText

public void setText(java.lang.String text)
Sets the button's text.

Overrides:
setText in class javax.swing.AbstractButton
Parameters:
text - The string used to set the text.

getHoverColor

public java.awt.Color getHoverColor()
Gets the font color that is used when the mouse is over the link button.

Returns:
The font color that is used when the mouse is over the link button.

setHoverColor

public void setHoverColor(java.awt.Color c)
Sets the font color to be used when the mouse is over the button. Set to null if you don't want to use hover color.

Parameters:
c - The font color to be used when the mouse is over the button.

getHoverFont

public java.awt.Font getHoverFont()
Gets the font that is used when the mouse is over the link button.

Returns:
The font that is used when the mouse is over the link button.

setHoverFont

public void setHoverFont(java.awt.Font hoverFont)
Sets the font to be used when the mouse is over the button. Set to null if you don't want to use hover font.

Parameters:
hoverFont - The font to be used when the mouse is over the button.

getHoverFontStyle

public int getHoverFontStyle()
Gets the font style to be used when the mouse is over the button.

Returns:
A combination of BOLD, ITALIC and UNDERLINE flags.

setHoverFontStyle

public void setHoverFontStyle(int style)
Sets the font style to be used when the mouse is over the button.

Parameters:
style - A combination of BOLD, ITALIC and UNDERLINE flags.

isVisited

public boolean isVisited()
Determines the visited state of this link button.

Returns:
true if this button is clicked at least once, false otherwise.

setVisited

public void setVisited(boolean visited)
Sets the visited state of this link button.

Parameters:
visited - If true the link button is marked as visited.

getVisitedColor

public java.awt.Color getVisitedColor()
Gets the font color that is used for already visited links. Visited link means a link button that is clicked at least once.

Returns:
The font color that is used for already visited links.
See Also:
isVisited(), setVisited(boolean)

setVisitedColor

public void setVisitedColor(java.awt.Color c)
Sets the font color to be used for already visited links. Visited link means a link button that is clicked at least once. Set to null if you don't want to use visited color.

Parameters:
c - The font color to be used for already visited links.
See Also:
isVisited(), setVisited(boolean)

getVisitedFontStyle

public int getVisitedFontStyle()
Gets the font style to be used for a visited links.

Returns:
A combination of BOLD, ITALIC and UNDERLINE flags.

setVisitedFontStyle

public void setVisitedFontStyle(int style)
Sets the font style to be used for a visited links.

Parameters:
style - A combination of BOLD, ITALIC and UNDERLINE flags.

getUnvisitedColor

public java.awt.Color getUnvisitedColor()
Gets the font color that is used for unvisited links. Unvisited link means a link button that isn't clicked even once.

Returns:
The font color that is used for unvisited links.
See Also:
isVisited(), setVisited(boolean)

setUnvisitedColor

public void setUnvisitedColor(java.awt.Color c)
Sets the font color to be used for unvisited links. Unvisited link means a link button that isn't clicked even once.

Parameters:
c - The font color to be used for unvisited links.
Throws:
java.lang.IllegalArgumentException - if c is null.
See Also:
isVisited(), setVisited(boolean)

getUnvisitedFontStyle

public int getUnvisitedFontStyle()
Gets the font style to be used for a unvisited links.

Returns:
A combination of BOLD, ITALIC and UNDERLINE flags.

setUnvisitedFontStyle

public void setUnvisitedFontStyle(int style)
Sets the font style to be used for a unvisited links.

Parameters:
style - A combination of BOLD, ITALIC and UNDERLINE flags.

getDisabledColor

public java.awt.Color getDisabledColor()
Gets the font color that is used when the link button is disabled.

Returns:
The font color that is used when the link button is disabled.
See Also:
setEnabled(boolean)

setDisabledColor

public void setDisabledColor(java.awt.Color c)
Sets the font color to be used when the link button is disabled.

Parameters:
c - The font color to be used when the link button is disabled.
Throws:
java.lang.IllegalArgumentException - if c is null.
See Also:
setEnabled(boolean)

getDisabledFontStyle

public int getDisabledFontStyle()
Gets the font style to be used when the link button is disabled.

Returns:
A combination of BOLD, ITALIC and UNDERLINE flags.
See Also:
setEnabled(boolean)

setDisabledFontStyle

public void setDisabledFontStyle(int style)
Sets the font style to be used when the link button is disabled.

Parameters:
style - A combination of BOLD, ITALIC and UNDERLINE flags.
See Also:
setEnabled(boolean)

setEnabled

public void setEnabled(boolean b)
Enables/disables the link button.

Overrides:
setEnabled in class javax.swing.AbstractButton
Parameters:
b - true to enable the button, false otherwise.

juife
v0.1a

Copyright © 2005 Grigor Iliev. All rights reserved. SourceForge.net Logo