Search in sources :

Example 1 with Parameter

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();
}
Also used : ParameterChangeListener(qupath.lib.plugins.parameters.ParameterChangeListener) JFXPanel(javafx.embed.swing.JFXPanel) BorderPane(javafx.scene.layout.BorderPane) TextArea(javafx.scene.control.TextArea) Scene(javafx.scene.Scene) Stage(javafx.stage.Stage) ParameterList(qupath.lib.plugins.parameters.ParameterList) Parameter(qupath.lib.plugins.parameters.Parameter) StringParameter(qupath.lib.plugins.parameters.StringParameter) EmptyParameter(qupath.lib.plugins.parameters.EmptyParameter) IntParameter(qupath.lib.plugins.parameters.IntParameter) NumericParameter(qupath.lib.plugins.parameters.NumericParameter) DoubleParameter(qupath.lib.plugins.parameters.DoubleParameter) ChoiceParameter(qupath.lib.plugins.parameters.ChoiceParameter) BooleanParameter(qupath.lib.plugins.parameters.BooleanParameter)

Aggregations

JFXPanel (javafx.embed.swing.JFXPanel)1 Scene (javafx.scene.Scene)1 TextArea (javafx.scene.control.TextArea)1 BorderPane (javafx.scene.layout.BorderPane)1 Stage (javafx.stage.Stage)1 BooleanParameter (qupath.lib.plugins.parameters.BooleanParameter)1 ChoiceParameter (qupath.lib.plugins.parameters.ChoiceParameter)1 DoubleParameter (qupath.lib.plugins.parameters.DoubleParameter)1 EmptyParameter (qupath.lib.plugins.parameters.EmptyParameter)1 IntParameter (qupath.lib.plugins.parameters.IntParameter)1 NumericParameter (qupath.lib.plugins.parameters.NumericParameter)1 Parameter (qupath.lib.plugins.parameters.Parameter)1 ParameterChangeListener (qupath.lib.plugins.parameters.ParameterChangeListener)1 ParameterList (qupath.lib.plugins.parameters.ParameterList)1 StringParameter (qupath.lib.plugins.parameters.StringParameter)1