com.alee.managers.glasspane
Class WebGlassPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.alee.laf.panel.WebPanel
                      extended by com.alee.managers.glasspane.WebGlassPane
All Implemented Interfaces:
PartialDecoration, LanguageContainerMethods, ShapeProvider, Styleable, SizeMethods<WebPanel>, SwingMethods, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class WebGlassPane
extends WebPanel

This is a specified WebLaF glass pane that is used to display custom tooltips, highlights, animations, transitions and other custom stuff atop of all components visible in window/applet. It can also be used to bring your own custom features.

Author:
Mikle Garin
See Also:
GlassPaneManager, Serialized Form

Nested Class Summary
 
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  java.awt.Component highlightBase
          Highlight painting base.
protected  java.util.List<java.awt.Component> highlightedComponents
          Highlighted components.
protected  int highlightSpacing
          Highlight spacing between the component bounds and highlight gray area.
protected  java.awt.Shape hitShape
          WebGlassPane mouse hit shape.
protected  java.lang.String id
          WebGlassPane ID.
protected static java.lang.String ID_PREFIX
          ID prefix.
protected  java.awt.Point imageLocation
          Custom painted image location.
protected  int imageOpacity
          Custom painted image opacity.
protected  java.awt.image.BufferedImage paintedImage
          Custom painted image.
protected  javax.swing.JRootPane rootPane
          JRootPane to which WebGlassPane is attached.
 
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
WebGlassPane(javax.swing.JRootPane rootPane)
          Constructs WebGlassPane for the specified JRootPane.
 
Method Summary
 void addHighlightedComponents(java.awt.Component... components)
          Highlights specified components.
 void addHighlightedComponents(java.util.List<java.awt.Component> components)
          Highlights specified components.
 void addLayoutManager(java.awt.LayoutManager layoutManager)
          Adds layout manager to this glass pane.
 void clearHighlights()
          Remove all highlights.
 void clearPaintedImage()
          Removes painted image.
 boolean contains(int x, int y)
          Returns whether WebGlassPane should absorb mouse event from the specified point or not.
 java.awt.Component getHighlightBase()
          Returns highlight painting base.
 int getHighlightSpacing()
          Returns highlight spacing.
 java.awt.Shape getHitShape()
          Returns custom hit shape that is used to allow mouse events passthrough where it is required.
 java.lang.String getId()
          Returns WebGlassPane ID.
 java.awt.Point getImageLocation()
          Returns painted image location.
 int getImageOpacity()
          Returns painted image opacity.
 MultiLayout getMultiLayout()
          Returns glass pane actual layout.
 java.awt.image.BufferedImage getPaintedImage()
          Returns painted image.
 java.awt.Rectangle getPaintedImageBounds()
          Returns painted image bounds.
 javax.swing.JRootPane getRootPane()
          Returns JRootPane to which this WebGlassPane is attached.
protected  void paintComponent(java.awt.Graphics g)
          Paints WebGlassPane content.
 void removeHighlightedComponents(java.awt.Component... components)
          Removes highlight from the specified components.
 void removeHighlightedComponents(java.util.List<java.awt.Component> components)
          Removes highlight from the specified components.
 void removeLayoutManager(java.awt.LayoutManager layoutManager)
          Removes layout manager to this glass pane.
 void setHighlightBase(java.awt.Component highlightBase)
          Sets highlight painting base.
 void setHighlightSpacing(int spacing)
          Sets highlight spacing.
 void setHitShape(java.awt.Shape hitShape)
          Sets custom hit shape that is used to allow mouse events passthrough where it is required.
 void setPaintedImage(java.awt.image.BufferedImage image, java.awt.Point location)
          Sets painted image at the specified location.
 void setPaintedImage(java.awt.image.BufferedImage image, java.awt.Point location, int opacity)
          Sets painted image at the specified location with the specified opacity.
 void showComponent(javax.swing.JComponent component)
          Displays single component on glass pane.
 
Methods inherited from class com.alee.laf.panel.WebPanel
add, add, add, add, add, add, getBorderColor, getBorderStroke, getDisabledBorderColor, getFirstComponent, getLanguageContainerKey, getLastComponent, getMargin, getMinimumHeight, getMinimumWidth, getPainter, getPreferredHeight, getPreferredSize, getPreferredWidth, getRound, getShadeTransparency, getShadeWidth, getStyleId, getWebUI, isPaintBackground, isPaintBottom, isPaintBottomLine, isPaintFocus, isPaintLeft, isPaintLeftLine, isPaintRight, isPaintRightLine, isPaintTop, isPaintTopLine, isUndecorated, isWebColoredBackground, provideShape, removeLanguageContainerKey, setBorderColor, setBorderStroke, setDisabledBorderColor, setLanguageContainerKey, setMargin, setMargin, setMargin, setMinimumHeight, setMinimumWidth, setPaintBackground, setPaintBottom, setPaintBottomLine, setPainter, setPaintFocus, setPaintLeft, setPaintLeftLine, setPaintRight, setPaintRightLine, setPaintSideLines, setPaintSides, setPaintTop, setPaintTopLine, setPreferredHeight, setPreferredWidth, setRound, setShadeTransparency, setShadeWidth, setStyleId, setUndecorated, setWebColoredBackground, updateUI
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, 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, getRegisteredKeyStrokes, 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, setVisible, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ID_PREFIX

