Window

An operating-system window. Create one with the Window factory and close it when done.

Samples live in the sandbox because they need a display.

Properties

Link copied to clipboard

Whether the mouse cursor is drawn while it is over the window. Starts as CursorMode.VISIBLE.

Link copied to clipboard
val height: Int

Height of the client area in points.

Link copied to clipboard

How the window takes up the screen. Setting it switches between a normal window and borderless fullscreen on the display that holds the window.

Link copied to clipboard

Number of pixels per point along each axis: 2 on a Retina display, 1 on a standard one.

Link copied to clipboard

Height of the drawable area in pixels.

Link copied to clipboard

Width of the drawable area in pixels, which exceeds the point size on high-density displays.

Link copied to clipboard
val width: Int

Width of the client area in points, the logical unit the window was created with. On a high-density display one point covers several pixels; see pixelDensity.

Functions

Link copied to clipboard
fun capture(path: String)

Queues a capture of the next frame drawn for this window and saves it to path as a PNG file with four 8-bit channels, every pixel opaque. A relative path resolves against Files.basePath; a missing directory on the way to the file is created when it is written, as Files.writeBytes does.

Link copied to clipboard
open override fun close()

Destroys the window and frees the image cursor of setCursor. Using it afterwards is an error.

Link copied to clipboard

Goes back to the system arrow after setCursor and frees the image cursor. Does nothing when no image cursor is set. cursor still decides whether the arrow is drawn.

Link copied to clipboard
fun setCursor(image: Image, hotspotX: Int, hotspotY: Int)

Replaces the cursor with image while it is over the window, with the pixel at column hotspotX and row hotspotY of the image marking the point that clicks land on. The cursor keeps its own copy of the pixels, so later changes to image do not reach it.

Link copied to clipboard
open override fun toString(): String