Class symantec.itools.awt.InfoTipPanel
All Packages Class Hierarchy This Package Previous Next Index
Class symantec.itools.awt.InfoTipPanel
Object
|
+----Component
|
+----Container
|
+----Panel
|
+----ImagePanel
|
+----symantec.itools.awt.InfoTipPanel
- public class InfoTipPanel
- extends ImagePanel
- implements Runnable, Serializable
The InfoTipPanel is a panel which may contain only
one component.
Whenever this component receives a mouse entered event, the
InfoTipPanel either scrolls a text message towards the button
or pops the text up immediately next to the button.
Whenever this component receives a mouse exit event, the
text scrolls away from the component or disappears.
- Version:
- 1.0, September 4, 1997
- Author:
- Symantec
-
ABOVE_COMPONENT
- Defines the "from top" scroll direction.
-
BELOW_COMPONENT
- Defines the "from bottom" scroll direction.
-
DONE_SCROLLING_IN
- Defines the "done scrolling in" scroll state.
-
DONE_SCROLLING_OUT
- Defines the "done scrolling out" scroll state.
-
LEFT_OF_COMPONENT
- Defines the "from left" scroll direction.
-
RIGHT_OF_COMPONENT
- Defines the "from right" scroll direction.
-
SCROLLING_IN
- Defines the "scrolling in" scroll state.
-
SCROLLING_OUT
- Defines the "scrolling out" scroll state.
-
WAITING_TO_SCROLL_IN
- Defines the "waiting to scroll in" scroll state.
-
bufferedBgndImage
- Off screen buffer used for animation.
-
callingAddInternally
- Internal flag that indicates a call to add() is being made from within InfoTipPanel.
-
delayTimer
- Timer object which is used to time the delay before popping up the text.
-
dontDrawText
- Internal flag that indicates that the component is NOT to draw the text from within paint().
-
errors
- Error strings.
-
extraHighlightHeight
- Extra height which is added on if highlighText == true
-
extraHighlightWidth
- Extra width which is added on if highlighText == true
-
highlightText
- boolean property representing whether the text will be drawn transparently
rather than using the specified textHighlightColor.
-
myComponent
- Reference to the component which will be added to the InfoTipPanel and
whose mouse entered and mouse exited events will control the scrolling of the text.
-
myMouseListener
- Reference to the Mouse object which is listening to myComponent for mouse events.
-
offScreenImage
- Off screen buffer used for animation.
-
text
- The text which will be scrolled on mouse entered and mouse exited events from myComponent.
-
textAnimationThread
- The thread which will animate the scrolling text.
-
textAscent
- Ascent of current message text.
-
textColor
- The color used for text when this component is enabled.
-
textDelay
- int property which represents how long (in milliseconds) to pause before
starting to scroll/pop-up text on a mouse entered event.
-
textDescent
- Descent of current message text.
-
textHeight
- Height of current message text.
-
textHighlightColor
- Color which will be used to highlight the text if highlightText flag is set.
-
textScrollsIn
- boolean property representing whether the text will be scrolled in from the
edge of the panel on a mouse over, or popped up beside the component.
-
textWidth
- Width of current message text.
-
symantec.itools.awt.InfoTipPanel()
- Constructs a default InfoTipPanel.
-
symantec.itools.awt.InfoTipPanel(Component, String, int, boolean, int, boolean)
- Constructs a new InfoTipPanel initialized with the
specified component, text, minimum height and
minimum width.
-
addImpl(Component, Object, int)
- Adds the specified component to this container at the specified
index.
-
addNotify()
- Tells this component that it has been added to a container.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a listener for all event changes.
-
addTextLocationListener(PropertyChangeListener)
- Adds a listener for the TextLocation property changes.
-
addTextLocationListener(VetoableChangeListener)
- Adds a vetoable listener for the TextLocation property changes.
-
addVetoableChangeListener(VetoableChangeListener)
- Adds a vetoable listener for all event changes.
-
atOrBeyondPoint(Point, Point, int)
- Utility method for updateDirection, calculateDX, and calculateDY.
-
calculateDX(Point)
- Utility method for drawNextFrame.
-
calculateDY(Point)
- Utility method for drawNextFrame.
-
calculateTextAttributes()
- Utility method.
-
createOffScreenBuffers()
- This method re-creates the off screen images necessary for the text animation.
-
drawNextFrame(Point)
- Does all necessary calculations and graphics work to advance the text one frame
(starting from the point specified in the paramter startingPoint).
-
drawText(Graphics, int, int)
- Draws the current text into the graphics context and location specified
in the parameters.
-
getAreaAffectedByPopup()
- Utility method for getBufferedBackgroundBounds.
-
getAreaAffectedByScroll()
- Utility method for getBufferedBackgroundBounds.
-
getBufferedBackgroundBottomMostY()
- Utility method for getBufferedBackgroundBounds.
-
getBufferedBackgroundBounds()
- Calculates the rectangle which bounds the portion of this component's background which
the text will animate over.
-
getBufferedBackgroundLeftMostX()
- Utility method for getBufferedBackgroundBounds.
-
getBufferedBackgroundRightMostX()
- Utility method for getBufferedBackgroundBounds.
-
getBufferedBackgroundTopMostY()
- Utility method for getBufferedBackgroundBounds.
-
getComponent()
- Gets the current component in the InfoTipPanel.
-
getHighlightBounds(int, int)
- Determines the rectangle which bounds the area that should be highlighted.
-
getHighlightText()
- Gets the current value of the "Highlight Text" property which
determines whether the text will be highlighted with the current
textHighlightColor or not.
-
getMinimumSize()
- Returns the minimum dimensions to properly display this component.
-
getPreferredSize()
- Returns the recommended dimensions to properly display this component.
-
getText()
- Gets the current text in this InfoTipPanel.
-
getTextColor()
- Gets the current text color.
-
getTextConstantXPos()
- Utility method for getTextStartingPoint and getTextFinishingPoint.
-
getTextConstantYPos()
- Utility method for getTextStartingPoint and getTextFinishingPoint.
-
getTextDelay()
- Get the amount of time (in milliseconds) to wait after a mouse
entered event before the text is scrolled in or popped up.
-
getTextFinishingPoint()
- Calculates the point at which the text should be located when the scrolling
animation has scrolled the text all the way in.
-
getTextHighlightColor()
- Gets the current highlight color which will be used if highlightText
is true.
-
getTextLocation()
- Gets the current value of the "Text Location" property for this InfoTipPanel.
-
getTextScrollsIn()
- Gets the value of the "Text Scrolls In" property which tells the
InfoTipPanel whether the text should be scrolled in on a mouse over
rather than just appearing next to the component (without scrolling in).
-
getTextStartingPoint()
- Calculates the point at which the text should be located when the scrolling
animation is initiated.
-
isValidTextLocation(int)
- Is the given text location valid.
-
paint(Graphics)
- Paints this component using the given graphics context.
-
popDownText()
- Basically just erases the text next to the component (in the location specified
by textLocation).
-
popUpText()
- Draws the text next to the component (in the location specified
by textLocation).
-
remove(Component)
- Removes the specified component from this container.
-
removeAll()
- Removes all the components from this container.
-
removeNotify()
- Tells this component that it is being removed from a container.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes a listener for all event changes.
-
removeTextLocationListener(PropertyChangeListener)
- Removes a listener for the TextLocation property changes.
-
removeTextLocationListener(VetoableChangeListener)
- Removes a vetoable listener for the TextLocation property changes.
-
removeVetoableChangeListener(VetoableChangeListener)
- Removes a vetoable listener for all event changes.
-
run()
- Standard method in the java.lang.Runnable interface.
-
scrollOneDirection(Point)
- Starts the text scrolling in the current direction, starting from
the point specified by the parameter startingPoint.
-
scrollText()
- Start the text scrolling in or out from the appropriate location.
-
setBounds(int, int, int, int)
- Reshapes the Component to the specified bounding box.
-
setComponent(Component)
- Sets the component in this InfoTipPanel.
-
setFont(Font)
- Sets the font of the component.
-
setHighlightText(boolean)
- Sets the "Highlight Text" property which determines whether the text
will be highlighted with the current textHighlightColor or not.
-
setImageURL(URL)
- Sets the URL of the image to display in this panel.
-
setLayout(LayoutManager)
- Takes no action.
-
setStyle(int)
- Sets the new panel image style.
-
setText(String)
- Sets the text in this InfoTipPanel.
-
setTextColor(Color)
- Sets the text color.
-
setTextDelay(int)
- Set the amount of time (in milliseconds) to wait after a mouse
entered event before the text is scrolled in or popped up.
-
setTextHighlightColor(Color)
- Sets the current highlight color which will be used if highlightText
is true.
-
setTextLocation(int)
- Sets where the text will be located in this InfoTipPanel.
-
setTextScrollsIn(boolean)
- Sets the "Text Scrolls In" property which tells the InfoTipPanel whether
the text should be scrolled in on a mouse over rather than just appearing
next to the component (without scrolling in).
-
startScrolling(int, boolean)
- Starts the text scrolling in the direction indicated by the parameter
newScrollState.
-
stopScrolling()
- Stops the scrolling text animation (if any).
-
storeBackground()
- Utility method for run.
-
updateDirection(Point)
- Utility method for drawNextFrame.
-
validateOffScreenBuffers()
- Utility method of run
This method checks to see whether the off screen images necessary for
the animation already exist, and if so that they are of the correct size.
ABOVE_COMPONENT
public static final int ABOVE_COMPONENT
- Defines the "from top" scroll direction. One of four possible values for textLocation.
BELOW_COMPONENT
public static final int BELOW_COMPONENT
- Defines the "from bottom" scroll direction. One of four possible values for textLocation.
DONE_SCROLLING_IN
protected static final int DONE_SCROLLING_IN
- Defines the "done scrolling in" scroll state. One of four possible values for scrollState.
DONE_SCROLLING_OUT
protected static final int DONE_SCROLLING_OUT
- Defines the "done scrolling out" scroll state. One of four possible values for scrollState.
LEFT_OF_COMPONENT
public static final int LEFT_OF_COMPONENT
- Defines the "from left" scroll direction. One of four possible values for textLocation.
RIGHT_OF_COMPONENT
public static final int RIGHT_OF_COMPONENT
- Defines the "from right" scroll direction. One of four possible values for textLocation.
SCROLLING_IN
protected static final int SCROLLING_IN
- Defines the "scrolling in" scroll state. One of four possible values for scrollState.
SCROLLING_OUT
protected static final int SCROLLING_OUT
- Defines the "scrolling out" scroll state. One of four possible values for scrollState.
WAITING_TO_SCROLL_IN
protected static final int WAITING_TO_SCROLL_IN
- Defines the "waiting to scroll in" scroll state. One of four possible values for scrollState.
bufferedBgndImage
protected transient java.awt.Image bufferedBgndImage
- Off screen buffer used for animation.
callingAddInternally
protected transient boolean callingAddInternally
- Internal flag that indicates a call to add() is being made from within InfoTipPanel.
delayTimer
protected symantec.itools.util.Timer delayTimer
- Timer object which is used to time the delay before popping up the text.
dontDrawText
protected transient boolean dontDrawText
- Internal flag that indicates that the component is NOT to draw the text from within paint().
errors
protected transient java.util.ResourceBundle errors
- Error strings.
extraHighlightHeight
protected int extraHighlightHeight
- Extra height which is added on if highlighText == true
extraHighlightWidth
protected int extraHighlightWidth
- Extra width which is added on if highlighText == true
highlightText
protected boolean highlightText
- boolean property representing whether the text will be drawn transparently
rather than using the specified textHighlightColor.
- See Also:
- setHighlightText, getHighlightText
myComponent
protected java.awt.Component myComponent
- Reference to the component which will be added to the InfoTipPanel and
whose mouse entered and mouse exited events will control the scrolling of the text.
- See Also:
- setComponent, getComponent
myMouseListener
protected symantec.itools.awt.InfoTipPanel. Mouse myMouseListener
- Reference to the Mouse object which is listening to myComponent for mouse events.
offScreenImage
protected transient java.awt.Image offScreenImage
- Off screen buffer used for animation.
text
protected java.lang.String text
- The text which will be scrolled on mouse entered and mouse exited events from myComponent.
- See Also:
- setText, getText
textAnimationThread
protected transient java.lang.Thread textAnimationThread
- The thread which will animate the scrolling text.
textAscent
protected transient int textAscent
- Ascent of current message text.
textColor
protected java.awt.Color textColor
- The color used for text when this component is enabled.
- See Also:
- getTextColor, setTextColor
textDelay
protected int textDelay
- int property which represents how long (in milliseconds) to pause before
starting to scroll/pop-up text on a mouse entered event.
- See Also:
- setTextDelay, getTextDelay
textDescent
protected transient int textDescent
- Descent of current message text.
textHeight
protected transient int textHeight
- Height of current message text.
textHighlightColor
protected java.awt.Color textHighlightColor
- Color which will be used to highlight the text if highlightText flag is set.
- See Also:
- setTextHighlightColor, getTextHighlightColor
textScrollsIn
protected boolean textScrollsIn
- boolean property representing whether the text will be scrolled in from the
edge of the panel on a mouse over, or popped up beside the component.
- See Also:
- setTextScrollsIn, getTextScrollsIn
textWidth
protected transient int textWidth
- Width of current message text.
InfoTipPanel
public InfoTipPanel()
- Constructs a default InfoTipPanel.
The panel is initialized with a null component, RIGHT_OF_COMPONENT as the scrolldirection,
and the Auto-Position property set to true.
InfoTipPanel
public InfoTipPanel(Component component,
String text,
int textLocation,
boolean textScrollsIn,
int textDelay,
boolean highlightText)
- Constructs a new InfoTipPanel initialized with the
specified component, text, minimum height and
minimum width.
- Parameters:
- component - the component which will be added to the InfoTipPanel and
whose mouse entered and mouse exited events will control the scrolling of the text.
- text - the text which will be scrolled.
- textLocation - the direction from which the text is scrolled.
resize itself and position the component placed inside of it.
addImpl
protected void addImpl(Component comp,
Object constraints,
int index)
- Adds the specified component to this container at the specified
index. Also notifies the layout manager to add the component to
the this container's layout using the specified constraints object.
This is the method to override if you want to track every add
request to a container. An overriding method should usually
include a call to super.addImpl(comp, constraints, index).
It is overridden here to set the only
component in this InfoTipPanel. This is the component
that triggers text scrolling on a mouse entered event.
The InfoTipPanel can only contain one component. Any
previous component will be removed before the new one is added.
- Parameters:
- comp - the component to be added
- constraints - an object expressing layout contraints for this
component
- index - the position in the container's list at which to
insert the component. -1 means insert at the end.
- Overrides:
- addImpl in class Container
- See Also:
- remove
addNotify
public synchronized void addNotify()
- Tells this component that it has been added to a container.
This is a standard Java AWT method which gets called by the AWT when
this component is added to a container. Typically, it is used to
create this component's peer.
It has been OVERRIDDEN here to calculate text sizes and to create
any off screen buffers that will be needed for the animation.
- Overrides:
- addNotify in class Panel
- See Also:
- removeNotify
addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a listener for all event changes.
- Parameters:
- listener - the listener to add.
- Overrides:
- addPropertyChangeListener in class ImagePanel
- See Also:
- removePropertyChangeListener
addTextLocationListener
public synchronized void addTextLocationListener(PropertyChangeListener listener)
- Adds a listener for the TextLocation property changes.
- Parameters:
- listener - the listener to add.
- See Also:
- removeTextLocationListener(java.beans.PropertyChangeListener)
addTextLocationListener
public synchronized void addTextLocationListener(VetoableChangeListener listener)
- Adds a vetoable listener for the TextLocation property changes.
- Parameters:
- listener - the listener to add.
- See Also:
- removeTextLocationListener(java.beans.VetoableChangeListener)
addVetoableChangeListener
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
- Adds a vetoable listener for all event changes.
- Parameters:
- listener - the listener to add.
- Overrides:
- addVetoableChangeListener in class ImagePanel
- See Also:
- removeVetoableChangeListener
atOrBeyondPoint
protected boolean atOrBeyondPoint(Point currentLocation,
Point point,
int allowance)
- Utility method for updateDirection, calculateDX, and calculateDY.
If paramter 'allowance' equals zero, this method determines whether or not the text
has scrolled to a position which is at or beyond the point specified in the
parameter 'point' (based on textLocation and scrollState).
For a non-zero 'allowance', this method determines whether or not the text
has scrolled to a position which is either beyond 'point' or within 'allowance'
pixels of 'point' (based on the current textLocation and scrollState).
- Returns:
- whether or not 'currentLocation' is at or beyond 'point' (given 'allowance' pixels of leeway).
calculateDX
protected int calculateDX(Point startingPoint)
- Utility method for drawNextFrame.
Given the current location of the text, this method calculates how far in the
x-direction the text should move when it advances to the next frame of the animation.
- Parameters:
- startingPoint - the current location of the text.
- Returns:
- the distance in the x-direction the text should move when it advances
to the next frame of the animation.
- See Also:
- calculateDY
calculateDY
protected int calculateDY(Point startingPoint)
- Utility method for drawNextFrame.
Given the current location of the text, this method calculates how far in the
y-direction the text should move when it advances to the next frame of the animation.
- Parameters:
- startingPoint - the current location of the text.
- Returns:
- the distance in the y-direction the text should move when it advances
to the next frame of the animation.
- See Also:
- calculateDX
calculateTextAttributes
protected void calculateTextAttributes()
- Utility method.
This method calculates the ascent, descent, height, and width of the current
text, based on the current graphics context.
createOffScreenBuffers
protected void createOffScreenBuffers()
- This method re-creates the off screen images necessary for the text animation.
This method must be called any time that the sizes of these images must be
re-calculated -- it will flush() the old images (if any) and create new images
of the correct size.
drawNextFrame
protected void drawNextFrame(Point startingPoint)
- Does all necessary calculations and graphics work to advance the text one frame
(starting from the point specified in the paramter startingPoint).
statingPoint is modified by this method to be the NEW position of the text (scrolled
one frame further than when the method was called)
- Parameters:
- startingPoint - the current position of the text (before this method advances it
by one animation frame).
drawText
protected void drawText(Graphics g,
int x,
int y)
- Draws the current text into the graphics context and location specified
in the parameters. Highlights the text, if necessary.
- Parameters:
- g - the graphics context into which the text should be drawn
- x - the x-coordinate at which the text should be drawn
- y - the y-coordinate at which the text should be drawn
getAreaAffectedByPopup
protected java.awt.Rectangle getAreaAffectedByPopup()
- Utility method for getBufferedBackgroundBounds.
Calculates the rectangle which bounds the portion of this component's background
which the text will pop-up over.
- Returns:
- this bounding rectangle (or null if there is insufficient space to do the
animation.
getAreaAffectedByScroll
protected java.awt.Rectangle getAreaAffectedByScroll()
- Utility method for getBufferedBackgroundBounds.
Calculates the rectangle which bounds the portion of this component's background
which the text will scroll over.
- Returns:
- this bounding rectangle (or null if there is insufficient space to do the
animation.
getBufferedBackgroundBottomMostY
protected int getBufferedBackgroundBottomMostY()
- Utility method for getBufferedBackgroundBounds.
This method calculates the y-coordinate of the bottom edge of the rectangle
which bounds the portion of this component's background which the text will
animate over.
- Returns:
- this y-coordinate.
- See Also:
- getBufferedBackgroundBounds, getBufferedBackgroundTopMostY, getBufferedBackgroundLeftMostX, getBufferedBackgroundRightMostX
getBufferedBackgroundBounds
protected java.awt.Rectangle getBufferedBackgroundBounds()
- Calculates the rectangle which bounds the portion of this component's background which
the text will animate over.
- Returns:
- this bounding rectangle.
getBufferedBackgroundLeftMostX
protected int getBufferedBackgroundLeftMostX()
- Utility method for getBufferedBackgroundBounds.
This method calculates the x-coordinate of the rectangle which bounds
the portion of this component's background which the text will animate over.
- Returns:
- this x-coordinate.
- See Also:
- getBufferedBackgroundBounds, getBufferedBackgroundTopMostY, getBufferedBackgroundBottomMostY, getBufferedBackgroundRightMostX
getBufferedBackgroundRightMostX
protected int getBufferedBackgroundRightMostX()
- Utility method for getBufferedBackgroundBounds.
This method calculates the x-coordinate of the right edge of the rectangle
which bounds the portion of this component's background which the text will
animate over.
- Returns:
- this x-coordinate.
- See Also:
- getBufferedBackgroundBounds, getBufferedBackgroundTopMostY, getBufferedBackgroundBottomMostY, getBufferedBackgroundLeftMostX
getBufferedBackgroundTopMostY
protected int getBufferedBackgroundTopMostY()
- Utility method for getBufferedBackgroundBounds.
This method calculates the y-coordinate of the rectangle which bounds the portion
of this component's background which the text will animate over.
- Returns:
- this y-coordinate.
- See Also:
- getBufferedBackgroundBounds, getBufferedBackgroundBottomMostY, getBufferedBackgroundLeftMostX, getBufferedBackgroundRightMostX
getComponent
public java.awt.Component getComponent()
- Gets the current component in the InfoTipPanel.
This is the component that triggers text scrolling on a
mouse entered event.
- Returns:
- the current component in the InfoTipPanel
- See Also:
- setComponent
getHighlightBounds
protected java.awt.Rectangle getHighlightBounds(int textX,
int textY)
- Determines the rectangle which bounds the area that should be highlighted.
- Returns:
- this bounding Rectangle, or null if textWidth or textHeight is zero.
getHighlightText
public boolean getHighlightText()
- Gets the current value of the "Highlight Text" property which
determines whether the text will be highlighted with the current
textHighlightColor or not.
- Returns:
- the current value of this property
- See Also:
- setHighlightText, getTextHighlightColor, setTextHighlightColor
getMinimumSize
public java.awt.Dimension getMinimumSize()
- Returns the minimum dimensions to properly display this component.
This is a standard Java AWT method which gets called to determine
the minimum size of this component.
It is OVERRIDDEN here to just return the preferred size as determined
by a call to getPreferredSize()
- Returns:
- A Dimension representing the minimum size of this component
- Overrides:
- getMinimumSize in class Container
- See Also:
- getPreferredSize
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Returns the recommended dimensions to properly display this component.
This is a standard Java AWT method which gets called to determine
the recommended size of this component.
It has been OVERRIDEEN here to, for each axis, return the larger of
the current size and the size of myComponent.
- Returns:
- A Dimension representing the preferred size of this component
- Overrides:
- getPreferredSize in class Container
- See Also:
- getMinimumSize
getText
public java.lang.String getText()
- Gets the current text in this InfoTipPanel. This is the text
which scrolls out on a mouse entered event.
- Returns:
- the text
- See Also:
- setText
getTextColor
public java.awt.Color getTextColor()
- Gets the current text color.
- Returns:
- the current color of the text
- See Also:
- setTextColor
getTextConstantXPos
protected int getTextConstantXPos()
- Utility method for getTextStartingPoint and getTextFinishingPoint.
This method calculates the x-position at which the text should be drawn if
the textLocation is either ABOVE_COMPONENT or BELOW_COMPONENT. Requires
a graphics context to be available.
- Returns:
- the x-position at which the text should be drawn if
the textLocation is either ABOVE_COMPONENT or BELOW_COMPONENT.
- See Also:
- getTextStartingPoint, getTextFinishingPoint
getTextConstantYPos
protected int getTextConstantYPos()
- Utility method for getTextStartingPoint and getTextFinishingPoint.
This method calculates the y-position at which the text should be drawn if
the textLocation is either LEFT_OF_COMPONENT or RIGHT_OF_COMPONENT. Requires
a graphics context to be available.
- Returns:
- the y-position at which the text should be drawn if
the textLocation is either LEFT_OF_COMPONENT or RIGHT_OF_COMPONENT.
- See Also:
- getTextStartingPoint, getTextFinishingPoint
getTextDelay
public int getTextDelay()
- Get the amount of time (in milliseconds) to wait after a mouse
entered event before the text is scrolled in or popped up.
- Returns:
- the amount of time (in milliseconds) that this InfoTipPanel
will wait after a mouse entered event before the text is scrolled in
or popped up.
- See Also:
- setTextDelay
getTextFinishingPoint
protected java.awt.Point getTextFinishingPoint()
- Calculates the point at which the text should be located when the scrolling
animation has scrolled the text all the way in.
- Returns:
- this Point
- See Also:
- getTextStartingPoint
getTextHighlightColor
public java.awt.Color getTextHighlightColor()
- Gets the current highlight color which will be used if highlightText
is true.
- Returns:
- the current highlight color
- See Also:
- setTextHighlightColor, getHighlightText, setHighlightText
getTextLocation
public int getTextLocation()
- Gets the current value of the "Text Location" property for this InfoTipPanel.
The text location controls where the text will appear on a mouse entered event.
- Returns:
- the text location: RIGHT_OF_COMPONENT, LEFT_OF_COMPONENT,
ABOVE_COMPONENT, or BELOW_COMPONENT
- See Also:
- setTextLocation
getTextScrollsIn
public boolean getTextScrollsIn()
- Gets the value of the "Text Scrolls In" property which tells the
InfoTipPanel whether the text should be scrolled in on a mouse over
rather than just appearing next to the component (without scrolling in).
- Returns:
- the current value of this property
- See Also:
- setTextScrollsIn
getTextStartingPoint
protected java.awt.Point getTextStartingPoint()
- Calculates the point at which the text should be located when the scrolling
animation is initiated.
- Returns:
- this Point
- See Also:
- getTextFinishingPoint
isValidTextLocation
protected boolean isValidTextLocation(int i)
- Is the given text location valid.
- Parameters:
- i - the given text location
- Returns:
- true if the given text location is acceptable, false if not.
paint
public void paint(Graphics g)
- Paints this component using the given graphics context.
This is a standard Java AWT method which typically gets called
by the AWT to handle painting this component. It paints this component
using the given graphics context. The graphics context clipping region
is set to the bounding rectangle of this component and its [0,0]
coordinate is this component's top-left corner.
It has been OVERRIDDEN for this container to call super.paint(g), and
then draw it's text, if necessary.
- Parameters:
- g - the graphics context used for painting
- Overrides:
- paint in class ImagePanel
- See Also:
- repaint
popDownText
protected void popDownText()
- Basically just erases the text next to the component (in the location specified
by textLocation).
- See Also:
- popUpText
popUpText
protected void popUpText()
- Draws the text next to the component (in the location specified
by textLocation).
- See Also:
- popDownText
remove
public synchronized void remove(Component comp)
- Removes the specified component from this container.
This is a standard Java AWT method which gets called to remove a
component from a container. When this happens the component's
removeNotify() will also get called to indicate component removal.
It has been OVERRIDDEN here to add remove the listeners which we added
to the component.
- Parameters:
- comp - the component to remove
- Overrides:
- remove in class Container
- See Also:
- removeAll, add
removeAll
public synchronized void removeAll()
- Removes all the components from this container.
This is a standard Java AWT method which gets called to remove all
the components from a container. When this happens each component's
removeNotify() will also get called to indicate component removal.
It has been OVERRIDDEN here to remove the InfoTipPanel's
reference to its component.
- Overrides:
- removeAll in class Container
- See Also:
- remove, add
removeNotify
public synchronized void removeNotify()
- Tells this component that it is being removed from a container.
This is a standard Java AWT method which gets called by the AWT when
this component is removed from a container. Typically, it is used to
destroy the peers of this component and all its subcomponents.
It has been OVERRIDDEN here to dispose of any buffers or any
animation thread in use by this InfoTipPanel, and then
call super.removeNotify().
- Overrides:
- removeNotify in class Container
- See Also:
- addNotify
removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
- Removes a listener for all event changes.
- Parameters:
- listener - the listener to remove.
- Overrides:
- removePropertyChangeListener in class ImagePanel
- See Also:
- addPropertyChangeListener
removeTextLocationListener
public synchronized void removeTextLocationListener(PropertyChangeListener listener)
- Removes a listener for the TextLocation property changes.
- Parameters:
- listener - the listener to remove.
- See Also:
- addTextLocationListener(java.beans.PropertyChangeListener)
removeTextLocationListener
public synchronized void removeTextLocationListener(VetoableChangeListener listener)
- Removes a vetoable listener for the TextLocation property changes.
- Parameters:
- listener - the listener to remove.
- See Also:
- addTextLocationListener(java.beans.VetoableChangeListener)
removeVetoableChangeListener
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
- Removes a vetoable listener for all event changes.
- Parameters:
- listener - the listener to remove.
- Overrides:
- removeVetoableChangeListener in class ImagePanel
- See Also:
- addVetoableChangeListener
run
public void run()
- Standard method in the java.lang.Runnable interface.
When an object implementing interface
Runnable
is used
to create a thread, starting the thread causes the object's
run
method to be called in that separately executing
thread.
Here, run has been implemented to do animate the text scrolling in and out.
The thread calling this method will continue to animate the text until it
scrolls either completely out, or completely in.
- Since:
- JDK1.0
- See Also:
- run
scrollOneDirection
protected java.awt.Point scrollOneDirection(Point startingPoint)
- Starts the text scrolling in the current direction, starting from
the point specified by the parameter startingPoint.
The text will continue to be scrolled until the current direction
changes (due to a mouse event, or due to the text scrolling all
the way in or out).
- Parameters:
- startingPoint - the point from which the text starts scrolling
- Returns:
- the point at which the text stopped scrolling
scrollText
protected void scrollText()
- Start the text scrolling in or out from the appropriate location.
The text will continue to be scrolled back and forth until the text
scrolls all the way in, or all the way out.
setBounds
public void setBounds(int x,
int y,
int width,
int height)
- Reshapes the Component to the specified bounding box.
It has been OVERRIDDEN here to adjust all the animation buffers
to the correct size (based on the new size of the InfoTipPanel)
- Parameters:
- x - the x coordinate
- y - the y coordinate
- width - the width of the component
- height - the height of the component
- Overrides:
- setBounds in class Component
- See Also:
- getBounds, setLocation, setSize
setComponent
public void setComponent(Component comp)
- Sets the component in this InfoTipPanel. This is the component
that triggers text scrolling on a mouse entered event. The InfoTipPanel
can only contain one component. Any previous component will be
removed before the new one is added.
- Parameters:
- comp - the component to add
- See Also:
- getComponent
setFont
public synchronized void setFont(Font f)
- Sets the font of the component.
This is a standard method of java.awt.component.
It has been OVERRIDDEN here to recalculate the sizes/locations
of everything based on the new font.
- Parameters:
- f - the font
- Overrides:
- setFont in class Component
setHighlightText
public void setHighlightText(boolean newValue) throws PropertyVetoException
- Sets the "Highlight Text" property which determines whether the text
will be highlighted with the current textHighlightColor or not.
- Parameters:
- newValue - the new value of this property
- Throws: PropertyVetoException
- if the specified property value is unacceptable
- See Also:
- getHighlightText, getTextHighlightColor, setTextHighlightColor
setImageURL
public void setImageURL(URL url) throws PropertyVetoException
- Sets the URL of the image to display in this panel.
It has been OVERRIDDEN here to suspend the animation thread while the image
is set, and to re-buffer the new background.
- Parameters:
- url - the URL of the image to display
- Throws: PropertyVetoException
- if the specified property value is unacceptable
- Overrides:
- setImageURL in class ImagePanel
- See Also:
- setImageURL, getImageURL
setLayout
public void setLayout(LayoutManager mgr)
- Takes no action.
This is a standard Java AWT method which gets called to specify
which layout manager should be used to layout the components in
standard containers.
Since layout managers CANNOT BE USED with this container the standard
setLayout has been OVERRIDDEN for this container and does nothing.
- Parameters:
- l - the layout manager to use to layout this container's components
(IGNORED)
- Overrides:
- setLayout in class Container
- See Also:
- getLayout
setStyle
public void setStyle(int newStyle) throws PropertyVetoException
- Sets the new panel image style.
It has been OVERRIDDEN here to suspend the animation thread while the style
is set, and to re-buffer the new background.
- Parameters:
- newStyle - the new panel image style, one of
IMAGE_TILED, IMAGE_CENTERED, or IMAGE_SCALED_TO_FIT
- Throws: PropertyVetoException
- if the specified property value is unacceptable
- Overrides:
- setStyle in class ImagePanel
- See Also:
- setStyle, getStyle, IMAGE_TILED, IMAGE_CENTERED, IMAGE_SCALED_TO_FIT
setText
public void setText(String newText) throws PropertyVetoException
- Sets the text in this InfoTipPanel. This is the text
which scrolls out on a mouse entered event.
Causes the component to redraw.
- Parameters:
- newText - the text
- Throws: PropertyVetoException
- if the specified property value is unacceptable
- See Also:
- getText
setTextColor
public void setTextColor(Color color) throws PropertyVetoException
- Sets the text color.
Causes the InfoTipPanel to redraw.
- Parameters:
- color - the new color for the text
- Throws: PropertyVetoException
- if the specified property value is unacceptable
- See Also:
- getTextColor
setTextDelay
public void setTextDelay(int newDelay) throws PropertyVetoException
- Set the amount of time (in milliseconds) to wait after a mouse
entered event before the text is scrolled in or popped up.
- Parameters:
- newDelay - the amount of time (in milliseconds) to wait after a mouse
entered event before the text is scrolled in or popped up.
- Throws: PropertyVetoException
- if the specified property value is unacceptable
- See Also:
- getTextDelay
setTextHighlightColor
public void setTextHighlightColor(Color color) throws PropertyVetoException
- Sets the current highlight color which will be used if highlightText
is true.
- Parameters:
- color - the new highlight color
- Throws: PropertyVetoException
- if the specified property value is unacceptable
- See Also:
- getTextHighlightColor, getHighlightText, setHighlightText
setTextLocation
public void setTextLocation(int newLocation) throws PropertyVetoException
- Sets where the text will be located in this InfoTipPanel. This controls
where the text will appear on a mouse entered event.
Causes the component to redraw.
- Parameters:
- newLocation - the new text location: RIGHT_OF_COMPONENT,
LEFT_OF_COMPONENT, ABOVE_COMPONENT, or BELOW_COMPONENT
- Throws: PropertyVetoException
- if the specified property value is unacceptable
- See Also:
- getTextLocation
setTextScrollsIn
public void setTextScrollsIn(boolean newScroll) throws PropertyVetoException
- Sets the "Text Scrolls In" property which tells the InfoTipPanel whether
the text should be scrolled in on a mouse over rather than just appearing
next to the component (without scrolling in).
- Parameters:
- newScroll - the new value for this property
- Throws: PropertyVetoException
- if the specified property value is unacceptable
- See Also:
- getTextScrollsIn
startScrolling
protected void startScrolling(int newScrollState,
boolean ignoreDelay)
- Starts the text scrolling in the direction indicated by the parameter
newScrollState. The text will continue to be scrolled back and
forth until the text scrolls all the way in, or all the way out.
Causes a thread to be started to animate the text.
This method is also responsible for starting the timer if the textDelay
is set to some number of milliseconds. This method will be called a
second time if and when that timer goes off.
- Parameters:
- newScrollState - the direction of the scroll: SCROLLING_IN,
or SCROLLING_OUT
- ignoreDelay - whether or not to ignore a delay even if it would normally
be necessary (i.e. even though the text is starting to scroll in)
- See Also:
- stopScrolling
stopScrolling
protected void stopScrolling()
- Stops the scrolling text animation (if any). Any subsequent mouse
over events will cause the text to scroll again, as usual.
- See Also:
- startScrolling
storeBackground
protected void storeBackground()
- Utility method for run.
This method stores the background (in this case only the panel's image
since this is a heavyweight component) into bufferedBgndImage.
Only the portion of the background inside of the bounds specified by
getBufferedBackgroundBounds() is saved.
- See Also:
- run
updateDirection
protected void updateDirection(Point currentPoint)
- Utility method for drawNextFrame.
Given the current location of the text, this method determines whether the
scrollState should be set to SCROLLING_IN, SCROLLING_OUT, DONE_SCROLLING_IN, or
DONE_SCROLLING_OUT.
This method actually modifies the 'scrollState' member of this class.
- See Also:
- drawNextFrame
validateOffScreenBuffers
protected boolean validateOffScreenBuffers()
- Utility method of run
This method checks to see whether the off screen images necessary for
the animation already exist, and if so that they are of the correct size.
If the buffers do not exist this method tries to create them.
Due to a bug in some VMs componentResize events may not get sent correctly
so we must also check that the sizes of the buffers are correct.
- Returns:
- a boolean indicating whether or not buffers exist by the end of
this method which are sufficient for the animation.
- See Also:
- run
All Packages Class Hierarchy This Package Previous Next Index