Java 类javafx.scene.shape.StrokeType 实例源码

项目:gemoc-studio-modeldebugging    文件:CycleView.java   
public CycleView(final List<Node> nodes, final int cycleIndex, final double hueInterval) {
    Paint p = Color.hsb(cycleIndex * hueInterval, 0.75, 0.70, 0.25);
    setFill(p);
    setStroke(p);
    setStrokeWidth(20);
    setStrokeLineJoin(StrokeLineJoin.ROUND);
    setStrokeType(StrokeType.OUTSIDE);
    updateHull(nodes, HULL_ALGORITHM);
    final ChangeListener<Number> listener = (_0, _1, _2) -> {
        updateHull(nodes, HULL_ALGORITHM);
    };
    for (Node n : nodes) {
        n.translateXProperty().addListener(listener);
        n.translateYProperty().addListener(listener);
    }
}
项目:openjfx-8u-dev-tests    文件:AnimationTransitionApp.java   
@Override
public Node drawNode() {
    currentTestNode = this;
    StrokeTransition transition = new StrokeTransition(Duration.millis(typicalDuration), circle);
    Pane p = pre(transition);
    circle.setStrokeWidth(20);
    circle.setStrokeType(StrokeType.OUTSIDE);


    transition.setFromValue(dFrom);
    transition.setToValue(dTo);

    if (dFrom != transition.getFromValue()) {
        reportGetterFailure("getFrom()");
    }
    if (dTo != transition.getToValue()) {
        reportGetterFailure("getTo()");
    }

    transition.setCycleCount(2);
    transition.setAutoReverse(true);

    return p;
}
项目:JFloor    文件:HandlerAssigner.java   
private void createHandlers(GroupEntity rect) {
    // Rotate Handler
    rotateHandle.setStrokeWidth(1);
    rotateHandle.setStrokeType(StrokeType.INSIDE);
    rotateHandle.setStroke(Color.BLUE);
    // Move Handle
    moveHandle.setStrokeWidth(1);
    moveHandle.setStrokeType(StrokeType.OUTSIDE);
    moveHandle.setStroke(Color.WHITE);
    // Resize Handler Left-Width
    resizeHandleLeft.setStrokeWidth(1);
    resizeHandleLeft.setStrokeType(StrokeType.OUTSIDE);
    resizeHandleLeft.setStroke(Color.BLUE);
    // Resize Handler Right-Width
    resizeHandleRight.setStrokeWidth(1);
    resizeHandleRight.setStrokeType(StrokeType.OUTSIDE);
    resizeHandleRight.setStroke(Color.BLUE);
    // Resize Handler Top-Height
    resizeHandleTop.setStrokeWidth(1);
    resizeHandleTop.setStrokeType(StrokeType.OUTSIDE);
    resizeHandleTop.setStroke(Color.BLUE);
    // Resize Handler Bottom-Height
    resizeHandleBottom.setStrokeWidth(1);
    resizeHandleBottom.setStrokeType(StrokeType.OUTSIDE);
    resizeHandleBottom.setStroke(Color.BLUE);
}
项目:ColorSelector    文件:ColorSelector.java   
private void initGraphics() {
    gradient = new ConicalGradient(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, gradientLookup.getStops());

    double center = PREFERRED_WIDTH * 0.5;
    ring = Shape.subtract(new Circle(center, center, center),
                          new Circle(center, center, PREFERRED_WIDTH * 0.28813559));
    ring.setFill(gradient.getImagePattern(ring.getLayoutBounds()));

    mainCircle = new Circle();
    mainCircle.setStrokeType(StrokeType.INSIDE);
    mainCircle.setMouseTransparent(true);

    pane = new Pane(ring, mainCircle);

    getChildren().setAll(pane);
}
项目:sgf4j-gui    文件:BoardSquare.java   
public BoardSquare(int x, int y) {
  super();

  this.x = x;
  this.y = y;

  setSize(width);
  setPadding(Insets.EMPTY);
  setAlignment(Pos.CENTER);

  // some defaults
  highLightCircle.setStrokeType(StrokeType.INSIDE);
  highLightCircle.setStrokeWidth(strokeWidth);

  init();
}
项目:sgf4j-gui    文件:BoardSquare.java   
public void placeStone(StoneState stoneState) {
  this.squareState = stoneState;

  stoneCircle.setRadius(width / RADIUS_MULTIPLIER);
  highLightCircle.setRadius(( width / HIGHLIGHT_MULTIPLIER ) - 1.5);

  stoneCircle.setStroke(Color.BLACK);
  stoneCircle.setStrokeType(StrokeType.OUTSIDE);
  stoneCircle.setStrokeWidth(strokeWidth);
  stoneCircle.setVisible(true);

  if (stoneState.equals(StoneState.WHITE)) {
    stoneCircle.setFill(Color.WHITE);
  }
  else {
    stoneCircle.setFill(Color.BLACK);
  }

  stoneCircle.setSmooth(true);

  if (!getChildren().contains(stoneCircle)) {
    getChildren().add(stoneCircle);
  }
}
项目:mm3Capture    文件:MainAppController.java   
@PostConstruct
public void init() {
    // Bind the port property to the UI label
    currentPortID.textProperty().bindBidirectional(appConfig.comPortProperty());

    // Dynamically create all alerts
    Map<String, GroovyObject> alerts = alterManager.getAlertClasses();
    for (String key : alerts.keySet()) {
        Circle alarm = new Circle(11.0, Color.web("green"));
        alarm.setRadius(11.0);
        alarm.setStrokeType(StrokeType.INSIDE);
        alarm.setStroke(Color.web("black"));
        Label label = new Label(key);
        alertVbox.getChildren().addAll(alarm, label);
        alertUiMap.put(key, alarm);
    }

    comGenerator.addObserver(this);
}
项目:org.csstudio.display.builder    文件:RectangleRepresentation.java   
@Override
public void updateChanges()
{
    super.updateChanges();
    if (dirty_size.checkAndClear())
    {
        jfx_node.setWidth(model_widget.propWidth().getValue());
        jfx_node.setHeight(model_widget.propHeight().getValue());
        jfx_node.setArcWidth(2 * model_widget.propCornerWidth().getValue());
        jfx_node.setArcHeight(2 * model_widget.propCornerHeight().getValue());
    }
    if (dirty_look.checkAndClear())
    {
        jfx_node.setMouseTransparent(ignore_mouse);
        jfx_node.setFill(background);
        jfx_node.setStroke(line_color);
        jfx_node.setStrokeWidth(model_widget.propLineWidth().getValue());
        jfx_node.setStrokeType(StrokeType.INSIDE);
    }
}
项目:GoodiesLinkBot    文件:RectangleBorder.java   
public void setRectangleSize(double x, double y, double width, double height) {
    Window w = RectangleBorder.this.getScene().getWindow();

    StrokeType st = RectangleBorder.this.getStrokeType();
    double strokeWidth = resizer.getThickBorderSize();

    double padding = 0;
    if (st.equals(StrokeType.CENTERED)) {
        padding = strokeWidth / 2;
    } else if (st.equals(StrokeType.OUTSIDE)) {
        padding = strokeWidth;
    }

    w.setWidth(width + 2 * padding);
    w.setHeight(height + 2 * padding);

    w.setX(x + -padding + w.getX());
    w.setY(y + -padding + w.getY());

    this.setWidth(width);
    this.setHeight(height);
    setX(padding);
    setY(padding);
}
项目:GoodiesLinkBot    文件:ScreenRegionSelect.java   
private void create() {
    this.initStyle(StageStyle.TRANSPARENT);
    setWidth(100);
    setHeight(100);
    setAlwaysOnTop(true);

    Pane shapes = new Pane();
    scene = new Scene(shapes, getWidth(), getHeight(), null);
    scene.setFill(Color.TRANSPARENT);

    sizeRect = new RectangleBorder(0, 0, 100, 100);
    sizeRect.setStrokeType(StrokeType.OUTSIDE);
    sizeRect.setFill(null);
    sizeRect.setStroke(Color.RED);
    sizeRect.setStrokeWidth(3);
    sizeRect.setUnselectedStrokeWidth(3);
    sizeRect.setSelectedStrokeWidth(10);

    shapes.getChildren().add(sizeRect);

    setTitle("Rectangular select");
    setScene(scene);
    scene.getRoot().setStyle("-fx-background-color: transparent");

}
项目:JavaFxNodeToSvg    文件:SvgNodeProperties.java   
/**
 * Sets the stroke alignment with a JavaFx stroke type
 * @param javaFxStrokeType 
 */
