hades.gui
Class JMultiLineToolTip

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JToolTip
                  extended byhades.gui.JMultiLineToolTip
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class JMultiLineToolTip
extends javax.swing.JToolTip

A custom tool tip that displays multiple lines of text with specified margins and alignment.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JToolTip
javax.swing.JToolTip.AccessibleJToolTip
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  int alignment
           
static int CENTER
           
protected  java.lang.String label
           
static int LEFT
           
protected  int line_ascent
           
protected  int line_height
           
protected  int[] line_widths
           
protected  java.lang.String[] lines
           
protected  int margin_height
           
protected  int margin_width
           
protected  int max_width
           
protected  boolean measured
           
protected  int num_lines
           
static int RIGHT
           
 
Fields inherited from class javax.swing.JToolTip
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JMultiLineToolTip(java.lang.String label)
           
JMultiLineToolTip(java.lang.String label, int margin_width, int margin_height, int alignment)
           
 
Method Summary
 int getAlignment()
           
 java.lang.String getLabel()
           
 int getMarginHeight()
           
 int getMarginWidth()
           
 java.awt.Dimension getMinimumSize()
          This method is called when the layout manager wants to know the bare minimum amount of space we need to get by.
 java.awt.Dimension getPreferredSize()
          This method is called by a layout manager when it wants to know how big we'd like to be.
 void measure()
          This internal method figures out how the font is, and how wide each line of the label is, and how wide the widest line is.
protected  void newLabel()
          This internal method breaks a specified label up into an array of lines.
 void paintComponent(java.awt.Graphics g)
           
 void setAlignment(int a)
           
 void setFont(java.awt.Font f)
           
 void setForeground(java.awt.Color c)
           
 void setMarginHeight(int mh)
           
 void setMarginWidth(int mw)
           
 void setToolTipText(java.lang.String label)
           
 
Methods inherited from class javax.swing.JToolTip
getAccessibleContext, getComponent, getTipText, getUI, getUIClassID, paramString, setComponent, setTipText, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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

label

protected java.lang.String label

margin_width

protected int margin_width

margin_height

protected int margin_height

alignment

protected int alignment

LEFT

public static final int LEFT
See Also:
Constant Field Values

CENTER

public static final int CENTER
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values

num_lines

protected int num_lines

lines

protected java.lang.String[] lines

line_widths

protected int[] line_widths

max_width

protected int max_width

line_height

protected int line_height

line_ascent

protected int line_ascent

measured

protected boolean measured
Constructor Detail

JMultiLineToolTip

public JMultiLineToolTip(java.lang.String label,
                         int margin_width,
                         int margin_height,
                         int alignment)

JMultiLineToolTip

public JMultiLineToolTip(java.lang.String label)
Method Detail

setToolTipText

public void setToolTipText(java.lang.String label)

setFont

public void setFont(java.awt.Font f)

setForeground

public void setForeground(java.awt.Color c)

setAlignment

public void setAlignment(int a)

setMarginWidth

public void setMarginWidth(int mw)

setMarginHeight

public void setMarginHeight(int mh)

getLabel

public java.lang.String getLabel()

getAlignment

public int getAlignment()

getMarginWidth

public int getMarginWidth()

getMarginHeight

public int getMarginHeight()

getPreferredSize

public java.awt.Dimension getPreferredSize()
This method is called by a layout manager when it wants to know how big we'd like to be. In Java 1.1, getPreferredSize() is the preferred version of this method. We use this deprecated version so that this component can interoperate with 1.0 components.


getMinimumSize

public java.awt.Dimension getMinimumSize()
This method is called when the layout manager wants to know the bare minimum amount of space we need to get by. For Java 1.1, we'd use getMinimumSize().


paintComponent

public void paintComponent(java.awt.Graphics g)

newLabel

protected void newLabel()
This internal method breaks a specified label up into an array of lines. It uses the StringTokenizer utility class.


measure

public void measure()
This internal method figures out how the font is, and how wide each line of the label is, and how wide the widest line is.