net.java.balloontip.positioners
Class CenteredPositioner

java.lang.Object
  extended by net.java.balloontip.positioners.BalloonTipPositioner
      extended by net.java.balloontip.positioners.CenteredPositioner

public class CenteredPositioner
extends BalloonTipPositioner

A positioner that horizontally centers a balloon tip relative to its attached component

Author:
Tim Molderez

Field Summary
protected  float attachLocationY
           
protected  boolean fixedAttachLocation
           
protected  boolean flipY
           
protected  boolean orientationCorrection
           
protected  int preferredVerticalOffset
           
protected  int x
           
protected  int y
           
 
Fields inherited from class net.java.balloontip.positioners.BalloonTipPositioner
balloonTip
 
Constructor Summary
CenteredPositioner(int vO)
          Constructor
 
Method Summary
 void determineAndSetLocation(java.awt.Rectangle attached)
          Determine and set the current location of the balloon tip
protected  void determineLocation(java.awt.Rectangle attached)
           
 void enableFixedAttachLocation(boolean fixedAttachLocation)
          Set whether the tip should have a fixed location
 void enableOrientationCorrection(boolean orientationCorrection)
          Set orientation correction
 float getAttachLocationY()
          Returns the percentage that determines the Y-coordinate of the tip within the attached component (whereas 0.0 is the top and 1.0 is the bottom)
 int getPreferredVerticalOffset()
          Retrieve the preferred vertical offset
 java.awt.Point getTipLocation()
          Find the current location of the balloon's tip, relative to the top-level container
 boolean isFixedAttachLocation()
          Does the tip have a fixed location?
 boolean isOrientationCorrected()
          Is orientation correction enabled?
protected  void onStyleChange()
          This method is called whenever the balloon tip's style changes.
 void setAttachLocation(float attachLocationX, float attachLocationY)
          Set where the tip should be located, relative to the component the balloon is attached to.
 void setPreferredVerticalOffset(int preferredVerticalOffset)
          Set the preferred horizontal offset
 
Methods inherited from class net.java.balloontip.positioners.BalloonTipPositioner
finalize, getBalloonTip, setBalloonTip
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

protected int x

y

protected int y

flipY

protected boolean flipY

preferredVerticalOffset

protected int preferredVerticalOffset

orientationCorrection

protected boolean orientationCorrection

fixedAttachLocation

protected boolean fixedAttachLocation

attachLocationY

protected float attachLocationY
Constructor Detail

CenteredPositioner

public CenteredPositioner(int vO)
Constructor

Parameters:
vO - Preferred vertical offset
Method Detail

getPreferredVerticalOffset

public int getPreferredVerticalOffset()
Retrieve the preferred vertical offset

Returns:
Preferred vertical offset

setPreferredVerticalOffset

public void setPreferredVerticalOffset(int preferredVerticalOffset)
Set the preferred horizontal offset

Parameters:
preferredVerticalOffset -

isOrientationCorrected

public boolean isOrientationCorrected()
Is orientation correction enabled?

Returns:
True if orientation correction is enabled

enableOrientationCorrection

public void enableOrientationCorrection(boolean orientationCorrection)
Set orientation correction

Parameters:
orientationCorrection - enabled if true

isFixedAttachLocation

public boolean isFixedAttachLocation()
Does the tip have a fixed location?

Returns:
True if the balloon has a fixed attaching location

enableFixedAttachLocation

public void enableFixedAttachLocation(boolean fixedAttachLocation)
Set whether the tip should have a fixed location

Parameters:
fixedAttachLocation - the tip has a fixed location if true

getAttachLocationY

public float getAttachLocationY()
Returns the percentage that determines the Y-coordinate of the tip within the attached component (whereas 0.0 is the top and 1.0 is the bottom)

Returns:
The percentage that determines the Y-coordinate of the attaching location

setAttachLocation

public void setAttachLocation(float attachLocationX,
                              float attachLocationY)
Set where the tip should be located, relative to the component the balloon is attached to.

Parameters:
attachLocationY - a number from 0.0 to 1.0 (whereas 0 is the top; 1 is the bottom)

getTipLocation

public java.awt.Point getTipLocation()
Description copied from class: BalloonTipPositioner
Find the current location of the balloon's tip, relative to the top-level container

Specified by:
getTipLocation in class BalloonTipPositioner
Returns:
The location of the tip

determineAndSetLocation

public void determineAndSetLocation(java.awt.Rectangle attached)
Description copied from class: BalloonTipPositioner
Determine and set the current location of the balloon tip

Specified by:
determineAndSetLocation in class BalloonTipPositioner
Parameters:
attached - the balloon tip is attached to this rectangle

determineLocation

protected void determineLocation(java.awt.Rectangle attached)

onStyleChange

protected void onStyleChange()
Description copied from class: BalloonTipPositioner
This method is called whenever the balloon tip's style changes. The positioner will ensure the new style is set up properly.

Specified by:
onStyleChange in class BalloonTipPositioner


http://balloontip.java.net/