當前位置: 首頁>>代碼示例>>Java>>正文


Java Spinner類代碼示例

本文整理匯總了Java中javafx.scene.control.Spinner的典型用法代碼示例。如果您正苦於以下問題:Java Spinner類的具體用法?Java Spinner怎麽用?Java Spinner使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Spinner類屬於javafx.scene.control包,在下文中一共展示了Spinner類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setFormConstraints

import javafx.scene.control.Spinner; //導入依賴的package包/類
private void setFormConstraints(Node field) {
    if (field instanceof ISetConstraints) {
        ((ISetConstraints) field).setFormConstraints(this);
    } else if (field instanceof Button) {
        _setFormConstraints((Button) field);
    } else if (field instanceof TextField) {
        _setFormConstraints((TextField) field);
    } else if (field instanceof TextArea) {
        _setFormConstraints((TextArea) field);
    } else if (field instanceof ComboBox<?>) {
        _setFormConstraints((ComboBox<?>) field);
    } else if (field instanceof ChoiceBox<?>) {
        _setFormConstraints((ChoiceBox<?>) field);
    } else if (field instanceof CheckBox) {
        _setFormConstraints((CheckBox) field);
    } else if (field instanceof Spinner<?>) {
        _setFormConstraints((Spinner<?>) field);
    } else if (field instanceof VBox) {
        _setFormConstraints((VBox) field);
    } else if (field instanceof Label) {
        _setFormConstraints((Label) field);
    } else {
        LOGGER.info("FormPane.setFormConstraints(): unknown field type: " + field.getClass().getName());
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:26,代碼來源:FormPane.java

示例2: marathon_select

import javafx.scene.control.Spinner; //導入依賴的package包/類
@SuppressWarnings("unchecked") @Override public boolean marathon_select(String value) {
    Spinner<?> spinner = (Spinner<?>) getComponent();
    if (!spinner.isEditable()) {
        @SuppressWarnings("rawtypes")
        SpinnerValueFactory factory = ((Spinner<?>) getComponent()).getValueFactory();
        Object convertedValue = factory.getConverter().fromString(value);
        factory.setValue(convertedValue);
        return true;
    }
    TextField spinnerEditor = spinner.getEditor();
    if (spinnerEditor == null) {
        throw new JavaAgentException("Null value returned by getEditor() on spinner", null);
    }
    IJavaFXElement ele = JavaFXElementFactory.createElement(spinnerEditor, driver, window);
    spinnerEditor.getProperties().put("marathon.celleditor", true);
    ele.marathon_select(value);
    return true;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:JavaFXSpinnerElement.java

示例3: createListSpinner

import javafx.scene.control.Spinner; //導入依賴的package包/類
private Spinner<Object> createListSpinner() {
    Spinner<Object> spinner = new Spinner<>();
    spinner.setId("list-spinner");
    List<Object> names = new ArrayList<Object>();
    names.add("January");
    names.add("February");
    names.add("March");
    names.add("April");
    names.add("May");
    names.add("June");
    names.add("July");
    names.add("August");
    names.add("September");
    names.add("October");
    names.add("November");
    names.add("December");
    spinner.setValueFactory(new SpinnerValueFactory.ListSpinnerValueFactory<Object>(FXCollections.observableArrayList(names)));
    return spinner;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:SpinnerSample.java

示例4: getText

import javafx.scene.control.Spinner; //導入依賴的package包/類
@Test public void getText() {
    Spinner<?> spinner = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup(".spinner");
    LoggingRecorder lr = new LoggingRecorder();
    List<String> text = new ArrayList<>();
    Platform.runLater(() -> {
        RFXSpinner rfxSpinner = new RFXSpinner(spinner, null, null, lr);
        spinner.getEditor().setText("March");
        rfxSpinner.focusLost(null);
        text.add(rfxSpinner.getAttribute("text"));
    });
    new Wait("Waiting for spinner text.") {
        @Override public boolean until() {
            return text.size() > 0;
        }
    };
    AssertJUnit.assertEquals("March", text.get(0));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:18,代碼來源:RFXSpinnerTest.java

示例5: commitEditorText

import javafx.scene.control.Spinner; //導入依賴的package包/類
private void commitEditorText(Spinner<T> spinner) {
    if (!spinner.isEditable()) return;
    try {
        String text = spinner.getEditor().getText();
        SpinnerValueFactory<T> valueFactory = spinner.getValueFactory();
        if (valueFactory != null) {
            StringConverter<T> converter = valueFactory.getConverter();
            if (converter != null) {
                T value = converter.fromString(text);
                if (value == null)
                    return;
                valueFactory.setValue(value);
            }
        }
    } catch (NumberFormatException e) {
        // Ignore text input.
        return;
    }
}
 
開發者ID:tbressler,項目名稱:waterrower-workout,代碼行數:20,代碼來源:SpinnerFocusChangeListener.java

示例6: createZoomSpinner

import javafx.scene.control.Spinner; //導入依賴的package包/類
private Spinner<Integer> createZoomSpinner(ToggleButton btnZoom, String ip)
{
	Spinner<Integer> spinnerZoom = new Spinner<>(googleMinZoomLevel, googleMaxZoomLevel, googleDefaultZoomLevel, googleZoomLevelStep);
	spinnerZoom.setPrefWidth(55);
	spinnerZoom.setPrefHeight(btnZoom.getHeight());
	spinnerZoom.valueProperty().addListener((ChangeListener<Integer>) (observable, oldValue, newValue) ->
	{
		imgService.setCenterOnIP(ip, newValue);
		labelUnderMap.setVisible(true);

		generateAndShowImage();
	});
	Tooltip spinnerTooltip = new Tooltip("Set zoom level (1-20)");
	ToolTipUtilities.setTooltipProperties(spinnerTooltip, true, GUIController.defaultTooltipMaxWidth, GUIController.defaultFontSize, null);
	spinnerZoom.setTooltip(spinnerTooltip);
	spinnerZoom.getEditor().setTooltip(spinnerTooltip);
	spinnerZoom.setEditable(false);
	spinnerZoom.setDisable(true);
	
	return spinnerZoom;
}
 
開發者ID:ck3ck3,項目名稱:WhoWhatWhere,代碼行數:22,代碼來源:VisualTraceUI.java

示例7: SpinnerTableCell

import javafx.scene.control.Spinner; //導入依賴的package包/類
public SpinnerTableCell(TableColumn<T, Integer> column, int min, int max) {

    spinner = new Spinner<>(min, max, 1);

    spinner.editableProperty().bind(column.editableProperty());
    spinner.disableProperty().bind(column.editableProperty().not());

    tableRowProperty().addListener(e -> {
      TableRow<?> row = getTableRow();
      if (row == null)
        return;
      MsSpectrumDataSet dataSet = (MsSpectrumDataSet) row.getItem();
      if (dataSet == null)
        return;
      spinner.getValueFactory().valueProperty().bindBidirectional(dataSet.lineThicknessProperty());
      disableProperty().bind(dataSet.renderingTypeProperty().isEqualTo(MsSpectrumType.CENTROIDED));

    });
  }
 
開發者ID:mzmine,項目名稱:mzmine3,代碼行數:20,代碼來源:SpinnerTableCell.java

示例8: SpinnerTableCell

import javafx.scene.control.Spinner; //導入依賴的package包/類
public SpinnerTableCell(TableColumn<T, Integer> column, int min, int max) {

    spinner = new Spinner<>(min, max, 1);

    spinner.editableProperty().bind(column.editableProperty());
    spinner.disableProperty().bind(column.editableProperty().not());

    tableRowProperty().addListener(e -> {
      TableRow<?> row = getTableRow();
      if (row == null)
        return;
      ChromatogramPlotDataSet dataSet = (ChromatogramPlotDataSet) row.getItem();
      if (dataSet == null)
        return;
      spinner.getValueFactory().valueProperty().bindBidirectional(dataSet.lineThicknessProperty());

    });
  }
 
開發者ID:mzmine,項目名稱:mzmine3,代碼行數:19,代碼來源:SpinnerTableCell.java

示例9: initialize

import javafx.scene.control.Spinner; //導入依賴的package包/類
@FXML
@Override
public void initialize() {
  super.initialize();

  final Spinner<List> spinner = new Spinner<>(this.valueFactory);
  spinner.setEditable(true);
  spinner.disableProperty().bind(this.getHandle().connectedProperty());
  spinner.focusedProperty().addListener((s, ov, nv) -> {
    // Code found at http://stackoverflow.com/questions/32340476/manually-typing-in-text-in-javafx-spinner-is-not-updating-the-value-unless-user
    if (nv) {
      return;
    }
    commitEditorText(spinner);
  });
  this.setContent(spinner);
}
 
開發者ID:WPIRoboticsProjects,項目名稱:GRIP,代碼行數:18,代碼來源:ListSpinnerInputSocketController.java

示例10: reset

import javafx.scene.control.Spinner; //導入依賴的package包/類
public static void reset() {
    add(Node.class, JavaFXElement.class);
    add(TextInputControl.class, JavaFXTextInputControlElement.class);
    add(HTMLEditor.class, JavaFXHTMLEditor.class);
    add(CheckBox.class, JavaFXCheckBoxElement.class);
    add(ToggleButton.class, JavaFXToggleButtonElement.class);
    add(Slider.class, JavaFXSliderElement.class);
    add(Spinner.class, JavaFXSpinnerElement.class);
    add(SplitPane.class, JavaFXSplitPaneElement.class);
    add(ProgressBar.class, JavaFXProgressBarElement.class);
    add(ChoiceBox.class, JavaFXChoiceBoxElement.class);
    add(ColorPicker.class, JavaFXColorPickerElement.class);
    add(ComboBox.class, JavaFXComboBoxElement.class);
    add(DatePicker.class, JavaFXDatePickerElement.class);
    add(TabPane.class, JavaFXTabPaneElement.class);
    add(ListView.class, JavaFXListViewElement.class);
    add(TreeView.class, JavaFXTreeViewElement.class);
    add(TableView.class, JavaFXTableViewElement.class);
    add(TreeTableView.class, JavaFXTreeTableViewElement.class);
    add(CheckBoxListCell.class, JavaFXCheckBoxListCellElement.class);
    add(ChoiceBoxListCell.class, JavaFXChoiceBoxListCellElement.class);
    add(ComboBoxListCell.class, JavaFXComboBoxListCellElemnt.class);
    add(CheckBoxTreeCell.class, JavaFXCheckBoxTreeCellElement.class);
    add(ChoiceBoxTreeCell.class, JavaFXChoiceBoxTreeCellElement.class);
    add(ComboBoxTreeCell.class, JavaFXComboBoxTreeCellElement.class);
    add(TableCell.class, JavaFXTableViewCellElement.class);
    add(CheckBoxTableCell.class, JavaFXCheckBoxTableCellElement.class);
    add(ChoiceBoxTableCell.class, JavaFXChoiceBoxTableCellElement.class);
    add(ComboBoxTableCell.class, JavaFXComboBoxTableCellElemnt.class);
    add(TreeTableCell.class, JavaFXTreeTableCellElement.class);
    add(CheckBoxTreeTableCell.class, JavaFXCheckBoxTreeTableCell.class);
    add(ChoiceBoxTreeTableCell.class, JavaFXChoiceBoxTreeTableCell.class);
    add(ComboBoxTreeTableCell.class, JavaFXComboBoxTreeTableCell.class);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:35,代碼來源:JavaFXElementFactory.java

示例11: selectListSpinner

import javafx.scene.control.Spinner; //導入依賴的package包/類
@Test public void selectListSpinner() {
    IJavaFXElement spinner = driver.findElementByName("list-spinner");
    Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#list-spinner");
    Platform.runLater(() -> {
        spinner.marathon_select("June");
    });
    new Wait("Waiting for spinner to set value") {
        @Override public boolean until() {
            Object value = spinnerNode.getValue();
            return value.toString().equals("June");
        }
    };
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:14,代碼來源:JavaFXSpinnerElementTest.java

示例12: selectEditableListSpinner

import javafx.scene.control.Spinner; //導入依賴的package包/類
@Test public void selectEditableListSpinner() {
    IJavaFXElement spinner = driver.findElementByName("list-spinner");
    Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#list-spinner");
    Platform.runLater(() -> {
        spinnerNode.setEditable(true);
        spinner.marathon_select("December");
    });
    new Wait("Waiting for spinner to set value") {
        @Override public boolean until() {
            Object value = spinnerNode.getValue();
            return value.toString().equals("December");
        }
    };
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:15,代碼來源:JavaFXSpinnerElementTest.java

示例13: listSpinnerWithInvalidValue

import javafx.scene.control.Spinner; //導入依賴的package包/類
@Test public void listSpinnerWithInvalidValue() {
    IJavaFXElement spinner = driver.findElementByName("list-spinner");
    Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#list-spinner");
    Platform.runLater(() -> {
        spinnerNode.setEditable(true);
        spinner.marathon_select("Decem");
    });
    new Wait("Spinner was not reset.") {
        @Override public boolean until() {
            Object value = spinnerNode.getValue();
            return value.toString().equals("January");
        }
    };
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:15,代碼來源:JavaFXSpinnerElementTest.java

示例14: selectIntegerSpinner

import javafx.scene.control.Spinner; //導入依賴的package包/類
@Test public void selectIntegerSpinner() {
    IJavaFXElement spinner = driver.findElementByName("integer-spinner");
    Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#integer-spinner");
    Platform.runLater(() -> {
        spinner.marathon_select("35");
    });
    new Wait("Waiting for spinner to set value") {
        @Override public boolean until() {
            Integer value = (Integer) spinnerNode.getValue();
            return value == 35;
        }
    };
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:14,代碼來源:JavaFXSpinnerElementTest.java

示例15: selectEditableIntegerSpinner

import javafx.scene.control.Spinner; //導入依賴的package包/類
@Test public void selectEditableIntegerSpinner() {
    IJavaFXElement spinner = driver.findElementByName("integer-spinner");
    Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#integer-spinner");
    Platform.runLater(() -> {
        spinner.marathon_select("45");
    });
    new Wait("Waiting for spinner to set value") {
        @Override public boolean until() {
            Integer value = (Integer) spinnerNode.getValue();
            return value == 45;
        }
    };
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:14,代碼來源:JavaFXSpinnerElementTest.java


注:本文中的javafx.scene.control.Spinner類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。