Method Signatures and Parameters | |
Jt.slider(String label) | label (String) A short label explaining to the user what this slider is for. Markdown is supported, see |
Chainable builder methods | |
min(double min) | The minimum permitted value. |
max(double max) | The maximum permitted value. |
value(double value) | The initial slider value. Defaults to the |
step(double step) | The stepping interval. Default is 1. |
format(String format) | A printf-style format string controlling how the interface should display numbers. This does not impact the return value.
For information about formatting integers and floats, see sprintf.js.
For example, |
help(String help) | A tooltip that gets displayed next to the text. If this is |
disabled(boolean disabled) | Disable the slider if set to true. When disabled, users cannot interact with the widget. |
labelVisibility(JtComponent.LabelVisibility labelVisibility) | The visibility of the label. The default is |
onChange(function.Consumer<Double> onChange) | An optional callback function invoked when the slider value changes. The value passed to the callback is the previous value of the component. |
width(String width) | The width of the element. This can be one of the following:
|
width(int widthPixels) | The width of the element in pixels. The element will have a fixed width. If the specified width is greater than the width of the parent container, the width of the element matches the width of the parent container. |
key(String key) | A string to use as the unique key for the widget. If this is omitted, a key will be generated for the widget based on its content. No two widgets may have the same key. |
No description | |
use() | Put the widget in the app, in the |
use(JtContainer container) | Put the widget in the app, in the provided container. |
Returns after .use() | |
(double) | The current double value of the component. |
Examples
Basic integer slider usage
import tech.catheu.jeamlit.core.Jt;
public class SliderApp {
public static void main(String[] args) {
int age = Jt.slider("How old are you?")
.min(0)
.max(130)
.value(25)
.use();
Jt.text("I'm " + age + " years old").use();
}
}
Still have questions?
Go to our discussions forum for helpful information and advice from Jeamlit experts.