Package limn.scene

Record Class Insets


public record Insets(float top, float end, float bottom, float start) extends Record
Edge insets in logical points (padding/margins), by the reading direction: start is the side a line of text starts from and end the side it ends at, the left and the right in a layout that reads left to right and the right and the left in one that reads right to left. Every layout and component that takes insets mirrors them that way, so a padding of 40 at the start is on the right of an Arabic form without a second set of insets.

Each side is a finite distance of zero or more. A side that is negative, NaN or infinite is refused where the insets are made, by the side's name, because nothing downstream would refuse it: layout subtracts the insets from its constraints and floors the result at zero, and a NaN survives that floor, so a padding around a NaN side measured NaN by NaN with no error anywhere, and an infinite side left the child no room at all while the padding took all of its parent's.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Insets
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Insets(float top, float end, float bottom, float start)
    Insets of these four sides, in logical points.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Insets
    all(float value)
    The same inset on all four sides.
    float
    Returns the value of the bottom record component.
    float
    end()
    Returns the value of the end record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    float
    Returns the value of the start record component.
    static Insets
    symmetric(float vertical, float horizontal)
    One inset for top and bottom, another for start and end.
    float
    top()
    Returns the value of the top record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • NONE

      public static final Insets NONE
  • Constructor Details

    • Insets

      public Insets(float top, float end, float bottom, float start)
      Insets of these four sides, in logical points.
      Throws:
      IllegalArgumentException - when a side is negative, NaN or infinite, naming the side and its value
  • Method Details

    • all

      public static Insets all(float value)
      The same inset on all four sides.
    • symmetric

      public static Insets symmetric(float vertical, float horizontal)
      One inset for top and bottom, another for start and end.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • top

      public float top()
      Returns the value of the top record component.
      Returns:
      the value of the top record component
    • end

      public float end()
      Returns the value of the end record component.
      Returns:
      the value of the end record component
    • bottom

      public float bottom()
      Returns the value of the bottom record component.
      Returns:
      the value of the bottom record component
    • start

      public float start()
      Returns the value of the start record component.
      Returns:
      the value of the start record component