public void setStrokeAlignment(StrokeType javaFxStrokeType) {
    switch (javaFxStrokeType) {
    case CENTERED:
        setStrokeAlignment(SvgStrokeAlignment.CENTER);
        break;
    case INSIDE:
        setStrokeAlignment(SvgStrokeAlignment.INNER);
        break;
    case OUTSIDE:
        setStrokeAlignment(SvgStrokeAlignment.OUTER);
        break;
    default:
        String message = "The stroke type " + javaFxStrokeType + " is not known.";
        throw new IllegalArgumentException(message);
    }
}
项目:ModelDebugging    文件:CycleView.java   
public CycleView(final List<Node> nodes, final int cycleIndex, final double hueInterval) {
    Paint p = Color.hsb(cycleIndex * hueInterval, 0.75, 0.70, 0.25);
    setFill(p);
    setStroke(p);
    setStrokeWidth(20);
    setStrokeLineJoin(StrokeLineJoin.ROUND);
    setStrokeType(StrokeType.OUTSIDE);
    updateHull(nodes, HULL_ALGORITHM);
    final ChangeListener<Number> listener = (_0, _1, _2) -> {
        updateHull(nodes, HULL_ALGORITHM);
    };
    for (Node n : nodes) {
        n.translateXProperty().addListener(listener);
        n.translateYProperty().addListener(listener);
    }
}
项目:tet-java-client    文件:CalibrationButton.java   
private void init()
{
    Group g = new Group();

    mCircle = new Circle(0,0,40);
    mCircle.setFill(Color.WHITE);
    mCircle.setStrokeWidth(3);
    mCircle.setStrokeMiterLimit(10);
    mCircle.setStrokeType(StrokeType.CENTERED);
    mCircle.setStroke(Color.valueOf("0x333333"));

    Circle inner = new Circle(0,0,8);
    inner.setFill(Color.valueOf("0xFFFFFF00"));
    inner.setStrokeWidth(4);
    inner.setStrokeMiterLimit(10);
    inner.setStrokeType(StrokeType.INSIDE);
    inner.setStroke(Color.valueOf("0x000000"));

    g.getChildren().addAll(mCircle, inner);
    setAlignment(g, Pos.CENTER);

    getChildren().add(g);
}
项目:jfxutils    文件:JFXChartUtil.java   
/**
 * Convenience method for simple and default setup of zooming on an {@link XYChart} via a
 * {@link ChartZoomManager}. Wraps the chart in the components required to implement zooming. The
 * current implementation wraps the chart in a StackPane, which has the chart and a blue
 * translucent rectangle as children. Returns the top level of the created components.
 * <p>
 * If the chart already has a parent, that parent must be a {@link Pane}, and the chart is
 * replaced with the wrapping region, and the return value could be ignored. If the chart does
 * not have a parent, the same wrapping node is returned, which will need to be added to some
 * parent.
 * <p>
 * The chart's axes must both be a type of ValueAxis.
 * <p>
 * The wrapping logic does not seem to be perfect, in fact there is a special case to handle
 * {@link BorderPane}s. If it's not found to be reliable, then create the wrapping components
 * yourself (such as in the FXML), or setup zooming before adding it to a parent.
 *
 * @param mouseFilter EventHandler that consumes events that should not trigger a zoom action
 *
 * @return The top-level Region
 */
