com.levigo.util.swing
Class FadeablePane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.levigo.util.swing.FadeablePane
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
FadeBox

public class FadeablePane
extends JComponent

Document me.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String ANIMATION_STATE_KEY
          Used when generating PropertyChangeEvents for the "animationState" property
 
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
FadeablePane()
          Constructs a new JCollapsiblePane with a JPanel as content pane and a vertical with a gap of 2 pixels as layout manager.
FadeablePane(JComponent contentPane)
          Constructs a new JCollapsiblePane with a JPanel as content pane and a vertical with a gap of 2 pixels as layout manager.
 
Method Summary
protected  void addImpl(Component comp, Object constraints, int index)
           
protected  void configureGraphics(Graphics2D dst, Graphics2D src)
           
protected  BufferedImage createBuffer(int width, int height)
          Creates the BufferedImage to be used as the cached image.
 void doLayout()
           
protected  void fadeCompleted()
          Subclasses may override this method in order to perform some action after a fade-in or fade-out animation completed.
protected  void fadeStarted()
          Subclasses may override this method in order to perform some action before a fade-in or fade-out animation starts.
 float getAlpha()
           
 int getAnimationFPS()
           
 int getAnimationSteps()
           
 Border getBorder()
           
protected  BufferedImage getBuffer()
          Returns the current cached image.
 Container getContentPanel()
           
 Insets getInsets()
           
 Insets getInsets(Insets insets)
           
 Dimension getMinimumSize()
           
 Dimension getPreferredSize()
           
protected  boolean isBufferFormatValid(BufferedImage buffer)
          Defines if the cached image has the valid format for the current painting painting operation and there is no need to recreate it.
 void paint(Graphics g)
           
protected  void paintBorder(Graphics g)
           
 void remove(Component comp)
           
 void remove(int index)
           
 void removeAll()
           
 void setAlpha(float alpha)
          Set the global transparency of this fadeable pane.
 void setAlphaImmediate(float alpha)
          Set the global transparency of this fadable pane without animation.
 void setAnimationFPS(int animationFPS)
           
 void setAnimationSteps(int animationSteps)
           
 void setBorder(Border border)
           
protected  void setBuffer(BufferedImage buffer)
          Sets the current cached image.
 void setContentPane(JComponent contentPanel)
          Sets the content pane of this JCollapsiblePane.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, 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

ANIMATION_STATE_KEY

public static final String ANIMATION_STATE_KEY
Used when generating PropertyChangeEvents for the "animationState" property

See Also:
Constant Field Values
Constructor Detail

FadeablePane

@CallOnEDT
public FadeablePane(JComponent contentPane)
Constructs a new JCollapsiblePane with a JPanel as content pane and a vertical with a gap of 2 pixels as layout manager.


FadeablePane

@CallOnEDT
public FadeablePane()
Constructs a new JCollapsiblePane with a JPanel as content pane and a vertical with a gap of 2 pixels as layout manager.

Method Detail

addImpl

protected void addImpl(Component comp,
                       Object constraints,
                       int index)
Overrides:
addImpl in class Container

setContentPane

@CallOnEDT
public void setContentPane(JComponent contentPanel)
Sets the content pane of this JCollapsiblePane. Components must be added to this content pane, not to the JCollapsiblePane.

Parameters:
contentPanel -
Throws:
IllegalArgumentException - if contentPanel is null

remove

@CallOnEDT
public void remove(Component comp)
Overrides:
remove in class Container

remove

@CallOnEDT
public void remove(int index)
Overrides:
remove in class Container

removeAll

@CallOnEDT
public void removeAll()
Overrides:
removeAll in class Container

getContentPanel

@CallOnEDT
public Container getContentPanel()
Returns:
the content pane

setAlpha

@CallOnEDT
public void setAlpha(float alpha)
Set the global transparency of this fadeable pane.


getAlpha

@CallOnEDT
public float getAlpha()

setAlphaImmediate

@CallOnEDT
public void setAlphaImmediate(float alpha)
Set the global transparency of this fadable pane without animation.


fadeStarted

protected void fadeStarted()
Subclasses may override this method in order to perform some action before a fade-in or fade-out animation starts.


fadeCompleted

protected void fadeCompleted()
Subclasses may override this method in order to perform some action after a fade-in or fade-out animation completed.


getMinimumSize

@CallOnEDT
public Dimension getMinimumSize()
Overrides:
getMinimumSize in class JComponent

getAnimationSteps

@CallOnEDT
public int getAnimationSteps()
Returns:
the animationSteps

setAnimationSteps

@CallOnEDT
public void setAnimationSteps(int animationSteps)
Parameters:
animationSteps - the animationSteps to set

getAnimationFPS

@CallOnEDT
public int getAnimationFPS()
Returns:
the animationFPS

setAnimationFPS

@CallOnEDT
public void setAnimationFPS(int animationFPS)
Parameters:
animationFPS - the animationFPS to set

paint

@CallOnEDT
public void paint(Graphics g)
Overrides:
paint in class JComponent

doLayout

@CallOnEDT
public void doLayout()
Overrides:
doLayout in class Container

getPreferredSize

@CallOnEDT
public Dimension getPreferredSize()
Overrides:
getPreferredSize in class JComponent

getInsets

@CallOnEDT
public Insets getInsets(Insets insets)
Overrides:
getInsets in class JComponent

getInsets

@CallOnEDT
public Insets getInsets()
Overrides:
getInsets in class JComponent

setBorder

@CallOnEDT
public void setBorder(Border border)
Overrides:
setBorder in class JComponent

paintBorder

protected void paintBorder(Graphics g)
Overrides:
paintBorder in class JComponent

getBorder

@CallOnEDT
public Border getBorder()
Overrides:
getBorder in class JComponent

configureGraphics

protected void configureGraphics(Graphics2D dst,
                                 Graphics2D src)

createBuffer

protected BufferedImage createBuffer(int width,
                                     int height)
Creates the BufferedImage to be used as the cached image. This method must never return null.

Parameters:
width - the width of the image
height - the height of the image
Returns:
an off-screen BufferedImage, which can be used for double buffering.

getBuffer

protected BufferedImage getBuffer()
Returns the current cached image.

The implementation of this LayerUI may use SoftReference to keep this image, so this method may return null at any time.

Returns:
the current cached image.
See Also:
setBuffer(BufferedImage)

isBufferFormatValid

protected boolean isBufferFormatValid(BufferedImage buffer)
Defines if the cached image has the valid format for the current painting painting operation and there is no need to recreate it.

The default implementation returns true if the cached image is not null and its size matches the size of the JXLayer being painted, otherwise it returns true.

Parameters:
buffer - the image to validate
Returns:
true if the format of existing cache image is valid, otherwise returns false
See Also:
getBuffer()

setBuffer

protected void setBuffer(BufferedImage buffer)
Sets the current cached image.

Parameters:
buffer - the BufferedImage to be used as the cache
See Also:
getBuffer()


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.