|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
net.java.balloontip.BalloonTip
public class BalloonTip
A balloon tip Swing component that is attached to a JComponent and uses another JComponent as contents
Nested Class Summary | |
---|---|
static class |
BalloonTip.AttachLocation
Where should the balloon's tip be located, relative to the attached component ; ALIGNED makes sure the balloon's edge is aligned with the attached component |
static class |
BalloonTip.Orientation
Should the balloon be placed above, below, right or left of the attached component? |
protected class |
BalloonTip.VisibilityControl
|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected javax.swing.JComponent |
attachedComponent
|
protected javax.swing.JButton |
closeButton
|
protected javax.swing.JComponent |
contents
|
protected float |
opacity
|
protected int |
padding
|
protected BalloonTipPositioner |
positioner
|
protected BalloonTipStyle |
style
|
protected javax.swing.JLayeredPane |
topLevelContainer
|
protected net.java.balloontip.BalloonTip.NestedViewportListener |
viewportListener
|
protected BalloonTip.VisibilityControl |
visibilityControl
|
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.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 | |
---|---|
protected |
BalloonTip()
|
|
BalloonTip(javax.swing.JComponent attachedComponent,
javax.swing.JComponent contents,
BalloonTipStyle style,
BalloonTip.Orientation orientation,
BalloonTip.AttachLocation attachLocation,
int horizontalOffset,
int verticalOffset,
boolean useCloseButton)
Constructor |
|
BalloonTip(javax.swing.JComponent attachedComponent,
javax.swing.JComponent contents,
BalloonTipStyle style,
BalloonTipPositioner positioner,
javax.swing.JButton closeButton)
Constructor - the most customizable balloon tip constructor |
|
BalloonTip(javax.swing.JComponent attachedComponent,
javax.swing.JComponent contents,
BalloonTipStyle style,
boolean useCloseButton)
Constructor |
|
BalloonTip(javax.swing.JComponent attachedComponent,
java.lang.String text)
Constructor The simplest constructor, a balloon tip with some text and a default look |
|
BalloonTip(javax.swing.JComponent attachedComponent,
java.lang.String text,
BalloonTipStyle style,
boolean useCloseButton)
Constructor A simple constructor for a balloon tip containing text, a custom look and optionally a close button |
Method Summary | |
---|---|
void |
addDefaultMouseListener(boolean permanentClose)
Adds a mouse listener that will close this balloon tip when clicked. |
void |
closeBalloon()
If you want to permanently close the balloon, you can use this method. |
protected void |
finalize()
|
protected void |
forceSetVisible(boolean visible)
|
javax.swing.JComponent |
getAttachedComponent()
Retrieve the component this balloon tip is attached to |
java.awt.Rectangle |
getAttachedRectangle()
Retrieves the rectangle to which this balloon tip is attached |
javax.swing.JButton |
getCloseButton()
Retrieve this balloon tip's close button |
javax.swing.JComponent |
getContents()
Retrieve this balloon tip's contents |
static javax.swing.JButton |
getDefaultCloseButton()
Creates a default close button (without any behaviour) |
float |
getOpacity()
Get the opacity of this balloon tip |
int |
getPadding()
Get the amount of padding in this balloon tip |
BalloonTipPositioner |
getPositioner()
Retrieve the BalloonTipPositioner that is used by this balloon tip |
BalloonTipStyle |
getStyle()
Get the balloon tip's style |
javax.swing.JLayeredPane |
getTopLevelContainer()
Retrieve the container this balloon tip is drawn on If the balloon tip hasn't determined this container yet, null is returned |
protected boolean |
isAttachedComponentShowing()
|
void |
paintComponent(java.awt.Graphics g)
|
void |
refreshLocation()
Refreshes the balloon tip's location (Is able to update balloon tip's location even if the balloon tip is not shown.) |
void |
setAttachedComponent(javax.swing.JComponent newComponent)
Change the component this balloon tip is attached to (The top-level container will be re-determined during this process; if you set it manually, you'll have to set it again...) |
void |
setCloseButton(javax.swing.JButton button)
Sets this balloon tip's close button (which will call closeBalloon() when clicked) You don't need add any behaviour to the button yourself; this is added for you. |
void |
setCloseButton(javax.swing.JButton button,
boolean permanentClose,
boolean noDefault)
Sets this balloon tip's close button |
void |
setContents(javax.swing.JComponent contents)
Sets the contents of this balloon tip (Calling this method will fire a "contents" property change event.) |
static void |
setDefaultCloseButtonIcons(javax.swing.Icon normal,
javax.swing.Icon pressed,
javax.swing.Icon rollover)
Set the icons for the default close button (This only affects balloon tips created after calling this method.) |
void |
setOpacity(float opacity)
Sets the opacity of this balloon tip and repaints it Note: Setting the opacity to 0 won't make isVisible() return false. |
void |
setPadding(int padding)
Set the amount of padding in this balloon tip (by attaching an empty border to the balloon tip's contents...) |
void |
setPositioner(BalloonTipPositioner positioner)
Set a new BalloonTipPositioner, repsonsible for the balloon tip's positioning (Calling this method will fire a "positioner" property change event.) |
void |
setStyle(BalloonTipStyle style)
Set the balloon tip's style (Calling this method will fire a "style" property change event.) |
void |
setTopLevelContainer(javax.swing.JLayeredPane tlc)
Set the container on which this balloon tip should be drawn |
protected void |
setup(javax.swing.JComponent attachedComponent,
javax.swing.JComponent contents,
BalloonTipStyle style,
BalloonTipPositioner positioner,
javax.swing.JButton closeButton)
|
protected BalloonTipPositioner |
setupPositioner(BalloonTip.Orientation orientation,
BalloonTip.AttachLocation attachLocation,
int horizontalOffset,
int verticalOffset)
|
void |
setVisible(boolean visible)
Set this balloon tip's visibility |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, 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, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, 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, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, 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, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected javax.swing.JComponent contents
protected javax.swing.JButton closeButton
protected BalloonTip.VisibilityControl visibilityControl
protected BalloonTipStyle style
protected int padding
protected float opacity
protected BalloonTipPositioner positioner
protected javax.swing.JLayeredPane topLevelContainer
protected javax.swing.JComponent attachedComponent
protected net.java.balloontip.BalloonTip.NestedViewportListener viewportListener
Constructor Detail |
---|
public BalloonTip(javax.swing.JComponent attachedComponent, java.lang.String text)
attachedComponent
- attach the balloon tip to this component (may not be null)text
- the contents of the balloon tip (may contain HTML)public BalloonTip(javax.swing.JComponent attachedComponent, java.lang.String text, BalloonTipStyle style, boolean useCloseButton)
attachedComponent
- attach the balloon tip to this component (may not be null)text
- the contents of the balloon tip (may contain HTML)style
- the balloon tip's looks (may not be null)useCloseButton
- if true, the balloon tip gets a default close buttonpublic BalloonTip(javax.swing.JComponent attachedComponent, javax.swing.JComponent contents, BalloonTipStyle style, boolean useCloseButton)
attachedComponent
- attach the balloon tip to this component (may not be null)contents
- the balloon tip's contents (may be null)style
- the balloon tip's looks (may not be null)useCloseButton
- if true, the balloon tip gets a close buttonpublic BalloonTip(javax.swing.JComponent attachedComponent, javax.swing.JComponent contents, BalloonTipStyle style, BalloonTip.Orientation orientation, BalloonTip.AttachLocation attachLocation, int horizontalOffset, int verticalOffset, boolean useCloseButton)
attachedComponent
- attach the balloon tip to this component (may not be null)contents
- the balloon tip's contents (may be null)style
- the balloon tip's looks (may not be null)orientation
- orientation of the balloon tipattachLocation
- location of the balloon's tip within the attached componenthorizontalOffset
- horizontal offset for the balloon's tipverticalOffset
- vertical offset for the balloon's tipuseCloseButton
- if true, the balloon tip gets a close buttonpublic BalloonTip(javax.swing.JComponent attachedComponent, javax.swing.JComponent contents, BalloonTipStyle style, BalloonTipPositioner positioner, javax.swing.JButton closeButton)
attachedComponent
- attach the balloon tip to this component (may not be null)contents
- the contents of the balloon tip (may be null)style
- the balloon tip's looks (may not be null)positioner
- determines the way the balloon tip is positioned (may not be null)closeButton
- the close button to be used for the balloon tip (may be null)protected BalloonTip()
Method Detail |
---|
public void setContents(javax.swing.JComponent contents)
contents
- a JComponent that represents the balloon tip's contents
If the contents is null, the balloon tip will not be shownpublic javax.swing.JComponent getContents()
public void setPadding(int padding)
padding
- the amount of padding in pixelspublic int getPadding()
public void setStyle(BalloonTipStyle style)
style
- a BalloonTipStyle (may not be null)public BalloonTipStyle getStyle()
public void setPositioner(BalloonTipPositioner positioner)
positioner
- a BalloonTipPositioner (may not be null)public BalloonTipPositioner getPositioner()
public void closeBalloon()
public void setCloseButton(javax.swing.JButton button)
button
- the new close button; if null, the balloon tip's close button is removed (if it had one)public void setCloseButton(javax.swing.JButton button, boolean permanentClose, boolean noDefault)
button
- the new close button; if null, the balloon tip's close button is removed (if it had one)permanentClose
- if true, the default behaviour of the button is to close the balloon tip permanently by calling closeBalloon()
if false, the default behaviour is to just hide the balloon tip by calling setVisible(false)noDefault
- if true, no default behaviour is added and you'll have to set it yourselfpublic javax.swing.JButton getCloseButton()
public static javax.swing.JButton getDefaultCloseButton()
public static void setDefaultCloseButtonIcons(javax.swing.Icon normal, javax.swing.Icon pressed, javax.swing.Icon rollover)
normal
- regular iconpressed
- icon when clickedrollover
- icon when hovering over the buttonpublic void addDefaultMouseListener(boolean permanentClose)
permanentClose
- if true, the default behaviour is to close the balloon tip permanently by calling closeBalloon()
if false, the default behaviour is to just hide the balloon tip by calling setVisible(false)public void setAttachedComponent(javax.swing.JComponent newComponent)
newComponent
- the new component to attach to (may not be null)
java.lang.NullPointerException
- if parameter newComponent is nullpublic javax.swing.JComponent getAttachedComponent()
public void setTopLevelContainer(javax.swing.JLayeredPane tlc)
tlc
- the top-level container; must be valid (isValid() must return true) ()
(may not be null)public javax.swing.JLayeredPane getTopLevelContainer()
public java.awt.Rectangle getAttachedRectangle()
public void refreshLocation()
public void setOpacity(float opacity)
opacity
- the opacity, where 0.0f is completely invisible and 1.0f is opaquepublic float getOpacity()
public void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
public void setVisible(boolean visible)
setVisible
in class javax.swing.JComponent
visible
- visible if true (and if the listeners associated with this balloon tip have no reason to hide the balloon tip!
For example, it makes no sense to show balloon tip if the component it's attached to is hidden...); invisible otherwiseprotected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
protected void forceSetVisible(boolean visible)
protected boolean isAttachedComponentShowing()
protected BalloonTipPositioner setupPositioner(BalloonTip.Orientation orientation, BalloonTip.AttachLocation attachLocation, int horizontalOffset, int verticalOffset)
protected void setup(javax.swing.JComponent attachedComponent, javax.swing.JComponent contents, BalloonTipStyle style, BalloonTipPositioner positioner, javax.swing.JButton closeButton)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |