org.jdesktop.jxlayer.plaf.ext
Class DebugRepaintingUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by org.jdesktop.jxlayer.plaf.LayerUI<V>
          extended by org.jdesktop.jxlayer.plaf.AbstractLayerUI<V>
              extended by org.jdesktop.jxlayer.plaf.AbstractBufferedLayerUI<javax.swing.JComponent>
                  extended by org.jdesktop.jxlayer.plaf.ext.DebugRepaintingUI
All Implemented Interfaces:
java.awt.event.ActionListener, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener

public class DebugRepaintingUI
extends AbstractBufferedLayerUI<javax.swing.JComponent>
implements java.awt.event.ActionListener

The DebugRepaintingUI provides a visual indication of repainting JXLayers subcomponents.

With this tool you can examine your GUI and eliminate unnecessary painting, moreover it is useful just to see how Swing paints the core components:
- What part of a JTree is repainted when you open a node?
- What is repainted when you open a popup?

DebugRepaintingUI will help you to speed up the painting of your custom components.

Here is an example of using DebugRepaintingUI:

  JComponent myComponent = getMyComponent(); // just any component
 

DebugRepaintingUI<JComponent> debugUI = new DebugRepaintingUI(); JXLayer<JComponent> layer = new JXLayer<JComponent>(myComponent, debugUI);

// add the layer to a frame or a panel, like any other component frame.add(layer);

The DebugRepaintingDemo is available

See Also:
Serialized Form

Constructor Summary
DebugRepaintingUI()
          Creates a new DebugRepaintingUI with 50 milliseconds set for the animation timer between-event delay.
DebugRepaintingUI(int delay)
          Creates a new DebugRepaintingUI with the specified time set for the animation timer between-event delay.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
protected  void paintLayer(java.awt.Graphics2D g2, JXLayer<? extends javax.swing.JComponent> l)
          Subclasses should implement this method and perform custom painting operations here.

This method is overridden to provide a specific repainting indication.

 
Methods inherited from class org.jdesktop.jxlayer.plaf.AbstractBufferedLayerUI
applyLayerEffects, createBuffer, getBuffer, getLayer, getLayerEffects, installUI, isBufferContentValid, isBufferFormatValid, isIncrementalUpdate, paint, propertyChange, setBuffer, uninstallUI, updateUI
 
Methods inherited from class org.jdesktop.jxlayer.plaf.AbstractLayerUI
configureGraphics, eventDispatched, getClip, getComposite, getLayerEventMask, getRenderingHints, getTransform, handlePropertyChangeEvent, isDirty, processFocusEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, setDirty
 
Methods inherited from class org.jdesktop.jxlayer.plaf.LayerUI
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, getPreferredScrollableViewportSize, getPropertyChangeListeners, getPropertyChangeListeners, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DebugRepaintingUI

public DebugRepaintingUI()
Creates a new DebugRepaintingUI with 50 milliseconds set for the animation timer between-event delay.


DebugRepaintingUI

public DebugRepaintingUI(int delay)
Creates a new DebugRepaintingUI with the specified time set for the animation timer between-event delay.

Parameters:
delay - the between-event delay for the animation timer animation
Method Detail

paintLayer

protected void paintLayer(java.awt.Graphics2D g2,
                          JXLayer<? extends javax.swing.JComponent> l)
Subclasses should implement this method and perform custom painting operations here.

The default implementation paints the passed JXLayer as is.

This method is overridden to provide a specific repainting indication.

Overrides:
paintLayer in class AbstractLayerUI<javax.swing.JComponent>
Parameters:
g2 - the Graphics2D context in which to paint
l - the JXLayer being painted

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener