intellij-randomness / com.fwdekker.randomness.ui / JNumberSpinner

JNumberSpinner

abstract class JNumberSpinner<T> : JSpinner where T : Number, T : Comparable<T>

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

Parameters

T - the type of number

value - the default value

minValue - the smallest number that may be represented

maxValue - the largest number that may be represented

stepSize - the default value to increment and decrement by

Constructors

<init>

JNumberSpinner(value: T, minValue: T, maxValue: T, stepSize: T)

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

Properties

maxValue

var maxValue: T

The maximal allowed value.

minValue

var minValue: T

The minimal allowed value.

numberToT

abstract val numberToT: (Number) -> T

Transforms a Number into a T.

Functions

getValue

open fun getValue(): T

Returns the current value of the spinner.

setValue

open fun setValue(value: Any): Unit

Sets the value of the spinner.

validateValue

fun validateValue(): ValidationInfo?

Validates the current value.

Companion Object Properties

DEFAULT_FORMAT

val DEFAULT_FORMAT: DecimalFormatSymbols

The default number format used to display numbers.

DEFAULT_WIDTH

const val DEFAULT_WIDTH: Int

The default width of a number spinner.

Inheritors

JDoubleSpinner

class JDoubleSpinner : JNumberSpinner<Double>

A JNumberSpinner for doubles.

JIntSpinner

class JIntSpinner : JNumberSpinner<Int>

A JNumberSpinner for integers.

JLongSpinner

class JLongSpinner : JNumberSpinner<Long>

A JNumberSpinner for longs.