public static Region setupZooming( XYChart<?, ?> chart,
                                   EventHandler<? super MouseEvent> mouseFilter ) {
    StackPane chartPane = new StackPane();

    if ( chart.getParent() != null )
        JFXUtil.replaceComponent( chart, chartPane );

    Rectangle selectRect = new Rectangle( 0, 0, 0, 0 );
    selectRect.setFill( Color.DODGERBLUE );
    selectRect.setMouseTransparent( true );
    selectRect.setOpacity( 0.3 );
    selectRect.setStroke( Color.rgb( 0, 0x29, 0x66 ) );
    selectRect.setStrokeType( StrokeType.INSIDE );
    selectRect.setStrokeWidth( 3.0 );
    StackPane.setAlignment( selectRect, Pos.TOP_LEFT );

    chartPane.getChildren().addAll( chart, selectRect );

    ChartZoomManager zoomManager = new ChartZoomManager( chartPane, selectRect, chart );
    zoomManager.setMouseFilter( mouseFilter );
    zoomManager.start();
    return chartPane;
}
项目:Viwib    文件:ZoomImageFrame.java   
public ZoomImageFrame() {
    Group root = new Group();
    this.getChildren().add(root);

    iv = new ImageView();

    Rectangle bg = new Rectangle();
    bg.widthProperty().bind(this.widthProperty);
    bg.heightProperty().bind(this.heightProperty);
    bg.setFill(Color.rgb(240, 240, 240));
    bg.setStroke(Color.rgb(192, 192, 192));
    bg.setStrokeWidth(1);
    bg.setStrokeType(StrokeType.OUTSIDE);
    root.getChildren().add(bg);

    iv.fitWidthProperty().bind(widthProperty.subtract(10));
    iv.fitHeightProperty().bind(heightProperty.subtract(10));
    iv.setPreserveRatio(true);
    iv.setTranslateX(5);
    iv.setTranslateY(5);
    this.getChildren().add(iv);

    recalculateViewPort();

}
项目:marathonv5    文件:SimpleHSBColorPicker.java   
public SimpleHSBColorPicker() {
    getChildren().addAll(hsbRect,lightRect);
    lightRect.setStroke(Color.GRAY);
    lightRect.setStrokeType(StrokeType.OUTSIDE);
    EventHandler<MouseEvent> ml = new EventHandler<MouseEvent>() {
        @Override public void handle(MouseEvent e) {
            double w = getWidth();
            double h = getHeight();
            double x = Math.min(w, Math.max(0, e.getX()));
            double y = Math.min(h, Math.max(0, e.getY()));
            double hue = (360/w)*x;
            double vert = (1/h)*y;
            double sat = 0;
            double bright = 0;
            if (vert<0.5) {
                bright = 1;
                sat = vert * 2;
            } else {
                bright = sat = 1- ((vert-0.5)*2);
            }
            // convert back to color
            Color c =  Color.hsb((int)hue,sat,bright);
            color.set(c);
            e.consume();
        }
    };
    lightRect.setOnMouseDragged(ml);
    lightRect.setOnMouseClicked(ml);
}
项目:marathonv5    文件:SimpleHSBColorPicker.java   
public SimpleHSBColorPicker() {
    getChildren().addAll(hsbRect,lightRect);
    lightRect.setStroke(Color.GRAY);
    lightRect.setStrokeType(StrokeType.OUTSIDE);
    EventHandler<MouseEvent> ml = new EventHandler<MouseEvent>() {
        @Override public void handle(MouseEvent e) {
            double w = getWidth();
            double h = getHeight();
            double x = Math.min(w, Math.max(0, e.getX()));
            double y = Math.min(h, Math.max(0, e.getY()));
            double hue = (360/w)*x;
            double vert = (1/h)*y;
            double sat = 0;
            double bright = 0;
            if (vert<0.5) {
                bright = 1;
                sat = vert * 2;
            } else {
                bright = sat = 1- ((vert-0.5)*2);
            }
            // convert back to color
            Color c =  Color.hsb((int)hue,sat,bright);
            color.set(c);
            e.consume();
        }
    };
    lightRect.setOnMouseDragged(ml);
    lightRect.setOnMouseClicked(ml);
}
项目:Game-Engine-Vooga    文件:Anchor.java   
/**
 * Instatiation of display of anchor.
 * @param color
 * @param x
 * @param y
 */
