javafx.scene.shape.Line类的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(11.1k)|赞(0)|评价(0)|浏览(187)

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

Line介绍

暂无

代码示例

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

line = new Line();
line.setStroke(getSkinnable().isSelected() ? toggleButton.getToggleLineColor() : toggleButton.getUnToggleLineColor());
line.setStartX(0);
line.setStartY(0);
line.setEndX(circleRadius * 2 + 2);
line.setEndY(0);
line.setStrokeWidth(circleRadius * 1.5);
line.setStrokeLineCap(StrokeLineCap.ROUND);
line.setSmooth(true);
      .setTarget(line.strokeProperty())
      .setEndValueSupplier(() -> getSkinnable().isSelected() ?
        ((JFXToggleButton) getSkinnable()).getToggleLineColor()

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

new KeyFrame(
  Duration.ZERO,
  new KeyValue(rightLine.visibleProperty(), false, Interpolator.EASE_BOTH),
  new KeyValue(leftLine.visibleProperty(), false, Interpolator.EASE_BOTH),
  new KeyValue(box.rotateProperty(), 0, Interpolator.EASE_BOTH),
  new KeyValue(box.scaleXProperty(), 1, Interpolator.EASE_BOTH),
),
new KeyFrame(Duration.millis(400),
  new KeyValue(rightLine.visibleProperty(), true, Interpolator.EASE_BOTH),
  new KeyValue(leftLine.visibleProperty(), true, Interpolator.EASE_BOTH),
  new KeyValue(rightLine.endXProperty(),
    (boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5,
    Interpolator.EASE_BOTH),
  new KeyValue(rightLine.endYProperty(),
    maxHeight - padding - 2 * lineThick,
    Interpolator.EASE_BOTH),
  new KeyValue(leftLine.endXProperty(),
    (boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5,
    Interpolator.EASE_BOTH),
  new KeyValue(leftLine.endYProperty(),
    maxHeight - padding - 2 * lineThick,
    Interpolator.EASE_BOTH)
new KeyFrame(
  Duration.millis(800),
  new KeyValue(rightLine.endXProperty(),
    boxWidth - padding - labelOffset + lineThick / 2,
    Interpolator.EASE_BOTH),

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

rightLine.setStartX((boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5);
rightLine.setStartY(maxHeight - padding - lineThick);
rightLine.setEndX((boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5);
rightLine.setEndY(maxHeight - padding - lineThick);
leftLine.setStartX((boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5);
leftLine.setStartY(maxHeight - padding - lineThick);
leftLine.setEndX((boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5);
leftLine.setEndY(maxHeight - padding - lineThick);
transition = new CheckBoxTransition();
if (getSkinnable().isSelected()) {

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

rippler.setRipplerFill(getSkinnable().isSelected() ? control.getUnCheckedColor() : control.getCheckedColor());
rightLine = new Line();
leftLine = new Line();
rightLine.setStroke(control.getCheckedColor());
rightLine.setStrokeWidth(lineThick);
leftLine.setStroke(control.getCheckedColor());
leftLine.setStrokeWidth(lineThick);
rightLine.setVisible(false);
leftLine.setVisible(false);

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

Line line = new Line(shift, 0, contentCircleRadius, 0);
line.fillProperty().bind(timePicker.defaultColorProperty());
line.strokeProperty().bind(line.fillProperty());
line.setStrokeWidth(1.5);
minsPointer.getChildren().addAll(line, selectionCircle, minCircle);
StackPane.setAlignment(selectionCircle, Pos.CENTER_LEFT);

代码示例来源:origin: org.controlsfx/controlsfx

private Node createCloseIcon() {
  Group group = new Group();
  group.getStyleClass().add("graphics"); //$NON-NLS-1$
  Circle circle = new Circle();
  circle.getStyleClass().add("circle"); //$NON-NLS-1$
  circle.setRadius(6);
  circle.setCenterX(6);
  circle.setCenterY(6);
  group.getChildren().add(circle);
  Line line1 = new Line();
  line1.getStyleClass().add("line"); //$NON-NLS-1$
  line1.setStartX(4);
  line1.setStartY(4);
  line1.setEndX(8);
  line1.setEndY(8);
  group.getChildren().add(line1);
  Line line2 = new Line();
  line2.getStyleClass().add("line"); //$NON-NLS-1$
  line2.setStartX(8);
  line2.setStartY(4);
  line2.setEndX(4);
  line2.setEndY(8);
  group.getChildren().add(line2);
  return group;
}

代码示例来源:origin: com.powsybl/powsybl-gse-network-explorer

public CapacitorSymbol(Color stroke, double strokeWidth, double size) {
  setPrefSize(size, size);
  l1 = new Line();
  l1.setStroke(stroke);
  l1.setStrokeWidth(strokeWidth);
  l2 = new Line();
  l2.setStroke(stroke);
  l2.setStrokeWidth(strokeWidth);
  l3 = new Line();
  l3.setStroke(stroke);
  l3.setStrokeWidth(strokeWidth);
  l4 = new Line();
  l4.setStroke(stroke);
  l4.setStrokeWidth(strokeWidth);
  getChildren().addAll(l1, l2, l3, l4);
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

@Override
public void attach(Pane node, TextNode textNode) {
  Line l = (Line) textNode.getUserData();
  if( l == null ) {
    l = new Line();
    l.setMouseTransparent(true);
    l.setManaged(false);
    l.setStartY(textNode.getBoundsInLocal().getHeight() - 2);
    l.strokeProperty().bind(textNode.fillProperty());
    l.setEndY(textNode.getBoundsInLocal().getHeight() - 2 );
    l.setEndX(textNode.getBoundsInLocal().getWidth());
    //l.setTranslateY(textNode.getBaselineOffset() + 2.0);
    textNode.setUserData(l);
  }
  node.getChildren().add(l);
}

代码示例来源:origin: org.copper-engine/copper-monitoring-client

@Override
  public void handle(MouseEvent event) {
    Point2D scenePoint = chart.localToScene(event.getSceneX(), event.getSceneY());
    Point2D position = chartWrap.sceneToLocal(scenePoint.getX(), scenePoint.getY());
    Bounds chartAreaBounds = chartArea.localToScene(chartArea.getBoundsInLocal());
    valueMarker.setStartY(0);
    valueMarker.setEndY(chartWrap.sceneToLocal(chartAreaBounds).getMaxY() - chartWrap.sceneToLocal(chartAreaBounds).getMinY());
    valueMarker.setStartX(0);
    valueMarker.setEndX(0);
    valueMarker.setTranslateX(position.getX() - chartWrap.getWidth() / 2);
    double ydelta = chartArea.localToScene(0, 0).getY() - chartWrap.localToScene(0, 0).getY();
    valueMarker.setTranslateY(-ydelta * 2);
  }
});

代码示例来源:origin: com.powsybl/powsybl-gse-network-explorer

public SwitchSymbol(Color stroke, double strokeWidth, double size) {
  setPrefSize(size, size);
  leg1 = new Line();
  leg1.setFill(stroke);
  leg1.setStroke(stroke);
  leg1.setStrokeWidth(strokeWidth);
  leg2 = new Line();
  leg2.setFill(stroke);
  leg2.setStroke(stroke);
  leg2.setStrokeWidth(strokeWidth);
  box = new Rectangle();
  box.setFill(Color.TRANSPARENT);
  box.setStroke(stroke);
  box.setStrokeWidth(strokeWidth);
  getChildren().addAll(leg1, leg2, box);
}

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

@Override
public void attach(StyledTextNode node, Text textNode) {
  Line l = (Line) textNode.getUserData();
  if( l == null ) {
    l = new Line();
    l.setManaged(false);
    l.setEndX(textNode.getBoundsInLocal().getWidth());
    l.setTranslateY(textNode.getBaselineOffset() + 2.0);
    textNode.setUserData(l);
  }
  node.getChildren().add(l);
}

代码示例来源:origin: stackoverflow.com

stack.getChildren().addAll(splitPane1, glassPane);
Scene scene = new Scene(stack, 800, 600);
LV1.endYProperty().bind(scene.heightProperty());
stage.setScene(scene);
pane1.setOnMouseMoved(mouseHandler);
boolean setCrosshair = false;
if (x > min && x < min + xAxis.getWidth()) {
 LV1.setStartX(x); LV1.setEndX(x);
 setCrosshair = true;
} else if (x <= min){
 LV1.setStartX(min); LV1.setEndX(min);
} else if (x >= max){
 LV1.setStartX(max); LV1.setEndX(max);

代码示例来源:origin: org.copper-engine/copper-monitoring-client

animationPane.getChildren().add(adapterText);
Line lineInput = new Line();
lineInput.getStrokeDashArray().addAll(5d);
lineInput.setCache(true);
lineInput.startXProperty().set(getAnimationPaneWidth() / 2 - getAnimationPaneWidth() / 8);
lineInput.endXProperty().set(lineInput.startXProperty().get());
lineInput.startYProperty().set(0);
lineInput.endYProperty().bind(animationPane.heightProperty());
animationPane.getChildren().add(lineInput);
Line lineOutput = new Line();
lineOutput.getStrokeDashArray().addAll(5d);
lineOutput.setCache(true);
lineOutput.startXProperty().set(getAnimationPaneWidth() / 2 + getAnimationPaneWidth() / 8);
lineOutput.endXProperty().set(lineOutput.startXProperty().get());
lineOutput.startYProperty().set(0);
lineOutput.endYProperty().bind(animationPane.heightProperty());
animationPane.getChildren().add(lineOutput);

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

Line line = new Line(0, radius, destinationWidth, radius);
line.setStrokeWidth(10);
line.setRotate(angle/2);

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

this.selectionMarker.setManaged(false);
this.selectionMarker.getStyleClass().add("selection-marker"); //$NON-NLS-1$
this.caret.setVisible(false);
this.caret.setStrokeWidth(2);
this.caret.setManaged(false);
this.caret.getStyleClass().add("text-caret"); //$NON-NLS-1$
    StyledTextLayoutContainer.this.caret.setVisible(false);
  } else {
    StyledTextLayoutContainer.this.caret.setVisible(StyledTextLayoutContainer.this.caretIndex != -1);
  StyledTextLayoutContainer.this.caret.setVisible(false);
};
ownerFocusedProperty.addListener( o -> {
  if( ! ownerFocusedProperty.get() ) {
    this.caret.setVisible(false);

代码示例来源:origin: org.copper-engine/copper-monitoring-client

public static void addMarker(final XYChart<?, ?> chart, final StackPane chartWrap) {
  final Line valueMarker = new Line();
  final Node chartArea = chart.lookup(".chart-plot-background");
  chartArea.setOnMouseMoved(new EventHandler<MouseEvent>() {
    @Override
    public void handle(MouseEvent event) {
      Point2D scenePoint = chart.localToScene(event.getSceneX(), event.getSceneY());
      Point2D position = chartWrap.sceneToLocal(scenePoint.getX(), scenePoint.getY());
      Bounds chartAreaBounds = chartArea.localToScene(chartArea.getBoundsInLocal());
      valueMarker.setStartY(0);
      valueMarker.setEndY(chartWrap.sceneToLocal(chartAreaBounds).getMaxY() - chartWrap.sceneToLocal(chartAreaBounds).getMinY());
      valueMarker.setStartX(0);
      valueMarker.setEndX(0);
      valueMarker.setTranslateX(position.getX() - chartWrap.getWidth() / 2);
      double ydelta = chartArea.localToScene(0, 0).getY() - chartWrap.localToScene(0, 0).getY();
      valueMarker.setTranslateY(-ydelta * 2);
    }
  });
  chartWrap.getChildren().add(valueMarker);
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

public CaretLayer() {
  this.caret.setVisible(false);
  this.caret.setStrokeWidth(2);
  this.caret.getStyleClass().add("text-caret"); //$NON-NLS-1$
  this.caret.setVisible(false);
  this.getChildren().add(this.caret);
  this.caretAnimation = createCaretAnimation(this.caret);
  
  this.sceneProperty().addListener((x, o, n)->{
    if (n == null) {
      if (this.caretAnimation != null) {
        this.caretAnimation.stop();
      }
      this.caretAnimation = null;
    }
    else {
      this.caretAnimation = createCaretAnimation(this.caret);
    }
  });
}

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

@Override
public void layout(StyledTextNode node, Text textNode) {
  Line l = (Line) textNode.getUserData();
  if( l != null ) {
    l.setEndX(node.getWidth());
  }
}

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

@Override
protected void handleControlPropertyChanged(String p) {
  if ("TOGGLE_COLOR".equals(p)) {
    if (getSkinnable().isSelected()) {
      circle.setFill(((JFXToggleButton) getSkinnable()).getToggleColor());
    }
  } else if ("UNTOGGLE_COLOR".equals(p)) {
    if (!getSkinnable().isSelected()) {
      circle.setFill(((JFXToggleButton) getSkinnable()).getUnToggleColor());
    }
  } else if ("TOGGLE_LINE_COLOR".equals(p)) {
    if (getSkinnable().isSelected()) {
      line.setStroke(((JFXToggleButton) getSkinnable()).getToggleLineColor());
    }
  } else if ("UNTOGGLE_LINE_COLOR".equals(p)) {
    if (!getSkinnable().isSelected()) {
      line.setStroke(((JFXToggleButton) getSkinnable()).getUnToggleLineColor());
    }
  } else {
    super.handleControlPropertyChanged(p);
  }
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

@Override
  public void layoutChildren() {
    double caretOffset = getCharLocation(this.caretIndex);
    this.caret.setStartX(caretOffset);
    this.caret.setStrokeLineCap(StrokeLineCap.BUTT);
    this.caret.setEndX(caretOffset);
    this.caret.setStartY(0);
    this.caret.setEndY(getHeight());
    this.caret.toFront();
  }
}

相关文章