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

import com.imyeyu.fx.ui.components.NumberField;
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.Slider;
import javafx.scene.layout.FlowPane;

/**
 * 数字输入
 *
 * @author 夜雨
 * @since 2022-08-29 21:49
 */
@Component
public class NumberFieldDemo extends AbstractDemoPane {

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

		NumberField numberField = new NumberField();
		numberField.setPrefWidth(220);

		setCenter(new FlowPane() {{
			setPadding(new Insets(20));
			getChildren().addAll(numberField, new Slider(0, 100, 50) {{
				numberField.valueProperty().bindBidirectional(valueProperty());
			}});
		}});
	}
}