public Anchor(Color color, DoubleProperty x, DoubleProperty y) {
    super(x.get(), y.get(), RADIUS);
    setFill(color.deriveColor(1, 1, 1, FILL_CONST));
    setStroke(color);
    setStrokeWidth(STROKE_WIDTH);
    setStrokeType(StrokeType.OUTSIDE);

    x.bind(centerXProperty());
    y.bind(centerYProperty());
    enableDrag();
}
项目:Game-Engine-Vooga    文件:Anchor.java   
public Anchor(DoubleProperty x, DoubleProperty y, TransitionOrder order) {
    super(x.get(), y.get(), RADIUS);
    setFill(order.getColor().deriveColor(1, 1, 1, COLOR_FACTOR));
    setStroke(order.getColor());
    setStrokeWidth(CIRCLE_WIDTH);
    setStrokeType(StrokeType.OUTSIDE);

    x.bind(centerXProperty());
    y.bind(centerYProperty());
}
项目:medusademo    文件:FunLevelGauge.java   
private void resize() {
    width  = getWidth() - getInsets().getLeft() - getInsets().getRight();
    height = getHeight() - getInsets().getTop() - getInsets().getBottom();
    size   = width < height ? width : height;

    if (width > 0 && height > 0) {
        pane.setMaxSize(size, size);
        pane.relocate((getWidth() - size) * 0.5, (getHeight() - size) * 0.5);

        ring.setCenterX(size * 0.5);
        ring.setCenterY(size * 0.5);
        ring.setRadius(size * 0.5);
        ring.setStrokeWidth(size * 0.025);
        ring.setStrokeType(StrokeType.INSIDE);

        mask.setCenterX(size * 0.5);
        mask.setCenterY(size * 0.5);
        mask.setRadius(size * 0.45);

        canvas.setWidth(size);
        canvas.setHeight(size);
        canvas.relocate(0, 0);

        text.setFont(Fonts.robotoMedium(size * 0.25));
        text.setY(size * 0.5);
        text.setX((size - text.getLayoutBounds().getWidth()) * 0.5);

        for( int i = 0 ; i < detail + 1 ; i++ ) {
            Point p = particles.get(i);
            p.x = size / (detail - 4) * (i - 2);
            p.y = size * (1d - gauge.getCurrentValue());

            p.originalX = p.x;
            p.originalY = p.y;
        }
    }
}
项目:PL3-2016    文件:GraphView.java   
/**
 * Returns a visualization of a graph segment
 */
