Package-level declarations

Custom or specialized UI components.

Types

Link copied to clipboard
class JDateTimeField(val default: Timestamp = Timestamp("1970")) : JFormattedTextField

A JFormattedTextField for Timestamps.

Link copied to clipboard
class JDoubleSpinner(value: Double = 0.0, minValue: Double? = null, maxValue: Double? = null, stepSize: Double = 0.1) : JNumberSpinner<Double>

A JNumberSpinner for doubles.

Link copied to clipboard
class JIntSpinner(value: Int = 0, minValue: Int = Int.MIN_VALUE, maxValue: Int = Int.MAX_VALUE, stepSize: Int = 1) : JNumberSpinner<Int>

A JNumberSpinner for integers.

Link copied to clipboard
class JLongSpinner(value: Long = 0, minValue: Long = Long.MIN_VALUE, maxValue: Long = Long.MAX_VALUE, stepSize: Long = 1) : JNumberSpinner<Long>

A JNumberSpinner for longs.

Link copied to clipboard
abstract class JNumberSpinner<T : Number, Comparable<T>>(value: T, minValue: T?, maxValue: T?, stepSize: T) : JSpinner

An abstract JSpinner for numbers that contains common logic for its subclasses.

Link copied to clipboard
open class MaxLengthDocumentFilter(val maxLength: Int) : DocumentFilter

A document filter that ensures the document always contains at most maxLength characters.

Link copied to clipboard
class MinMaxLengthDocumentFilter(val minLength: Int, maxLength: Int) : MaxLengthDocumentFilter

Similar to MaxLengthDocumentFilter, but the length cannot go below minLength either.

Link copied to clipboard
class PreviewPanel(val getScheme: () -> Scheme) : Disposable

A panel that shows a preview of the values generated by a scheme.

Link copied to clipboard
class SimpleDocumentListener(val listener: (DocumentEvent) -> Unit) : DocumentListener

A DocumentListener that invokes listener on each event.

Link copied to clipboard
class SimpleJBDocumentListener(val listener: (DocumentEvent) -> Unit) : DocumentListener

A JBDocumentListener that invokes listener on each event.

Link copied to clipboard
class SimpleTreeModelListener(val listener: (TreeModelEvent) -> Unit) : TreeModelListener

A TreeModelListener that invokes listener on each event.

Link copied to clipboard

Holds constants for UI elements.

Link copied to clipboard
data class ValidationInfo(val state: State, val property: KProperty<*>, val message: String)

Information that indicates a failed validation.

Link copied to clipboard
class Validator<T>(val property: KProperty<T>, validate: (T) -> ValidationInfo?)

Associates a property with a method that validates that property.

Link copied to clipboard
class ValidatorDsl(val state: State)

A domain-specific language (DSL) for creating Validators on a State object.

Functions

Link copied to clipboard
fun addChangeListenerTo(vararg components: Any, listener: () -> Unit)

Adds listener to each of components.

Link copied to clipboard
fun Cell<ComboBox<String>>.bindCurrentText(property: KMutableProperty0<String>): Cell<ComboBox<String>>

Binds the current possibly-non-committed value of the ComboBox in this Cell to property.

Link copied to clipboard
fun bindDateTimes(minField: JDateTimeField, maxField: JDateTimeField)

Binds two JDateTimeFields together, analogous to how com.fwdekker.randomness.ui.bindSpinners works.

Link copied to clipboard
fun Cell<JIntSpinner>.bindIntValue(property: KMutableProperty0<Int>): Cell<JIntSpinner>

Binds the value of the JIntSpinner in this Cell to property.

Link copied to clipboard
fun Cell<JLongSpinner>.bindLongValue(property: KMutableProperty0<Long>): Cell<JLongSpinner>

Binds the value of the JLongSpinner in this Cell to property.

Link copied to clipboard
fun bindSpinners(min: JSpinner, max: JSpinner, maxRange: Double? = null)

Binds two spinners that form a range of valid values together.

Link copied to clipboard
fun Cell<JDateTimeField>.bindTimestamp(property: KMutableProperty0<Timestamp>): Cell<JDateTimeField>

Binds the Timestamp representation of the value of the JDateTimeField in this Cell to property.

Link copied to clipboard
fun Panel.decoratedRowRange(title: String? = null, indent: Boolean, init: Panel.() -> Unit): RowsRange

Creates and returns a range of rows from init, headed by an underlined title if and only if title is not null, and indented if and only if indent is true.

Link copied to clipboard
fun <T : AbstractButton> Cell<T>.disableMnemonic(): Cell<T>

Removes the mnemonic from the AbstractButton.text of the AbstractButton in this Cell.

Link copied to clipboard
fun JComponent.focusLater()

Moves focus to this component, soon.

Link copied to clipboard
fun JIntSpinner.hasValue(lambda: (Int) -> Boolean): ComponentPredicate

Returns a ComponentPredicate that evaluates lambda on the value of this JIntSpinner.

Link copied to clipboard
fun <E> Cell<ComboBox<E>>.isEditable(editable: Boolean): Cell<ComboBox<E>>

Sets whether the editor of the ComboBox in this Cell, and returns this.

Link copied to clipboard
fun <T : AbstractButton> Cell<T>.loadMnemonic(): Cell<T>

Loads the mnemonic for the AbstractButton in this Cell based on its AbstractButton.text.

Link copied to clipboard
fun ComponentPredicate.Companion.ofConstant(constant: Boolean): ComponentPredicate

Returns a predicate that always returns constant.

Link copied to clipboard
fun <T : JComponent> Cell<T>.onResetThis(callback: (Cell<T>) -> Unit): Cell<T>

Registers the callback to be invoked on the JComponent in this Cell when the dialog is reset, and returns this.

Link copied to clipboard
fun JComponent.setFixedHeight(height: Int)

Forces this JComponent to be height pixels high.

Link copied to clipboard
fun JComponent.setFixedWidth(width: Int)

Forces this JComponent to be width pixels wide.

Link copied to clipboard

Runs all given Validators, returning the first non-null value, or null if all Validators return null.

Link copied to clipboard
fun <T : JTextField> Cell<T>.withDocument(document: Document): Cell<T>

Sets the document of the JTextField in this Cell and returns this.

Link copied to clipboard
fun <E> Cell<ComboBox<E>>.withFilter(filter: DocumentFilter): Cell<ComboBox<E>>

Sets the filter on the document of the ComboBox in this Cell, and returns this.

Link copied to clipboard
fun <T : JComponent> Cell<T>.withFixedHeight(height: Int): Cell<T>

Forces the JComponent in this Cell to be height pixels high, and returns this.

Link copied to clipboard
fun <T : JComponent> Cell<T>.withFixedWidth(width: Int): Cell<T>

Forces the JComponent in this Cell to be width pixels wide, and returns this.

Link copied to clipboard
fun <T : JComponent> Cell<T>.withName(name: String): Cell<T>

Sets the name of the JComponent in this Cell and returns this.