Class CompositeTitle

All Implemented Interfaces:
Serializable, Cloneable, Block, Drawable

public class CompositeTitle extends Title implements Cloneable, Serializable
A title that contains multiple titles within a BlockContainer.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For serialization.
      See Also:
    • backgroundPaint

      private transient Paint backgroundPaint
      The background paint.
    • container

      private BlockContainer container
      A container for the individual titles.
  • Constructor Details

    • CompositeTitle

      public CompositeTitle()
      Creates a new composite title with a default border arrangement.
    • CompositeTitle

      public CompositeTitle(BlockContainer container)
      Creates a new title using the specified container.
      Parameters:
      container - the container (null not permitted).
  • Method Details

    • getBackgroundPaint

      public Paint getBackgroundPaint()
      Returns the background paint.
      Returns:
      The paint (possibly null).
    • setBackgroundPaint

      public void setBackgroundPaint(Paint paint)
      Sets the background paint and sends a TitleChangeEvent to all registered listeners. If you set this attribute to null, no background is painted (which makes the title background transparent).
      Parameters:
      paint - the background paint (null permitted).
    • getContainer

      public BlockContainer getContainer()
      Returns the container holding the titles.
      Returns:
      The title container (never null).
    • setTitleContainer

      public void setTitleContainer(BlockContainer container)
      Sets the title container.
      Parameters:
      container - the container (null not permitted).
    • arrange

      public Size2D arrange(Graphics2D g2, RectangleConstraint constraint)
      Arranges the contents of the block, within the given constraints, and returns the block size.
      Specified by:
      arrange in interface Block
      Overrides:
      arrange in class AbstractBlock
      Parameters:
      g2 - the graphics device.
      constraint - the constraint (null not permitted).
      Returns:
      The block size (in Java2D units, never null).
    • draw

      public void draw(Graphics2D g2, Rectangle2D area)
      Draws the title on a Java 2D graphics device (such as the screen or a printer).
      Specified by:
      draw in interface Drawable
      Specified by:
      draw in class Title
      Parameters:
      g2 - the graphics device.
      area - the area allocated for the title.
    • draw

      public Object draw(Graphics2D g2, Rectangle2D area, Object params)
      Draws the block within the specified area.
      Specified by:
      draw in interface Block
      Parameters:
      g2 - the graphics device.
      area - the area.
      params - ignored (null permitted).
      Returns:
      Always null.
    • equals

      public boolean equals(Object obj)
      Tests this title for equality with an arbitrary object.
      Overrides:
      equals in class Title
      Parameters:
      obj - the object (null permitted).
      Returns:
      A boolean.
    • canEqual

      public boolean canEqual(Object other)
      Ensures symmetry between super/subclass implementations of equals. For more detail, see http://jqno.nl/equalsverifier/manual/inheritance.
      Overrides:
      canEqual in class Title
      Parameters:
      other - Object
      Returns:
      true ONLY if the parameter is THIS class type
    • hashCode

      public int hashCode()
      Description copied from class: Title
      Returns a hashcode for the title.
      Overrides:
      hashCode in class Title
      Returns:
      The hashcode.
    • writeObject

      private void writeObject(ObjectOutputStream stream) throws IOException
      Provides serialization support.
      Parameters:
      stream - the output stream.
      Throws:
      IOException - if there is an I/O error.
    • readObject

      private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException
      Provides serialization support.
      Parameters:
      stream - the input stream.
      Throws:
      IOException - if there is an I/O error.
      ClassNotFoundException - if there is a classpath problem.