package com.imyeyu.fx.ui.examples.view.pages.component;

import com.imyeyu.fx.ui.TimiFXUI;
import com.imyeyu.fx.ui.components.FilledSlider;
import com.imyeyu.fx.ui.examples.component.AbstractDemoPane;
import com.imyeyu.fx.ui.examples.component.sidebar.SidebarItem;
import com.imyeyu.inject.annotation.Component;
import javafx.geometry.Insets;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;

/**
 * 填充轨道滑动条示例
 *
 * @author 夜雨
 * @since 2022-08-30 09:36
 */
@Component
public class FilledSliderDemo extends AbstractDemoPane {

	public FilledSliderDemo() {
		title.setText(SidebarItem.FILLED_SLIDER.getText());
		document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/component/FilledSlider.html");
		source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/component/FilledSlider.java");

		// 组件
		FilledSlider slider = new FilledSlider();
		slider.setPrefWidth(360);
		slider.setValue(.5);

		// 当前值
		Label value = TimiFXUI.label();
		value.textProperty().bind(slider.valueProperty().asString("%.2f"));

		setCenter(new FlowPane() {{
			setHgap(5);
			setPadding(new Insets(20));
			getChildren().addAll(slider, value);
		}});
	}
}