public Ellipse createEllipse(int segmentId, double ellipseHeigth) {
    int contentLength = segmentdna.get(segmentId - 1).length();
    double xcoord = graphxcoords.get(segmentId - 1);
    double ycoord = graphycoords.get(segmentId - 1);
    double xradius = 30 + 2 * Math.log(contentLength);
    Ellipse node = new Ellipse(xcoord, ycoord, xradius, ellipseHeigth);
    node.setFill(Color.DODGERBLUE);
    node.setStroke(Color.BLACK);
    node.setStrokeType(StrokeType.INSIDE);
    return node;
}
项目:Medusa    文件:FlatSkin.java   
@Override protected void resize() {
    double width  = gauge.getWidth() - gauge.getInsets().getLeft() - gauge.getInsets().getRight();
    double height = gauge.getHeight() - gauge.getInsets().getTop() - gauge.getInsets().getBottom();
    size          = width < height ? width : height;

    if (width > 0 && height > 0) {
        pane.setMaxSize(size, size);
        pane.relocate((width - size) * 0.5, (height - size) * 0.5);

        colorRing.setCenterX(size * 0.5);
        colorRing.setCenterY(size * 0.5);
        colorRing.setRadius(size * 0.5);
        colorRing.setStrokeWidth(size * 0.0075);
        colorRing.setStrokeType(StrokeType.INSIDE);

        bar.setCenterX(size * 0.5);
        bar.setCenterY(size * 0.5);
        bar.setRadiusX(size * 0.4135);
        bar.setRadiusY(size * 0.4135);
        bar.setStrokeWidth(size * 0.12);

        separator.setStartX(size * 0.5);
        separator.setStartY(size * 0.0275);
        separator.setEndX(size * 0.5);
        separator.setEndY(size * 0.145);

        resizeTitleText();
        resizeValueText();
        resizeUnitText();
    }
}
项目:FXGraphs    文件:Place.java   
private Circle createOuterCircle(double centerX, double centerY, double radius) {
    Circle outerCircle = new Circle(radius, Color.GRAY);
    outerCircle.setEffect(new Lighting());
    outerCircle.setStroke(Color.BLACK);
    outerCircle.setStrokeWidth(2);
    outerCircle.setStrokeType(StrokeType.OUTSIDE);
    outerCircle.setOpacity(0.4);
    outerCircle.setLayoutX(centerX);
    outerCircle.setLayoutY(centerY);
    setConnectionBounderyNode(outerCircle);
    return outerCircle;
}
项目:FXGraphs    文件:PlaceView.java   
public PlaceView(double centerX, double centerY, double radius) {

        Circle circle = new Circle(radius + 30, Color.GRAY);
        circle.setEffect(new Lighting());
        circle.setStroke(Color.BLACK);
        circle.setStrokeWidth(2);
        circle.setStrokeType(StrokeType.OUTSIDE);
        circle.setOpacity(0.4);
        circle.setLayoutX(centerX);
        circle.setLayoutY(centerY);

        Circle circle1 = new Circle(radius + 25, Color.WHITE);
        circle1.setLayoutX(centerX);
        circle1.setLayoutY(centerY);

        Circle circle2 = new Circle(radius - 20, Color.BLACK);
        circle2.setEffect(new Lighting());
        circle2.setOpacity(0.8);
        circle2.setLayoutX(centerX);
        circle2.setLayoutY(centerY);

        Circle anchor = new Circle(10, Color.BLACK);
        anchor.setLayoutX(centerX);
        anchor.setLayoutY(centerY);

        setAnchor(anchor);
        getChildren().add(circle);
        getChildren().add(circle1);
        getChildren().add(circle2);

    }
项目:marlin-fx    文件:TrianglePerformanceTest.java   
private void setShapeAttrs(Shape shape) {
    shape.setFill(randomColors ? randomColor() : Color.BLUE);
    if (STROKE_COLOR != null) {
        shape.setStroke(STROKE_COLOR);
        shape.setStrokeType(StrokeType.INSIDE);
        shape.setStrokeWidth(0.5);
    }
}
项目:binjr    文件:XYChartCrosshair.java   
private void applyStyle(Shape shape) {
    shape.setMouseTransparent(true);
    shape.setSmooth(false);
    shape.setStrokeWidth(1.0);
    shape.setVisible(false);
    shape.setStrokeType(StrokeType.CENTERED);
    shape.setStroke(Color.STEELBLUE);
    Color fillColor = Color.LIGHTSTEELBLUE;
    shape.setFill(new Color(
            fillColor.getRed(),
            fillColor.getGreen(),
            fillColor.getBlue(),
            SELECTION_OPACITY));
}
项目:viskell    文件:DrawWire.java   
/**
 * @param touchPoint that is the center of new active touch area, or null if the mouse
 */
