Class PanelGraphics.Creator

java.lang.Object
org.bzdev.swing.PanelGraphics.Creator
All Implemented Interfaces:
GraphicsCreator
Enclosing class:
PanelGraphics

public class PanelGraphics.Creator extends Object implements GraphicsCreator
Off-screen GraphicsCreator. This class is used to store graphics operations that will be applied by an instance of PanelGraphics, replacing any graphics previously displayed. To create an instance of this object, call PanelGraphics.newPanelGraphicsCreator(boolean). One will then call the method createGraphics() to get a graphics context and, after using it to create the graphics, one will call apply() to replace the graphics of the instance of PanelGraphics that created this object. When this object is no longer needed, one should call dispose() to free resources.

The class AnimatedPanelGraphics uses this method, created by calling PanelGraphics.newPanelGraphicsCreator(boolean) with an argument set to true, to create individual animation frames that can be replayed.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Replace graphics contexts and graphics-context tables in the PanelGraphics associated with this object with the graphics contexts and tables encapsulated in this object.
    Create a new graphics context.
    void
    Free any resources used by this object, provided this object was created with a mode whose value is true.
    final int
    Get the repetition count

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • createGraphics

      public Graphics2D createGraphics()
      Create a new graphics context.
      Specified by:
      createGraphics in interface GraphicsCreator
      Returns:
      the new graphics context
    • dispose

      public void dispose()
      Free any resources used by this object, provided this object was created with a mode whose value is true. If this object was created with its mode set to false, the method apply() must be called and that method will free the resources instead. In that case, this method will have no effect.
    • getRepetitionCount

      public final int getRepetitionCount()
      Get the repetition count
      Returns:
      the repetition count
    • apply

      public void apply()
      Replace graphics contexts and graphics-context tables in the PanelGraphics associated with this object with the graphics contexts and tables encapsulated in this object.