org.shetline.gui
Class KLabel
java.lang.Object
  
java.awt.Component
      
java.awt.Container
          
javax.swing.JComponent
              
javax.swing.JLabel
                  
org.shetline.gui.KLabel
- All Implemented Interfaces: 
 - ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants
 
public class KLabel
- extends JLabel
 
- See Also:
 - Serialized Form
 
 
 
 
 
 
 
 
 
 
| 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 | 
 
 
 
| 
Method Summary | 
 void | 
addActionListener(ActionListener listener)
 
            | 
protected  void | 
consolidateLinks()
 
            | 
protected  void | 
copyToClipboard()
 
            | 
protected  String | 
extractTextContent(Element elem)
 
            | 
protected  void | 
fireCommand(String command)
 
            | 
protected  void | 
fireCommand(String command,
            int modifiers)
 
            | 
protected  void | 
fireCommand(String command,
            String target)
 
            | 
protected  void | 
fireCommand(String command,
            String target,
            int modifiers)
 
            | 
 AccessibleContext | 
getAccessibleContext()
 
            | 
 String | 
getActionCommand()
 
            | 
protected  Shape | 
getFocusBounds()
 
            | 
protected  String | 
getFocusCommand()
 
            | 
protected  KLabel.LinkInfo | 
getFocusInfo()
 
            | 
protected  String | 
getFocusTarget()
 
            | 
 KLabel.LinkCopyPolicy | 
getLinkCopyPolicy()
 
            | 
protected  int | 
getLinkIndex(Point pt)
 
            | 
 int | 
getMaximumPreferredWidth()
 
            | 
 Dimension | 
getMinimumSize()
 
            | 
 int | 
getMinimumWidthOverride()
 
            | 
 boolean | 
getOpenHTTPLinksInBrowser()
 
            | 
 boolean | 
getPaintFocusUnderText()
 
            | 
 Dimension | 
getPreferredSize()
 
            | 
protected  String | 
getTarget(Point pt)
 
            | 
static int | 
getTextHeightAtWidth(JLabel label,
                     int width)
 
            | 
protected static int | 
getTextHeightAtWidth(JLabel label,
                     String text,
                     Font font,
                     int width)
 
            | 
static int | 
getTextHeightAtWidth(String text,
                     Font font,
                     int width)
 
            | 
protected  void | 
installKeyStrokeActions(JComponent comp)
 
            | 
 boolean | 
isFocusable()
 
            | 
protected  boolean | 
isFocusWorthy()
 
            | 
protected static boolean | 
isHTTP(String href)
 
            | 
protected  boolean | 
isNothingButLink()
 
            | 
protected  void | 
KLabelX()
 
            | 
protected  void | 
lookForLinks(View view)
 
            | 
protected  void | 
lookForLinks(View view,
             Shape bounds)
 
            | 
static String | 
markupUnavailableCharsInDialogFont(Font font,
                                   String s)
 
            | 
protected  void | 
paintComponent(Graphics g)
 
            | 
protected  void | 
paintFocus(Graphics g)
 
            | 
 void | 
removeActionListener(ActionListener listener)
 
            | 
 void | 
setActionCommand(String command)
 
            | 
 void | 
setFocusable(boolean focusable)
 
            | 
 void | 
setLinkCopyPolicy(KLabel.LinkCopyPolicy policy)
 
            | 
 void | 
setMaximumPreferredWidth(int prefWidth)
 
            | 
 void | 
setMinimumSize(Dimension minimumSize)
 
            | 
 void | 
setMinimumWidthOverride(int minWidth)
 
            | 
 void | 
setOpenHTTPLinksInBrowser(boolean inBrowser)
 
            | 
 void | 
setPaintFocusUnderText(boolean under)
 
            | 
 void | 
setPreferredSize(Dimension prefSize)
 
            | 
 void | 
setText(String text)
 
            | 
protected  void | 
updateFocusHolders()
 
            | 
protected  String | 
updateMouseLocation(Point pt)
 
            | 
 void | 
updateUI()
 
            | 
 
| Methods inherited from class javax.swing.JLabel | 
checkHorizontalKey, checkVerticalKey, 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, 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, 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, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setNextFocusableComponent, setOpaque, 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, 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, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle | 
 
 
actionCommand
protected String actionCommand
documentLength
protected int documentLength
explicitFocusable
protected boolean explicitFocusable
extraKeyListener
protected KeyListener extraKeyListener
focusListener
protected FocusListener focusListener
lastFocusBounds
protected Shape lastFocusBounds
lastPoint
protected Point lastPoint
linkCopyPolicy
protected KLabel.LinkCopyPolicy linkCopyPolicy
linkList
protected KLabel.LinkList linkList
listenerHandler
protected ListenerHandler listenerHandler
minWidthOverride
protected int minWidthOverride
maxPreferredWidth
protected int maxPreferredWidth
openHTTPLinksInBrowser
protected boolean openHTTPLinksInBrowser
paintFocusUnderText
protected boolean paintFocusUnderText
plainText
protected String plainText
showingHandCursor
protected boolean showingHandCursor
FOCUS_COLOR
protected static final Color FOCUS_COLOR
COPY_KEY
protected static final KeyStroke COPY_KEY
SPACE_KEY
protected static final KeyStroke SPACE_KEY
CMD_COPY
protected static final String CMD_COPY
- See Also:
 - Constant Field Values
 
CMD_SELECT
protected static final String CMD_SELECT
- See Also:
 - Constant Field Values
 
