org.jdesktop.swing.animation.rendering
Class JPassiveRenderer

java.lang.Object
  extended by org.jdesktop.swing.animation.rendering.JPassiveRenderer
All Implemented Interfaces:
org.jdesktop.core.animation.rendering.JRenderer

public class JPassiveRenderer
extends Object
implements org.jdesktop.core.animation.rendering.JRenderer

Manages passive rendering on a Swing JRendererPanel.

To use this renderer a client constructs a JRendererPanel and passes it to the constructor with a JRendererTarget implementation and a timing source. A typical sequence would be

 JFrame frame = new JFrame("Renderer Demonstration");
 final JRendererPanel on = new JRendererPanel();
 frame.setContentPane(on);
 final JRendererTarget<GraphicsConfiguration, Graphics2D> target = this;
 final TimingSource timingSource = new SwingTimerTimingSource();
 JRenderer renderer = new JPassiveRenderer(on, target, timingSource);
 timingSource.init();
 
In the above snippet on will be rendered to. The enclosing instance, this, implements JRendererTarget and will be called to customize what is displayed on-screen.

Author:
Tim Halloran

Constructor Summary
JPassiveRenderer(JRendererPanel on, org.jdesktop.core.animation.rendering.JRendererTarget<GraphicsConfiguration,Graphics2D> target, org.jdesktop.core.animation.timing.TimingSource timingSource)
           
 
Method Summary
 long getAverageCycleTimeNanos()
           
 long getFPS()
           
 org.jdesktop.core.animation.timing.TimingSource getTimingSource()
           
 void invokeLater(Runnable task)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPassiveRenderer

public JPassiveRenderer(JRendererPanel on,
                        org.jdesktop.core.animation.rendering.JRendererTarget<GraphicsConfiguration,Graphics2D> target,
                        org.jdesktop.core.animation.timing.TimingSource timingSource)
Method Detail

invokeLater

public void invokeLater(Runnable task)
Specified by:
invokeLater in interface org.jdesktop.core.animation.rendering.JRenderer

getTimingSource

public org.jdesktop.core.animation.timing.TimingSource getTimingSource()
Specified by:
getTimingSource in interface org.jdesktop.core.animation.rendering.JRenderer

getFPS

public long getFPS()
Specified by:
getFPS in interface org.jdesktop.core.animation.rendering.JRenderer

getAverageCycleTimeNanos

public long getAverageCycleTimeNanos()
Specified by:
getAverageCycleTimeNanos in interface org.jdesktop.core.animation.rendering.JRenderer

shutdown

public void shutdown()
Specified by:
shutdown in interface org.jdesktop.core.animation.rendering.JRenderer


Copyright © 2012. All Rights Reserved.