Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

oracle.javatools.ui.balloon
Class BalloonManager

java.lang.Object
  extended by oracle.javatools.ui.balloon.BalloonManager

public final class BalloonManager
extends java.lang.Object

Manages showing and hiding Balloons. Balloons are associated with some target component. You can obtain the BalloonManager instance for a given component using the forTarget(JComponent) method.

Balloons are added to the layered pane of the JFrame or JDialog containing the target component when you call show(Balloon,int). The BalloonManager will track the motion of the target component and ensure that the Balloon continues to point at it.

The BalloonManager will clean up (remove the balloon from the layered pane, and deregister listeners) when the target component is removed from its container or hidden. However, if you are hiding a dialog or frame containing a target component, you should take care to clean up the balloon manager for any visible balloons via hide(Balloon).

Thread Safety: This class is not thread safe. It should be used only from the AWT event dispatch thread.

Since:
11.1.1.0.0

Field Summary
static int TTL_ACTION_FAILURE
          Recommended time to live for a balloon showing notification of a failed action.
static int TTL_ACTION_SUCCESS
          Recommended time to live for a balloon showing notification of a successful action.
static int TTL_OPTIONAL_USER_TASK
          Recommended time to live for a balloon showing notification of an optional user task.
 
Method Summary
 Balloon balloon()
          Returns the balloon this manager is tracking.
static BalloonManager forTarget(javax.swing.JComponent target)
          Gets a BalloonManager for the specified target component.
 void hide(Balloon balloon)
          Hides a balloon and cleans up all references.
 void show(Balloon balloon)
          Shows a Balloon pointing to a specified target component.
 void show(Balloon balloon, int timeToLive)
          Shows a balloon pointing to a specified target component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TTL_ACTION_SUCCESS

public static final int TTL_ACTION_SUCCESS
Recommended time to live for a balloon showing notification of a successful action.

See Also:
Constant Field Values

TTL_ACTION_FAILURE

public static final int TTL_ACTION_FAILURE
Recommended time to live for a balloon showing notification of a failed action.

See Also:
Constant Field Values

TTL_OPTIONAL_USER_TASK

public static final int TTL_OPTIONAL_USER_TASK
Recommended time to live for a balloon showing notification of an optional user task.

See Also:
Constant Field Values
Method Detail

forTarget

public static BalloonManager forTarget(javax.swing.JComponent target)
Gets a BalloonManager for the specified target component. This method will create a new BalloonManager if necessary, or will return an existing registered manager for the specified component.

Parameters:
target - a target component.
Returns:
a balloon manager for the specified target component.
Throws:
java.lang.NullPointerException - if target is null.

balloon

public Balloon balloon()
Returns the balloon this manager is tracking.

Returns:
the balloon being shown for the specified target component, or null if no balloon is currently showing for the target component.

show

public void show(Balloon balloon,
                 int timeToLive)
Shows a balloon pointing to a specified target component. The target component must be visible, and it must have a JFrame or JDialog in its component hierarchy.

You can specify how long the balloon should remain on screen. After the specified period elapses, the balloon will be closed automatically.

Parameters:
balloon - the balloon component to show.
timeToLive - time in milliseconds the balloon should remain visible. After this period of time elapses, the balloon will be removed. A number of standard values for this parameter are defined as static constants.
Throws:
java.lang.IllegalArgumentException - if timeToLive is less than zero.
java.lang.NullPointerException - if balloon is null.
java.lang.IllegalStateException - if the targetComponent is not visible, or the targetComponent is not inside a JDialog or JFrame.

show

public void show(Balloon balloon)
Shows a Balloon pointing to a specified target component. The target component must be visible, and it must have a JFrame or JDialog in its component hierarchy.

It is strongly recommended that clients use the show(Balloon,int) method with one of the TTL_ constants declared on this class. This ensures that Balloons are dismissed after a suitable period of time automatically.

Parameters:
balloon - the balloon component to show.
Throws:
{@link - NullPointerException} if parameters are null.
{@link - NullPointerException} if The target is not a JFrame or JDialog, is not visible, or already contains a Balloon.

hide

public void hide(Balloon balloon)
Hides a balloon and cleans up all references.

Parameters:
balloon - a balloon to hide.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

Copyright © 1997, 2009, Oracle. All rights reserved.