Class PainterChain

java.lang.Object
com.codename1.ui.painter.PainterChain
All Implemented Interfaces:
Painter

public class PainterChain extends Object implements Painter
A painter chain allows us to chain together several painters to provide a "layer" effect where each painter only draws one element.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new painter chain which will paint all of the elements in the chain in sequence from 0 to the last element
    Create a new painter chain which will paint all of the elements in the chain in sequence from 0 to the last element
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a new chain based on the existing chain with the new element added at the end
    Allows us to traverse the painter chain
    static void
    Installs a glass pane on the given form making sure to make it a painter chain only if required by existing painter
    void
    Draws inside the given rectangle clipping area.
    Creates a new chain based on the existing chain with the new element added at the beginning
    static void
    Removes a glass pane from the given form, this is the opposite operation for the install glass pane

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
     
    boolean
    Indicates whether some other object is "equal to" this one.
    final Class
    Returns the runtime class of an object.
    int
    Returns a hash code value for the object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    Returns a string representation of the object.
    final void
    Causes current thread to wait until another thread invokes the method or the method for this object.
    final void
    wait(long timeout)
    Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
    final void
    wait(long timeout, int nanos)
    Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
  • Constructor Details

    • PainterChain

      public PainterChain(Painter[] chain)

      Create a new painter chain which will paint all of the elements in the chain in sequence from 0 to the last element

      Parameters
      • chain: the chain of components in the painter
    • PainterChain

      public PainterChain(Painter painter)

      Create a new painter chain which will paint all of the elements in the chain in sequence from 0 to the last element

      Parameters
      • painter: the chain first Painter
  • Method Details

    • installGlassPane

      public static void installGlassPane(Form f, Painter p)

      Installs a glass pane on the given form making sure to make it a painter chain only if required by existing painter

      Parameters
      • f: form on which to install the chain

      • p: painter to install

    • removeGlassPane

      public static void removeGlassPane(Form f, Painter p)

      Removes a glass pane from the given form, this is the opposite operation for the install glass pane

      Parameters
      • f: form from which to remove the chain

      • p: painter to remove

    • addPainter

      public PainterChain addPainter(Painter p)

      Creates a new chain based on the existing chain with the new element added at the end

      Parameters
      • p: new painter
      Returns

      new chain element

    • prependPainter

      public PainterChain prependPainter(Painter p)

      Creates a new chain based on the existing chain with the new element added at the beginning

      Parameters
      • p: new painter
      Returns

      new chain element

    • paint

      public void paint(Graphics g, Rectangle rect)

      Draws inside the given rectangle clipping area.

      Parameters
      • g: the Graphics object

      • rect: the given rectangle cliping area

      Specified by:
      paint in interface Painter
    • getChain

      public Painter[] getChain()

      Allows us to traverse the painter chain

      Returns

      the internal painter chain