SAME_AS_PREFERRED_WIDTH
public static final int SAME_AS_PREFERRED_WIDTH
- See Also:
 - Constant Field Values
 
USE_DEFAULT_MINIMUM_WIDTH
public static final int USE_DEFAULT_MINIMUM_WIDTH
- See Also:
 - Constant Field Values
 
USE_DEFAULT_PREFERRED_WIDTH
public static final int USE_DEFAULT_PREFERRED_WIDTH
- See Also:
 - Constant Field Values
 
scratchGraphics
protected static final Graphics scratchGraphics
scratchLabel
protected static final JLabel scratchLabel
VERY_TALL
protected static final int VERY_TALL
- See Also:
 - Constant Field Values
 
KLabel
public KLabel()
KLabel
public KLabel(Icon image)
KLabel
public KLabel(Icon image,
              int horizontalAlignment)
KLabel
public KLabel(String text)
KLabel
public KLabel(String text,
              boolean openHTTPLinksInBrowser)
KLabel
public KLabel(String text,
              int horizontalAlignment)
KLabel
public KLabel(String text,
              Icon icon,
              int horizontalAlignment)
KLabelX
protected void KLabelX()
 
getMinimumWidthOverride
public int getMinimumWidthOverride()
 
setMinimumWidthOverride
public void setMinimumWidthOverride(int minWidth)
 
setMinimumSize
public void setMinimumSize(Dimension minimumSize)
- Overrides:
 setMinimumSize in class JComponent
 
 
getMinimumSize
public Dimension getMinimumSize()
- Overrides:
 getMinimumSize in class JComponent
 
 
getMaximumPreferredWidth
public int getMaximumPreferredWidth()
 
setMaximumPreferredWidth
public void setMaximumPreferredWidth(int prefWidth)
 
setPreferredSize
public void setPreferredSize(Dimension prefSize)
- Overrides:
 setPreferredSize in class JComponent
 
 
getPreferredSize
public Dimension getPreferredSize()
- Overrides:
 getPreferredSize in class JComponent
 
 
setText
public void setText(String text)
- Overrides:
 setText in class JLabel
 
 
isFocusable
public boolean isFocusable()
- Overrides:
 isFocusable in class Component
 
 
setFocusable
public void setFocusable(boolean focusable)
- Overrides:
 setFocusable in class Component
 
 
isFocusWorthy
protected boolean isFocusWorthy()
 
addActionListener
public void addActionListener(ActionListener listener)
 
removeActionListener
public void removeActionListener(ActionListener listener)
 
getActionCommand
public String getActionCommand()
 
setActionCommand
public void setActionCommand(String command)
 
getPaintFocusUnderText
public boolean getPaintFocusUnderText()
 
setPaintFocusUnderText
public void setPaintFocusUnderText(boolean under)
 
getOpenHTTPLinksInBrowser
public boolean getOpenHTTPLinksInBrowser()
 
setOpenHTTPLinksInBrowser
public void setOpenHTTPLinksInBrowser(boolean inBrowser)
 
fireCommand
protected void fireCommand(String command)
 
fireCommand
protected void fireCommand(String command,
                           int modifiers)
 
fireCommand
protected void fireCommand(String command,
                           String target)
 
fireCommand
protected void fireCommand(String command,
                           String target,
                           int modifiers)
 
paintComponent
protected void paintComponent(Graphics g)
- Overrides:
 paintComponent in class JComponent
 
 
paintFocus
protected void paintFocus(Graphics g)
 
getFocusInfo
protected KLabel.LinkInfo getFocusInfo()
 
getFocusBounds
protected Shape getFocusBounds()
 
getFocusCommand
protected String getFocusCommand()
 
getFocusTarget
protected String getFocusTarget()
 
lookForLinks
protected void lookForLinks(View view)
 
lookForLinks
protected void lookForLinks(View view,
                            Shape bounds)
 
consolidateLinks
protected void consolidateLinks()
 
extractTextContent
protected String extractTextContent(Element elem)
 
updateFocusHolders
protected void updateFocusHolders()
 
updateMouseLocation
protected String updateMouseLocation(Point pt)
 
getLinkIndex
protected int getLinkIndex(Point pt)
 
getTarget
protected String getTarget(Point pt)
 
isNothingButLink
protected boolean isNothingButLink()
 
getLinkCopyPolicy
public KLabel.LinkCopyPolicy getLinkCopyPolicy()
 
setLinkCopyPolicy
public void setLinkCopyPolicy(KLabel.LinkCopyPolicy policy)
 
copyToClipboard
protected void copyToClipboard()
 
getAccessibleContext
public AccessibleContext getAccessibleContext()
- Specified by:
 getAccessibleContext in interface Accessible- Overrides:
 getAccessibleContext in class JLabel
 
 
isHTTP
protected static boolean isHTTP(String href)
 
updateUI
public void updateUI()
- Overrides:
 updateUI in class JLabel
 
 
installKeyStrokeActions
protected void installKeyStrokeActions(JComponent comp)
 
markupUnavailableCharsInDialogFont
public static String markupUnavailableCharsInDialogFont(Font font,
                                                        String s)
 
getTextHeightAtWidth
public static int getTextHeightAtWidth(JLabel label,
                                       int width)
 
getTextHeightAtWidth
public static int getTextHeightAtWidth(String text,
                                       Font font,
                                       int width)
 
getTextHeightAtWidth
protected static int getTextHeightAtWidth(JLabel label,
                                          String text,
                                          Font font,
                                          int width)