本文整理匯總了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);
}