javafx.collections.ObservableList.get()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(11.2k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中javafx.collections.ObservableList.get()方法的一些代码示例,展示了ObservableList.get()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObservableList.get()方法的具体详情如下:
包路径:javafx.collections.ObservableList
类名称:ObservableList
方法名:get

ObservableList.get介绍

暂无

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

private void removeRadio() {
  for (int i = 0; i < getChildren().size(); i++) {
    if ("radio".equals(getChildren().get(i).getStyleClass().get(0))) {
      getChildren().remove(i);
      break;
    }
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

public Node getContent() {
  return contentContainer.getChildren().size() == 2 ? contentContainer.getChildren().get(1) : null;
}

代码示例来源:origin: jfoenixadmin/JFoenix

private void clearSelection(JFXListView<?> selectedList) {
  if (allowClear) {
    allowClear = false;
    if (this != selectedList) {
      this.getSelectionModel().clearSelection();
    }
    for (int i = 0; i < sublistsProperty.get().size(); i++) {
      if (sublistsProperty.get().get(i) != selectedList) {
        sublistsProperty.get().get(i).getSelectionModel().clearSelection();
      }
    }
    allowClear = true;
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

@Override
protected void updateChildren() {
  super.updateChildren();
  if(buttonRippler!=null)
    getChildren().add(0, buttonRippler);
  for (int i = 1; i < getChildren().size(); i++) {
    final Node child = getChildren().get(i);
    if(child instanceof Text)
      child.setMouseTransparent(true);
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

@Override
protected void updateChildren() {
  super.updateChildren();
  if (rippler != null) {
    getChildren().add(0, rippler);
  }
  for (int i = 1; i < getChildren().size(); i++) {
    getChildren().get(i).setMouseTransparent(true);
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

@Override
protected double computePrefWidth(double height) {
  if (!getChildren().isEmpty()) {
    return getChildren().get(0).prefWidth(height);
  }
  return super.computePrefWidth(height);
}

代码示例来源:origin: jfoenixadmin/JFoenix

@Override
protected double computePrefHeight(double width) {
  if (!getChildren().isEmpty()) {
    return getChildren().get(0).prefHeight(width);
  }
  return super.computePrefHeight(width);
}

代码示例来源:origin: jfoenixadmin/JFoenix

public HamburgerSlideCloseTransition(JFXHamburger burger) {
  super(burger, createTimeline(burger));
  timeline.bind(Bindings.createObjectBinding(() -> createTimeline(burger),
    ((Region) burger.getChildren().get(0)).widthProperty(),
    ((Region) burger.getChildren().get(0)).heightProperty()));
  setCycleDuration(Duration.seconds(0.3));
  setDelay(Duration.seconds(0));
  setOnFinished((finish) -> {
    if (this.getRate() == 1) {
      burger.getChildren().get(1).setVisible(false);
    }
  });
}

代码示例来源:origin: jfoenixadmin/JFoenix

/**
   * init fxml when loaded.
   */
  @PostConstruct
  public void init() {

    for (int i = 0; i < 100; i++) {
      contentList.getItems().add("Item " + i);
    }
    contentList.setMaxHeight(3400);

    JFXScrollPane.smoothScrolling((ScrollPane) scroll.getChildren().get(0));

    SVGGlyph arrow = new SVGGlyph(0,
      "FULLSCREEN",
      "M402.746 877.254l-320-320c-24.994-24.992-24.994-65.516 0-90.51l320-320c24.994-24.992 65.516-24.992 90.51 0 24.994 24.994 "
      + "24.994 65.516 0 90.51l-210.746 210.746h613.49c35.346 0 64 28.654 64 64s-28.654 64-64 64h-613.49l210.746 210.746c12.496 "
      + "12.496 18.744 28.876 18.744 45.254s-6.248 32.758-18.744 45.254c-24.994 24.994-65.516 24.994-90.51 0z",
      Color.WHITE);
    arrow.setSize(20, 16);
    backButton.setGraphic(arrow);
    backButton.setRipplerFill(Color.WHITE);
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

public HamburgerNextArrowBasicTransition(JFXHamburger burger) {
  super(burger, createTimeline(burger));
  timeline.bind(Bindings.createObjectBinding(() -> createTimeline(burger),
    burger.widthProperty(),
    burger.heightProperty(),
    ((Region) burger.getChildren().get(0)).widthProperty(),
    ((Region) burger.getChildren().get(0)).heightProperty()));
  // reduce the number to increase the shifting , increase number to reduce shifting
  setCycleDuration(Duration.seconds(0.3));
  setDelay(Duration.seconds(0));
}

代码示例来源:origin: jfoenixadmin/JFoenix

public HamburgerBackArrowBasicTransition(JFXHamburger burger) {
  super(burger, createTimeline(burger));
  timeline.bind(Bindings.createObjectBinding(() -> createTimeline(burger),
    burger.widthProperty(),
    burger.heightProperty(),
    ((Region) burger.getChildren().get(0)).widthProperty(),
    ((Region) burger.getChildren().get(0)).heightProperty()));
  // reduce the number to increase the shifting , increase number to reduce shifting
  setCycleDuration(Duration.seconds(0.3));
  setDelay(Duration.seconds(0));
}

代码示例来源:origin: jfoenixadmin/JFoenix

public HamburgerBasicCloseTransition(JFXHamburger burger) {
  super(burger, createTimeline(burger));
  timeline.bind(Bindings.createObjectBinding(() -> createTimeline(burger),
    burger.widthProperty(),
    burger.heightProperty(),
    ((Region) burger.getChildren().get(0)).widthProperty(),
    ((Region) burger.getChildren().get(0)).heightProperty()));
  // reduce the number to increase the shifting , increase number to reduce shifting
  setCycleDuration(Duration.seconds(0.3));
  setDelay(Duration.seconds(0));
}

代码示例来源:origin: speedment/speedment

@Override
  protected Node createUndecoratedEditor() {
    final ChoiceBox<T> box = new ChoiceBox<>(alternatives);
    final T val = currentValue.getValue();

    if (alternatives.contains(val)) {
      box.setValue(val);
    } else {
      box.setValue(alternatives.get(0));
    }

    currentValue.bindBidirectional(box.valueProperty());
    return box;
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

public JFXTextFieldSkinAndroid(T textField) {
  super(textField);
  textPane = (Pane) this.getChildren().get(0);
  // get parent fields
  reflectionFieldConsumer("textNode", field -> textNode = (Node) field.get(this));
  reflectionFieldConsumer("textTranslateX", field -> textTranslateX = (DoubleProperty) field.get(this));
  linesWrapper = new PromptLinesWrapper<T>(
    textField,
    super.promptTextFill,
    textField.textProperty(),
    textField.promptTextProperty(),
    () -> promptText);
  linesWrapper.init(() -> createPromptNode(), textPane);
  reflectionFieldConsumer("usePromptText", field -> field.set(this, linesWrapper.usePromptText));
  errorContainer = new ValidationPane<>(textField);
  getChildren().addAll(linesWrapper.line, linesWrapper.focusedLine, linesWrapper.promptContainer, errorContainer);
  registerChangeListener(textField.disableProperty(), "DISABLE_NODE");
  registerChangeListener(textField.focusColorProperty(), "FOCUS_COLOR");
  registerChangeListener(textField.unFocusColorProperty(), "UNFOCUS_COLOR");
  registerChangeListener(textField.disableAnimationProperty(), "DISABLE_ANIMATION");
}

代码示例来源:origin: jfoenixadmin/JFoenix

public JFXTextFieldSkin(T textField) {
  super(textField);
  textPane = (Pane) this.getChildren().get(0);
  // get parent fields
  reflectionFieldConsumer("textNode", field -> textNode = (Node) field.get(this));
  reflectionFieldConsumer("textTranslateX", field -> textTranslateX = (DoubleProperty) field.get(this));
  linesWrapper = new PromptLinesWrapper<T>(
    textField,
    super.promptTextFill,
    textField.textProperty(),
    textField.promptTextProperty(),
    () -> promptText);
  linesWrapper.init(() -> createPromptNode(), textPane);
  reflectionFieldConsumer("usePromptText", field -> field.set(this, linesWrapper.usePromptText));
  errorContainer = new ValidationPane<>(textField);
  getChildren().addAll(linesWrapper.line, linesWrapper.focusedLine, linesWrapper.promptContainer, errorContainer);
  registerChangeListener(textField.disableProperty(), "DISABLE_NODE");
  registerChangeListener(textField.focusColorProperty(), "FOCUS_COLOR");
  registerChangeListener(textField.unFocusColorProperty(), "UNFOCUS_COLOR");
  registerChangeListener(textField.disableAnimationProperty(), "DISABLE_ANIMATION");
}

代码示例来源:origin: jfoenixadmin/JFoenix

@Override
protected void starting() {
  super.starting();
  if (node.getParent() instanceof JFXRippler) {
    JFXRippler rippler = (JFXRippler) node.getParent();
    BorderPane p = new BorderPane(node);
    p.setMaxWidth(((JFXHamburger) node).getWidth());
    p.setMinWidth(((JFXHamburger) node).getWidth());
    p.addEventHandler(MouseEvent.ANY, (event) -> {
      if (!event.isConsumed()) {
        event.consume();
        node.fireEvent(event);
      }
    });
    rippler.setControl(p);
  }
  if (this.getRate() == -1) {
    ((JFXHamburger) node).getChildren().get(1).setVisible(true);
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
  super.layoutChildren(x, y, w, h);
  final double height = getSkinnable().getHeight();
  linesWrapper.layoutLines(x, y, w, h, height, promptText == null ? 0 : promptText.getLayoutBounds().getHeight() + 3);
  errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h);
  linesWrapper.updateLabelFloatLayout();
  if (invalid) {
    invalid = false;
    // set the default background of text area viewport to white
    Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0);
    viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,
      CornerRadii.EMPTY,
      Insets.EMPTY)));
    // reapply css of scroll pane in case set by the user
    viewPort.applyCss();
    errorContainer.invalid(w);
    // focus
    linesWrapper.invalid();
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
  super.layoutChildren(x, y, w, h);
  final double height = getSkinnable().getHeight();
  linesWrapper.layoutLines(x, y, w, h, height, promptText == null ? 0 : promptText.getLayoutBounds().getHeight() + 3);
  errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h);
  linesWrapper.updateLabelFloatLayout();
  if (invalid) {
    invalid = false;
    // set the default background of text area viewport to white
    Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0);
    viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,
      CornerRadii.EMPTY,
      Insets.EMPTY)));
    // reapply css of scroll pane in case set by the user
    viewPort.applyCss();
    errorContainer.invalid(w);
    // focus
    linesWrapper.invalid();
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

public JFXTextAreaSkinAndroid(JFXTextArea textArea) {
  super(textArea);
  // init text area properties
  scrollPane = (ScrollPane) getChildren().get(0);
  textArea.setWrapText(true);
  linesWrapper = new PromptLinesWrapper<>(
    textArea,
    super.promptTextFill,
    textArea.textProperty(),
    textArea.promptTextProperty(),
    () -> promptText);
  linesWrapper.init(() -> createPromptNode(), scrollPane);
  errorContainer = new ValidationPane<>(textArea);
  getChildren().addAll(linesWrapper.line, linesWrapper.focusedLine, linesWrapper.promptContainer, errorContainer);
  registerChangeListener(textArea.disableProperty(), "DISABLE_NODE");
  registerChangeListener(textArea.focusColorProperty(), "FOCUS_COLOR");
  registerChangeListener(textArea.unFocusColorProperty(), "UNFOCUS_COLOR");
  registerChangeListener(textArea.disableAnimationProperty(), "DISABLE_ANIMATION");
}

代码示例来源:origin: jfoenixadmin/JFoenix

public JFXTextAreaSkin(JFXTextArea textArea) {
  super(textArea);
  // init text area properties
  scrollPane = (ScrollPane) getChildren().get(0);
  textArea.setWrapText(true);
  linesWrapper = new PromptLinesWrapper<>(
    textArea,
    super.promptTextFill,
    textArea.textProperty(),
    textArea.promptTextProperty(),
    () -> promptText);
  linesWrapper.init(() -> createPromptNode(), scrollPane);
  errorContainer = new ValidationPane<>(textArea);
  getChildren().addAll(linesWrapper.line, linesWrapper.focusedLine, linesWrapper.promptContainer, errorContainer);
  registerChangeListener(textArea.disableProperty(), "DISABLE_NODE");
  registerChangeListener(textArea.focusColorProperty(), "FOCUS_COLOR");
  registerChangeListener(textArea.unFocusColorProperty(), "UNFOCUS_COLOR");
  registerChangeListener(textArea.disableAnimationProperty(), "DISABLE_ANIMATION");
}

相关文章