Border

interface Border

A drawn border, around a Region.

Unlike JavaFX, Border is an interface with many implementations. NoBorder (the default) and PlainBorder are the simplest.

(x,y)
  ┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐   ▲  ▲
  ┊  the drawn region ┊   ┊  ┆ size.top
  ┊     ┏━━━━━━━━━┓   ┊   ┊  ▼
  ┊     ┃   Not   ┃   ┊   ┊
  ┊     ┃  drawn  ┃   ┊   ┊height
  ┊     ┃         ┃   ┊   ┊
  ┊     ┗━━━━━━━━━┛   ┊   ┊  ▲
  ┊                   ┊   ┊  ┆ size.bottom
  └┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘   ▼  ▼

  ◀┄┄┄┄┄┄┄┄width┄┄┄┄┄┄▶
  ◀┄┄┄┄┄▶         ◀┄┄┄▶
  size.left       size.right

The dashed outer rectangle is the node's bounds. In general, Borders should only draw within the region between the two rectangles.

This diagram doesn't include a Node's padding, as this isn't relevant to its border.

A border is often the same width on all sides, but in this diagram, size.left is larger than the other side(s). (For me, top and bottom appear the same as right, but may depend on the font being used).

Inheritors

Functions

Link copied to clipboard
abstract fun draw(x: Float, y: Float, width: Float, height: Float, color: Color, size: Edges)

Draw a border inside the rectangle defined by x,y, width and height. The thickness of the border is given by size.