private TouchArea(TouchPoint touchPoint) {
    super();
    this.setLayoutX(DrawWire.this.getEndX());
    this.setLayoutY(DrawWire.this.getEndY());

    this.touchID = touchPoint == null ? -1 : touchPoint.getId();
    this.dragStarted = true;
    this.nearbyAnchors = new ArrayList<>();
    this.lastNearbyUpdate = Point2D.ZERO;

    this.disapperance = new Timeline(new KeyFrame(Duration.millis(2000),
            e -> DrawWire.this.remove(),
            new KeyValue(this.opacityProperty(), 0.3),
            new KeyValue(DrawWire.this.opacityProperty(), 0.2)));

    // a circle with hole is built from a path of round arcs with a very thick stroke
    ArcTo arc1 = new ArcTo(100, 100, 0, 100, 0, true, true);
    ArcTo arc2 = new ArcTo(100, 100, 0, -100, 0, true, true);
    this.getElements().addAll(new MoveTo(-100, 0), arc1, arc2, new ClosePath());
    this.setStroke(Color.web("#0066FF"));
    this.setStrokeType(StrokeType.INSIDE);
    this.setStrokeWidth(90);
    this.setStroke(Color.web("#0066FF"));
    this.setStrokeType(StrokeType.INSIDE);
    this.setOpacity(0);

    if (touchPoint != null) { 
        touchPoint.grab(this);
    }

    this.addEventHandler(TouchEvent.TOUCH_PRESSED, this::handleTouchPress);
    this.addEventHandler(TouchEvent.TOUCH_MOVED, this::handleTouchDrag);
    this.addEventHandler(TouchEvent.TOUCH_RELEASED, this::handleTouchRelease);
    this.addEventHandler(MouseEvent.MOUSE_PRESSED, this::handleMousePress);
    this.addEventHandler(MouseEvent.MOUSE_DRAGGED, this::handleMouseDrag);
    this.addEventHandler(MouseEvent.MOUSE_RELEASED, this::handleMouseRelease);
}
项目:training    文件:Main.java   
private void populateCells(Group root, final SpriteView.Mary mary) {
    // Gratuitous use of lambdas to do nested iteration!
    Group cells = new Group();
    IntStream.range(0, HORIZONTAL_CELLS).mapToObj(i ->
        IntStream.range(0, VERTICAL_CELLS).mapToObj(j -> {
            Rectangle rect = new Rectangle(i * CELL_SIZE, j * CELL_SIZE, CELL_SIZE, CELL_SIZE);
            rect.setFill(Color.rgb(0, 0, 0, 0));
            rect.setStrokeType(StrokeType.INSIDE);
            rect.setStroke(Color.BLACK);
            rect.setOnMousePressed(e -> mary.moveTo(new Location(i, j)));
            return rect;
        })
    ).flatMap(s -> s).forEach(cells.getChildren()::add);
    root.getChildren().add(cells);
}
项目:JFoenix    文件:JFXColorPalette.java   
public ColorSquare(Color color, int index, boolean isCustom) {
    // Add style class to handle selected color square
    getStyleClass().add("color-square");
    if (color != null) {
        setFocusTraversable(true);
        focusedProperty().addListener((s, ov, nv) -> setFocusedSquare(nv ? this : null));
        addEventHandler(MouseEvent.MOUSE_ENTERED, event -> setFocusedSquare(ColorSquare.this));
        addEventHandler(MouseEvent.MOUSE_EXITED, event -> setFocusedSquare(null));
        addEventHandler(MouseEvent.MOUSE_RELEASED, event -> {
            if (!dragDetected && event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 1) {
                if (!isEmpty) {
                    Color fill = (Color) rectangle.getFill();
                    colorPicker.setValue(fill);
                    colorPicker.fireEvent(new ActionEvent());
                    updateSelection(fill);
                    event.consume();
                }
                colorPicker.hide();
            }
        });
    }
    rectangle = new Rectangle(SQUARE_SIZE, SQUARE_SIZE);
    if (color == null) {
        rectangle.setFill(Color.WHITE);
        isEmpty = true;
    } else {
        rectangle.setFill(color);
    }

    rectangle.setStrokeType(StrokeType.INSIDE);

    String tooltipStr = JFXNodeUtils.colorToHex(color);
    Tooltip.install(this, new Tooltip((tooltipStr == null) ? "" : tooltipStr.toUpperCase()));

    rectangle.getStyleClass().add("color-rect");
    getChildren().add(rectangle);
}
项目:WARrrr    文件:Main.java   
public Box(Block block) {
    Rectangle clip = new Rectangle(0, 0, Main.this.blockSize, Main.this.blockSize);
    this.setClip(clip);

    VBox inner = new VBox();
    inner.getStyleClass().add("block");
    inner.setAlignment(Pos.CENTER);

    this.health.getStyleClass().add("health");
    this.type.getStyleClass().add("type");
    this.status.getStyleClass().add("status");

    this.update(block);

    inner.getChildren().addAll(this.health, this.type, this.status);

    this.setOnMouseClicked(block);

    this.rect.setFill(Main.this.plainColor);
    this.rect.setArcHeight(Main.this.rectArc);
    this.rect.setArcWidth(Main.this.rectArc);
    this.rect.setStrokeType(StrokeType.INSIDE);
    this.rect.setStrokeWidth(2);

    this.layer.setFill(Color.WHITE);
    this.layer.setArcHeight(Main.this.rectArc);
    this.layer.setArcWidth(Main.this.rectArc);
    this.layer.setOpacity(0);

    this.getChildren().addAll(this.rect, inner, layer);
}
项目:bco.bcozy    文件:DoorPolygon.java   
@Override
protected void setConnectionStyle() {
    this.setMainColor(Color.TRANSPARENT);
    this.setStroke(Color.WHITE);
    this.getStrokeDashArray().addAll(Constants.DOOR_DASH_WIDTH, Constants.DOOR_DASH_WIDTH * 2);
    this.setStrokeWidth(Constants.ROOM_STROKE_WIDTH);
    this.setStrokeType(StrokeType.INSIDE);
    this.setMouseTransparent(true);
}
项目:org.csstudio.display.builder    文件:EllipseRepresentation.java   
@Override
public void updateChanges()
{
    // Not using default handling of X/Y super.updateChanges();
    if (dirty_position.checkAndClear())
    {
        if (model_widget.propVisible().getValue())
        {
            jfx_node.setVisible(true);
            final int x = model_widget.propX().getValue();
            final int y = model_widget.propY().getValue();
            final int w = model_widget.propWidth().getValue();
            final int h = model_widget.propHeight().getValue();
            jfx_node.setCenterX(x + w/2);
            jfx_node.setCenterY(y + h/2);
            jfx_node.setRadiusX(w/2);
            jfx_node.setRadiusY(h/2);
        }
        else
            jfx_node.setVisible(false);
    }
    if (dirty_look.checkAndClear())
    {
        jfx_node.setFill(background);
        jfx_node.setStroke(line_color);
        jfx_node.setStrokeWidth(model_widget.propLineWidth().getValue());
        jfx_node.setStrokeType(StrokeType.INSIDE);
    }
}
项目:org.csstudio.display.builder    文件:ArcRepresentation.java   
@Override
public void updateChanges()
{
    // Not using default handling of X/Y super.updateChanges();
    if (dirty_position.checkAndClear())
    {
        if (model_widget.propVisible().getValue())
        {
            jfx_node.setVisible(true);
            final int x = model_widget.propX().getValue();
            final int y = model_widget.propY().getValue();
            final int w = model_widget.propWidth().getValue();
            final int h = model_widget.propHeight().getValue();
            jfx_node.setCenterX(x + w/2);
            jfx_node.setCenterY(y + h/2);
            jfx_node.setRadiusX(w/2);
            jfx_node.setRadiusY(h/2);
        }
        else
            jfx_node.setVisible(false);
    }
    if (dirty_look.checkAndClear())
    {
        jfx_node.setFill(background);
        jfx_node.setStroke(line_color);
        jfx_node.setStrokeWidth(model_widget.propLineWidth().getValue());
        jfx_node.setStrokeType(StrokeType.INSIDE);
        jfx_node.setStartAngle(arc_start);
        jfx_node.setLength(arc_size);
        jfx_node.setType(arc_type);
    }
}
项目:JavaFxNodeToSvg    文件:ShapeToSvgConverter.java   
private static void addStrokeDataFromShape(SvgNodeProperties properties, Shape shape) {

        //color
        Paint stroke = shape.getStroke();
        String strokeColor = paintToColorString(stroke);
        properties.setStroke(strokeColor);

        //width
        Double strokeWidth = shape.getStrokeWidth();
        properties.setStrokeWidth(strokeWidth);

        //line cap
        StrokeLineCap strokeLineCap = shape.getStrokeLineCap();
        properties.setStrokeLineCap(strokeLineCap);

        //dash array
        List<Double> strokeDashArrayList = shape.getStrokeDashArray();
        String strokeDashArray = doubleArrayToStrokeDashArrayString(strokeDashArrayList);
        properties.setStrokeDashArray(strokeDashArray);

        //dash offset
        Double strokeDashOffset = shape.getStrokeDashOffset();
        properties.setStrokeDashOffset(strokeDashOffset);

        //line join
        StrokeLineJoin strokeLineJoin = shape.getStrokeLineJoin();
        properties.setStrokeLineJoin(strokeLineJoin);

        //miter limit
        Double strokeMiterLimit = shape.getStrokeMiterLimit();
        properties.setStrokeMiterLimit(strokeMiterLimit);

        //alignment
        StrokeType strokeType = shape.getStrokeType();
        properties.setStrokeAlignment(strokeType);
    }
