本文整理汇总了Java中javafx.scene.control.SpinnerValueFactory.DoubleSpinnerValueFactory方法的典型用法代码示例。如果您正苦于以下问题:Java SpinnerValueFactory.DoubleSpinnerValueFactory方法的具体用法?Java SpinnerValueFactory.DoubleSpinnerValueFactory怎么用?Java SpinnerValueFactory.DoubleSpinnerValueFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.SpinnerValueFactory
的用法示例。
在下文中一共展示了SpinnerValueFactory.DoubleSpinnerValueFactory方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: revealParameters
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
private void revealParameters(Projection proj) {
this.suppressListeners.set();
final String[] paramNames = proj.getParameterNames();
final double[][] paramValues = proj.getParameterValues();
paramGrid.getChildren().clear();
for (int i = 0; i < proj.getNumParameters(); i ++) {
paramLabels[i].setText(paramNames[i]+":");
paramSliders[i].setMin(paramValues[i][0]);
paramSliders[i].setMax(paramValues[i][1]);
paramSliders[i].setValue(paramValues[i][2]);
final SpinnerValueFactory.DoubleSpinnerValueFactory paramSpinVF =
(DoubleSpinnerValueFactory) paramSpinners[i].getValueFactory();
paramSpinVF.setMin(paramValues[i][0]);
paramSpinVF.setMax(paramValues[i][1]);
paramSpinVF.setValue(paramValues[i][2]);
final Tooltip tt = new Tooltip(
"Change the "+paramNames[i]+" of the map (default is " + paramValues[i][2]+")");
paramSliders[i].setTooltip(tt);
paramSpinners[i].setTooltip(tt);
paramGrid.addRow(i, paramLabels[i], paramSliders[i], paramSpinners[i]);
}
this.suppressListeners.clear();
}
示例2: NumberSpinnerInputSocketController
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
/**
* @param socket An <code>InputSocket</code> with a domain containing two <code>Number</code>s
* (the min and max slider values), or no domain at all.
*/
@Inject
NumberSpinnerInputSocketController(SocketHandleView.Factory socketHandleViewFactory,
GripPlatform platform, @Assisted InputSocket<Number> socket) {
super(socketHandleViewFactory, socket);
this.platform = platform;
final Number[] domain = socket.getSocketHint().getDomain().orElse(DEFAULT_DOMAIN);
checkArgument(domain.length == 2, "Spinners must have a domain with two numbers (min and max)");
final double min = domain[0].doubleValue();
final double max = domain[1].doubleValue();
final double initialValue = socket.getValue().get().doubleValue();
this.valueFactory = new SpinnerValueFactory.DoubleSpinnerValueFactory(min, max, initialValue);
this.updateSocketFromSpinner = o -> this.getSocket().setValue(this.valueFactory.getValue());
this.valueFactory.valueProperty().addListener(this.updateSocketFromSpinner);
}
示例3: setUpSpinnerDouble
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
private void setUpSpinnerDouble(Spinner<Double> spinner, int pos, double min, double max, double increment, double savedSet){
DoubleSpinnerValueFactory oswFactory = new SpinnerValueFactory.DoubleSpinnerValueFactory(min, max, savedSet, increment);
spinner.setValueFactory(oswFactory);
spinner.valueProperty().addListener((obs, oldValue, newValue) -> {
System.out.println("New value: "+newValue);
// hier könnte es rundungsfehler von double auf Number geben
setValueSettings(pos, newValue);
});
}
示例4: initialize
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
logger.entry();
SpinnerValueFactory sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, 0.1);
MinWaitTime.setValueFactory(sVF);
logger.exit();
}
示例5: initialize
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
logger.entry();
SpinnerValueFactory sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, 0.1);
MinWaitTime.setValueFactory(sVF);
MaxWaitTime.setValueFactory(sVF);
logger.exit();
}
示例6: initialize
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
logger.entry();
double currentValue = 0;
double step = .1;
try {
if (logicalTimeFactory != null) {
switch (logicalTimeFactory.getName()) {
case "HLAfloat64Time":
currentValue = ((HLAfloat64Time) currentLogicalTime).getValue();
break;
case "HLAinteger64Time":
step = 1;
currentValue = ((HLAinteger64Time) currentLogicalTime).getValue();
break;
}
}
} catch (Exception ex) {
logger.log(Level.WARN, ex.getMessage(), ex);
}
SpinnerValueFactory sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, step);
sVF.setValue(currentValue);
LogicalTimeSpin.setValueFactory(sVF);
logger.exit();
}
示例7: initialize
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
logger.entry();
double currentValue = 0;
double step = .1;
try {
if (logicalTimeFactory != null) {
switch (logicalTimeFactory.getName()) {
case "HLAfloat64Time":
currentValue = ((HLAfloat64Time) currentLogicalTime).getValue();
break;
case "HLAinteger64Time":
step = 1;
currentValue = ((HLAinteger64Time) currentLogicalTime).getValue();
break;
}
}
} catch (Exception ex) {
logger.log(Level.WARN, ex.getMessage(), ex);
}
SpinnerValueFactory<Double> sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, step);
sVF.setValue(currentValue);
LogicalTimeSpin.setValueFactory(sVF);
logger.exit();
}
示例8: initialize
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
logger.entry();
SpinnerValueFactory sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, .1);
Lookahead.setValueFactory(sVF);
logger.exit();
}
示例9: start
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
@Override
public void start(final Stage stage)
{
final Label label = new Label("Demo:");
SpinnerValueFactory<Double> svf = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, 1000);
Spinner<Double> spinner = new Spinner<>();
spinner.setValueFactory(svf);
spinner.editorProperty().getValue().setStyle("-fx-text-fill:" + "black");
spinner.editorProperty().getValue().setBackground(
new Background(new BackgroundFill(Color.AZURE, CornerRadii.EMPTY, Insets.EMPTY)));
//spinner.getStyleClass().add(Spinner.STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL);
//int x = spinner.getStyleClass().indexOf(Spinner.STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL);
//if (x > 0) spinner.getStyleClass().remove(x);
spinner.setEditable(true);
spinner.setPrefWidth(80);
spinner.valueProperty().addListener((prop, old, value) ->
{
System.out.println("Value: " + value);
});
final HBox root = new HBox(label, spinner);
final Scene scene = new Scene(root, 800, 700);
stage.setScene(scene);
stage.setTitle("Spinner Demo");
stage.show();
}