protected static final java.lang.String ID_PREFIX
ID prefix.

See Also:
Constant Field Values

id

protected java.lang.String id
WebGlassPane ID.


rootPane

protected javax.swing.JRootPane rootPane
JRootPane to which WebGlassPane is attached.


hitShape

protected java.awt.Shape hitShape
WebGlassPane mouse hit shape.


paintedImage

protected java.awt.image.BufferedImage paintedImage
Custom painted image.


imageLocation

protected java.awt.Point imageLocation
Custom painted image location.


imageOpacity

protected int imageOpacity
Custom painted image opacity.


highlightedComponents

protected java.util.List<java.awt.Component> highlightedComponents
Highlighted components.


highlightBase

protected java.awt.Component highlightBase
Highlight painting base.


highlightSpacing

protected int highlightSpacing
Highlight spacing between the component bounds and highlight gray area.

Constructor Detail

WebGlassPane

public WebGlassPane(javax.swing.JRootPane rootPane)
Constructs WebGlassPane for the specified JRootPane.

Parameters:
rootPane - JRootPane to process
Method Detail

getMultiLayout

public MultiLayout getMultiLayout()
Returns glass pane actual layout.

Returns:
glass pane actual layout

addLayoutManager

public void addLayoutManager(java.awt.LayoutManager layoutManager)
Adds layout manager to this glass pane.

Parameters:
layoutManager - layout manager to add

removeLayoutManager

public void removeLayoutManager(java.awt.LayoutManager layoutManager)
Removes layout manager to this glass pane.

Parameters:
layoutManager - layout manager to remove

getId

public java.lang.String getId()
Returns WebGlassPane ID.

Returns:
WebGlassPane ID

getRootPane

public javax.swing.JRootPane getRootPane()
Returns JRootPane to which this WebGlassPane is attached.

Overrides:
getRootPane in class javax.swing.JComponent
Returns:
JRootPane to which this WebGlassPane is attached

showComponent

public void showComponent(javax.swing.JComponent component)
Displays single component on glass pane.

Parameters:
component - component to display

contains

public boolean contains(int x,
                        int y)
Returns whether WebGlassPane should absorb mouse event from the specified point or not. Custom hit shape is used to allow mouse events passthrough where it is required.

Overrides:
contains in class javax.swing.JComponent
Parameters:
x - mouse X coordinate
y - mouse Y coordinate
Returns:
true if WebGlassPane should absorb mouse event from the specified point, false otherwise

getHitShape

public java.awt.Shape getHitShape()
Returns custom hit shape that is used to allow mouse events passthrough where it is required.

Returns:
custom hit shape that is used to allow mouse events passthrough where it is required

setHitShape

public void setHitShape(java.awt.Shape hitShape)
Sets custom hit shape that is used to allow mouse events passthrough where it is required.

Parameters:
hitShape - custom hit shape that is used to allow mouse events passthrough where it is required

getImageOpacity

public int getImageOpacity()
Returns painted image opacity.

Returns:
painted image opacity

getImageLocation

public java.awt.Point getImageLocation()
Returns painted image location.

Returns:
painted image location

getPaintedImage

public java.awt.image.BufferedImage getPaintedImage()
Returns painted image.

Returns:
painted image

setPaintedImage

public void setPaintedImage(java.awt.image.BufferedImage image,
                            java.awt.Point location)
Sets painted image at the specified location.

Parameters:
image - image to paint
location - image location

setPaintedImage

public void setPaintedImage(java.awt.image.BufferedImage image,
                            java.awt.Point location,
                            int opacity)
Sets painted image at the specified location with the specified opacity.

Parameters:
image - image to paint
location - image location
opacity - image opacity

clearPaintedImage

public void clearPaintedImage()
Removes painted image.


getPaintedImageBounds

public java.awt.Rectangle getPaintedImageBounds()
Returns painted image bounds.

Returns:
painted image bounds

addHighlightedComponents

public void addHighlightedComponents(java.awt.Component... components)
Highlights specified components.

Parameters:
components - components to highlight

addHighlightedComponents

public void addHighlightedComponents(java.util.List<java.awt.Component> components)
Highlights specified components.

Parameters:
components - components to highlight

removeHighlightedComponents

public void removeHighlightedComponents(java.awt.Component... components)
Removes highlight from the specified components.

Parameters:
components - components to remove highlight from

removeHighlightedComponents

public void removeHighlightedComponents(java.util.List<java.awt.Component> components)
Removes highlight from the specified components.

Parameters:
components - components to remove highlight from

clearHighlights

public void clearHighlights()
Remove all highlights.


getHighlightBase

public java.awt.Component getHighlightBase()
Returns highlight painting base.

Returns:
highlight painting base

setHighlightBase

public void setHighlightBase(java.awt.Component highlightBase)
Sets highlight painting base.

Parameters:
highlightBase - highlight painting base

getHighlightSpacing

public int getHighlightSpacing()
Returns highlight spacing.

Returns:
highlight spacing

setHighlightSpacing

public void setHighlightSpacing(int spacing)
Sets highlight spacing.

Parameters:
spacing - highlight spacing

paintComponent

protected void paintComponent(java.awt.Graphics g)
Paints WebGlassPane content.

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
g - graphics context.