项目:kotlinfx-ensemble    文件:SimpleHSBColorPicker.java   
public SimpleHSBColorPicker() {
    getChildren().addAll(hsbRect,lightRect);
    lightRect.setStroke(Color.GRAY);
    lightRect.setStrokeType(StrokeType.OUTSIDE);
    EventHandler<MouseEvent> ml = new EventHandler<MouseEvent>() {
        @Override public void handle(MouseEvent e) {
            double w = getWidth();
            double h = getHeight();
            double x = Math.min(w, Math.max(0, e.getX()));
            double y = Math.min(h, Math.max(0, e.getY()));
            double hue = (360/w)*x;
            double vert = (1/h)*y;
            double sat = 0;
            double bright = 0;
            if (vert<0.5) {
                bright = 1;
                sat = vert * 2;
            } else {
                bright = sat = 1- ((vert-0.5)*2);
            }
            // convert back to color
            Color c =  Color.hsb((int)hue,sat,bright);
            color.set(c);
            e.consume();
        }
    };
    lightRect.setOnMouseDragged(ml);
    lightRect.setOnMouseClicked(ml);
}
项目:dolphin-java-demo    文件:PushView.java   
private Rectangle newVehicle(String id) {
    Rectangle selRect = new Rectangle();
    selRect.setFill(id == null ? null : Paint.valueOf(id));
    selRect.setArcWidth(10);
    selRect.setArcHeight(10);
    selRect.setWidth(74);
    selRect.setHeight(20);
    selRect.setStroke(Paint.valueOf("cyan"));
    selRect.setStrokeWidth(2);
    selRect.setStrokeType(StrokeType.OUTSIDE);
    selRect.setEffect(DropShadowBuilder.create().offsetY(2).offsetX(2).radius(3).build());  // input: lighting{distant(azimuth: -135.0)})
    return selRect;
}
项目:afc    文件:ZoomablePane.java   
/** Constructor with the given color.
 *
 * @param color the color of the square.
 */
