use of qupath.lib.plugins.parameters.Parameter in project qupath by qupath.
the class ParameterPanelFX method demoParameterPanel.
static void demoParameterPanel() {
new JFXPanel();
if (!Platform.isFxApplicationThread()) {
Platform.runLater(() -> demoParameterPanel());
return;
}
Stage frame = new Stage();
frame.setTitle("Testing parameter panel");
int k = 0;
final ParameterList params = new ParameterList().addTitleParameter("Parameter list").addEmptyParameter("Here is a list of parameters that I am testing out").addIntParameter(Integer.toString(k++), "Enter an int", 5, "px", "Unbounded int").addDoubleParameter(Integer.toString(k++), "Enter a double", 5.2, "microns", "Unbounded double").addDoubleParameter(Integer.toString(k++), "Enter a double in range", 5.2, null, 1, 10, "Bounded double").addIntParameter(Integer.toString(k++), "Enter an int in range", 5, null, 1, 10, "Bounded int").addStringParameter(Integer.toString(k++), "Enter a string", "Default here").addChoiceParameter(Integer.toString(k++), "Choose a choice", "Two", Arrays.asList("One", "Two", "Three"), "Simple choice").addChoiceParameter(Integer.toString(k++), "Choose a number choice", Integer.valueOf(2), Arrays.asList(1, 2, 3), "Numeric choice").addBooleanParameter(Integer.toString(k++), "Check me out", true);
BorderPane borderPane = new BorderPane();
ParameterPanelFX panel = new ParameterPanelFX(params);
final TextArea textArea = new TextArea();
for (Parameter<?> p : params.getParameters().values()) {
textArea.setText(textArea.getText() + (p + "\n"));
}
panel.addParameterChangeListener(new ParameterChangeListener() {
@Override
public void parameterChanged(ParameterList params, String key, boolean isAdjusting) {
textArea.setText("");
for (Parameter<?> p : params.getParameters().values()) textArea.setText(textArea.getText() + (p + "\n"));
}
});
borderPane.setCenter(panel.getPane());
borderPane.setBottom(textArea);
frame.setScene(new Scene(borderPane));
frame.show();
}
Aggregations