本文整理汇总了Java中javafx.scene.shape.Shape.setStroke方法的典型用法代码示例。如果您正苦于以下问题:Java Shape.setStroke方法的具体用法?Java Shape.setStroke怎么用?Java Shape.setStroke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Shape
的用法示例。
在下文中一共展示了Shape.setStroke方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: strokeFrom
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
/**
* Animates the element's border color from the given rotation to the existing one. CAN ONLY BE APPLIED TO SHAPES.
* @param duration Duration of the animation
* @param color The color to animate from
*/
public Sprint strokeFrom(double duration, Color color) {
KeyValue keyValueX;
if (node instanceof Shape) {
Shape shape = (Shape) node;
keyValueX = new KeyValue(shape.strokeProperty(), shape.getStroke(), interpolator);
shape.setStroke(color);
} else {
return this;
}
KeyFrame keyFrame = new KeyFrame(Duration.seconds(duration), keyValueX);
timeline.getKeyFrames().add(keyFrame);
return this;
}
示例2: start
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
double r = SMALL ? 100 : 1843200.0;
double c = D - r / sqrt2;
Circle circle = new Circle(c, c, r, Color.GREY);
Circle littlecircle = new Circle(c, c, 10, Color.GREY);
Shape shape = Shape.union(circle, littlecircle);
printShape(shape);
shape.setFill(Color.BLUE);
shape.setStroke(Color.RED);
shape.setStrokeWidth(2.0);
shape.getStrokeDashArray().addAll(10.0, 5.0);
Pane root = new Pane();
root.getChildren().add(shape);
stage.setScene(new Scene(root, SIZE, SIZE));
stage.show();
}
示例3: addDebugView
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
private void addDebugView(HitBox hitBox) {
Shape view = null;
if (hitBox.getShape().isCircle()) {
double radius = hitBox.getWidth() / 2;
view = new Circle(radius, radius, radius, null);
} else if (hitBox.getShape().isRectangle()) {
view = new Rectangle(hitBox.getWidth(), hitBox.getHeight(), null);
}
if (view != null) {
view.setStroke(showBBoxColor);
view.setTranslateX(hitBox.getMinX());
view.setTranslateY(hitBox.getMinY());
debugBBox.getChildren().add(view);
}
}
示例4: TestLoadingScene
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public TestLoadingScene() {
getText().setFont(Font.font("Segoe UI", 24));
getText().setTranslateY(50);
Circle circle = new Circle(50, 50, 50);
Shape shape = Shape.subtract(new Rectangle(100, 100), circle);
shape.setFill(Color.BLUE);
shape.setStroke(Color.YELLOW);
RotateTransition rt = new RotateTransition(Duration.seconds(2), shape);
rt.setByAngle(360);
rt.setCycleCount(15);
rt.play();
shape.setTranslateX(700);
shape.setTranslateY(500);
getContentRoot().getChildren().set(1, shape);
}
示例5: PaneThumbnail
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public Pane PaneThumbnail()
{
Pane p = new Pane();
p.setMinHeight(30);
p.setMinWidth(30);
for (Shape thumb : Thumbnail())
{
thumb.setStroke(Color.BLACK);
if (thumb.getStrokeWidth() == 1.0) thumb.setStrokeWidth(0);
if (thumb.fillProperty().get() == null) thumb.setFill(Color.BLACK);
p.getChildren().add(thumb);
}
return p;
}
示例6: accept
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
@Override
public boolean accept(Node node)
{
if (node instanceof Shape)
{
Shape shape = (Shape) node;
if (result == null) result = shape.getStroke();
shape.setStroke(paint);
}
if (node instanceof Text)
{
Text text = (Text) node;
text.setFill(paint);
}
return true;
}
示例7: frame
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public static Style frame(Paint stroke, Paint fill, Double width, Double opacity, Dash dash)
{
StyleApplier applier = new StyleApplier()
{
@Override
public void apply(Shape shape)
{
shape.setStroke(stroke);
shape.setFill(fill);
shape.setStrokeWidth(width);
shape.setOpacity(opacity);
shape.getStrokeDashArray().clear();
shape.getStrokeDashArray().addAll(dash.array);
}
};
String value = "Frame: " + stroke.toString() + " Fill: " + fill.toString() + " Width: " + width + " Opacity: " + opacity
+ " Dash: " + dash;
return new Style(KEY, applier, value);
}
示例8: color
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public static Style color(Paint stroke, Paint fill, Double opacity)
{
StyleApplier applier = new StyleApplier()
{
@Override
public void apply(Shape shape)
{
shape.setStroke(stroke);
shape.setFill(fill);
shape.setOpacity(opacity);
}
};
String value = "Stroke: " + stroke.toString() + " Fill: " + fill.toString() + " Opacity: " + opacity;
return new Style(COLOR, applier, value);
}
示例9: setFillType
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
/**
* Sets the fill type of a shape based on this cell's type
* @param n the shape to set the fill of
* @param state the state of the cell, determines coloring
*/
private void setFillType(Shape n, CellState state) {
Color baseColor = Color.web(state.getBackgroundColor());
switch(this.type) {
case LOCAL:
n.setFill(baseColor);
break;
case REMOTE:
n.setFill(Color.web(BACKGROUND_COLOR));
n.setStroke(baseColor);
break;
case BOTH:
n.setFill(baseColor);
n.setStroke(baseColor);
break;
default:
break;
}
}
示例10: applyShapeProperties
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
protected void applyShapeProperties(Shape p)
{
p.setFill(fill);
p.setStroke(strokeColor);
p.setStrokeDashOffset(dashOffset);
p.setStrokeLineCap(lineCap);
p.setStrokeLineJoin(lineJoin);
p.setStrokeMiterLimit(miterLimit);
p.setStrokeType(strokeType);
p.setStrokeWidth(strokeWidth);
}
示例11: configShape
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
protected void configShape(Shape p)
{
p.setFill(fill);
p.setStroke(strokeColor);
p.setStrokeDashOffset(dashOffset);
p.setStrokeLineCap(lineCap);
p.setStrokeLineJoin(lineJoin);
p.setStrokeMiterLimit(miterLimit);
p.setStrokeType(strokeType);
p.setStrokeWidth(strokeWidth);
}
示例12: setShapeAttrs
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
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);
}
}
示例13: applyStyle
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
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));
}
示例14: decorateShape
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
private void decorateShape(Shape s, Color fill, Color stroke, double opacity) {
s.setMouseTransparent(true);
s.setFill(fill);
s.setStroke(stroke);
s.setOpacity(opacity);
}