public ColorSquare(Color color) {
    // Add style class to handle selected color square
    getStyleClass().add("color-square"); //$NON-NLS-1$
    setFocusTraversable(false);
    this.rectangle = new Rectangle(SQUARE_SIZE, SQUARE_SIZE);
    this.rectangle.setStrokeType(StrokeType.INSIDE);
    this.rectangle.getStyleClass().add("color-rect"); //$NON-NLS-1$
    setColor(color);
    getChildren().add(this.rectangle);
}
项目:JRebirth-Tour    文件:PatternView.java   
private Node buildBall(String name, Color color, Point2D point, boolean big) {
    final StackPane ball = new StackPane();

    final int radius = big ? BIG_RADIUS : SMALL_RADIUS;

    ball.relocate(point.getX() - radius, point.getY() - radius);

    final Circle c = new Circle(radius);
    c.setFill(color);
    c.setStroke(Color.WHITE);
    c.setStrokeWidth(4);
    c.setStrokeType(StrokeType.OUTSIDE);

    final Text t = new Text(name);
    t.setFont(big ? JpFonts.BIG_PATTERN.get() : JpFonts.SMALL_PATTERN.get());
    t.setFill(Color.WHITE);
    t.setStroke(Color.DARKGRAY);
    c.setStrokeWidth(1);
    c.setStrokeType(StrokeType.OUTSIDE);

    StackPane.setAlignment(c, Pos.CENTER);
    StackPane.setAlignment(t, Pos.CENTER);
    ball.getChildren().addAll(c, t);

    ball.setEffect(getDropShadow());
    ball.setOpacity(0.0);

    ballLayer.getChildren().add(ball);

    return ball;
}
项目:HotaruFX    文件:ShapeNode.java   
public PropertyTimeline<String> strokeTypeProperty() {
    return strokeType.setIfEmptyThenGet(enumToString(StrokeType.class, shape.strokeTypeProperty()));
}
项目:fx-animation-editor    文件:RectangleModel.java   
public RectangleModel() {
    rectangle.setStrokeType(StrokeType.INSIDE);
    rectangle.setBlendMode(BlendMode.MULTIPLY);
}