本文整理匯總了Java中javafx.scene.shape.Polygon.setStrokeWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java Polygon.setStrokeWidth方法的具體用法?Java Polygon.setStrokeWidth怎麽用?Java Polygon.setStrokeWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.shape.Polygon
的用法示例。
在下文中一共展示了Polygon.setStrokeWidth方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createIconContent
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
public static Node createIconContent() {
Polygon polygon = new Polygon(new double[]{
45 , 10 ,
10 , 80 ,
80 , 80 ,
});
polygon.setStroke(Color.web("#b9c0c5"));
polygon.setStrokeWidth(5);
polygon.getStrokeDashArray().addAll(15d,15d);
polygon.setFill(null);
javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
effect.setOffsetX(1);
effect.setOffsetY(1);
effect.setRadius(3);
effect.setColor(Color.rgb(0,0,0,0.6));
polygon.setEffect(effect);
return polygon;
}
示例2: makeMultiPolygonScene
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
private static void makeMultiPolygonScene(Group group, MultiPolygon mPolygon, int color,
double biggestValue) {
//sceneSize divided by 2 because x and y axis are in the middle
double resizeFactor = sceneSizeY/biggestValue/2;
Polygon polygon = mPolygon.makeOuterPolygon(sceneSizeX, sceneSizeY, resizeFactor);
switch(color){
case 0: polygon.setFill(Color.GREY);break;
case 1: polygon.setFill(Color.DARKGREY);break;
}
polygon.setStrokeWidth(1);
polygon.setStroke(Color.BLACK);
group.getChildren().add(polygon);
Polygon[] holes = mPolygon.makeHoles(sceneSizeX, sceneSizeY, resizeFactor);
for(Polygon hole: holes){
hole.setFill(Color.WHITESMOKE);
hole.setStrokeWidth(1);
hole.setStroke(Color.BLACK);
group.getChildren().add(hole);
}
}
示例3: makeMultiPolygonScene
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
public static void makeMultiPolygonScene(Group group, MultiPolygon mPolygon, int color, double biggestValue) {
//sceneSize divided by 2 because x and y axis are in the middle
double resizeFactor = sceneSizeY/biggestValue/2;
Polygon polygon = mPolygon.makeOuterPolygon(sceneSizeX, sceneSizeY, resizeFactor);
switch(color){
case 0: polygon.setFill(Color.GREY);break;
case 1: polygon.setFill(Color.DARKGREY);break;
}
polygon.setStrokeWidth(1);
polygon.setStroke(Color.BLACK);
group.getChildren().add(polygon);
Polygon[] holes = mPolygon.makeHoles(sceneSizeX, sceneSizeY, resizeFactor);
for(Polygon hole: holes){
hole.setFill(Color.WHITESMOKE);
hole.setStrokeWidth(1);
hole.setStroke(Color.BLACK);
group.getChildren().add(hole);
}
}
示例4: setComplete
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
public void setComplete() {
complete = true;
double rLen = this.getWidth() - 5;
Polygon s1 = new Polygon(0, (rLen - 5) / 2,
(rLen - 5) / 2, (rLen - 5) / 2,
(rLen - 5) / 2, 0,
(rLen + 5) / 2, 0,
(rLen + 5) / 2, (rLen - 5) / 2,
rLen, (rLen - 5) / 2,
rLen, (rLen + 5) / 2,
(rLen + 5) / 2, (rLen + 5) / 2,
(rLen + 5) / 2, rLen,
(rLen - 5) / 2, rLen,
(rLen - 5) / 2, (rLen + 5) / 2,
0, (rLen + 5) / 2);
s1.setFill(Color.RED);
s1.setRotate(45);
s1.setStroke(Color.BLACK);
s1.setStrokeWidth(3);
getChildren().addAll(s1);
}
示例5: PolygonSample
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
public PolygonSample() {
super(180,90);
// Simple red filled triangle
Polygon polygon1 = new Polygon(new double[]{
45 , 10 ,
10 , 80 ,
80 , 80 ,
});
polygon1.setFill(Color.RED);
// Blue stroked polygon
Polygon polygon2 = new Polygon(new double[]{
135, 15,
160, 30,
160, 60,
135, 75,
110, 60,
110, 30
});
polygon2.setStroke(Color.DODGERBLUE);
polygon2.setStrokeWidth(2);
polygon2.setFill(null);
// Create a group to show all the polygons);
getChildren().add(new Group(polygon1, polygon2));
// REMOVE ME
setControls(
new SimplePropertySheet.PropDesc("Polygon 1 Fill", polygon1.fillProperty()),
new SimplePropertySheet.PropDesc("Polygon 2 Stroke", polygon2.strokeProperty())
);
// END REMOVE ME
}
示例6: makeNFPScene
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
private static void makeNFPScene(Group group,NoFitPolygon nfp, double biggestValue) {
//sceneSize divided by 2 because x and y axis are in the middle
double resizeFactor = sceneSizeY/(biggestValue)/2;
Polygon[] nfpPolygonList = nfp.toPolygonList(sceneSizeX, sceneSizeY, resizeFactor);
for(Polygon polygon : nfpPolygonList){
polygon.setStrokeWidth(3);
polygon.setStroke(Color.BLACK);
polygon.setFill(Color.TRANSPARENT);
group.getChildren().add(polygon);
}
}
示例7: makeNFPPolygonScene
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
private static void makeNFPPolygonScene(Group group,NoFitPolygon nfp, double biggestValue) {
//sceneSize divided by 2 because x and y axis are in the middle
double resizeFactor = sceneSizeY/(biggestValue)/2;
Polygon[] nfpPolygonList = nfp.toPolygonList(sceneSizeX, sceneSizeY, resizeFactor);
for(Polygon polygon : nfpPolygonList){
polygon.setStrokeWidth(6);
polygon.setStroke(Color.BLACK);
polygon.setFill(Color.TRANSPARENT);
group.getChildren().add(polygon);
}
}
示例8: makeNFPScene
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
private static void makeNFPScene(Group group,NoFitPolygon nfp, double biggestValue) {
//sceneSize divided by 2 because x and y axis are in the middle
double resizeFactor = sceneSizeY/biggestValue/2;
Color sligthlyLighterBlack = Color.web("0x201F18");
Polygon[] nfpPolygonList = nfp.toPolygonList(sceneSizeX, sceneSizeY, resizeFactor);
for(Polygon polygon : nfpPolygonList){
polygon.setStrokeWidth(5);
polygon.setStroke(Color.BLACK);
polygon.setFill(Color.TRANSPARENT);
group.getChildren().add(polygon);
}
}
示例9: CameraIcon
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
public CameraIcon(ObservableEntity oe) {
super(oe);
int w = W/2;
int h = H/2;
shape = new Polygon(-w, -h, w, -h, w, h, -w, h);
shape.setFill(Color.TRANSPARENT);
shape.setStrokeWidth(20);
shape.strokeProperty().bind(getPlayerColor());
shape.translateXProperty().bind(getMapX().subtract(W/2));
shape.translateYProperty().bind(getMapY().subtract(H));
}
示例10: makeMultiPolygonScene
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
private static void makeMultiPolygonScene(Group group, MultiPolygon mPolygon, int color,
double biggestValue) {
//sceneSize divided by 2 because x and y axis are in the middle
double resizeFactor = sceneSizeY/biggestValue/2;
// Color aColor = Color.web("0xC4392C");
// Color bColor = Color.web("0xEEE8C8");
Color aColor = Color.GRAY;
Color bColor = Color.DARKGRAY;
Color sligthlyLighterBlack = Color.web("0x201F18");
Polygon polygon = mPolygon.makeOuterPolygon(sceneSizeX, sceneSizeY, resizeFactor);
Circle refPoint = new Circle(resizeFactor * mPolygon.getOuterPolygon()[0].getxCoord() + sceneSizeX / 2,
-1* resizeFactor *mPolygon.getOuterPolygon()[0].getyCoord() + sceneSizeY / 2 , 5);
switch(color){
case 0:{
polygon.setFill(aColor);
refPoint.setFill(Color.TRANSPARENT);
refPoint.setStrokeType(StrokeType.INSIDE);
refPoint.setStrokeWidth(0);
refPoint.setStroke(Color.TRANSPARENT);
break;
}
case 1: {
polygon.setFill(bColor);
refPoint.setFill(Color.DARKGREY);
refPoint.setStrokeType(StrokeType.INSIDE);
refPoint.setStrokeWidth(1);
refPoint.setStroke(Color.BLACK);
break;
}
}
polygon.setStrokeWidth(2);
polygon.setStroke(sligthlyLighterBlack);
group.getChildren().add(polygon);
group.getChildren().add(refPoint);
Polygon[] holes = mPolygon.makeHoles(sceneSizeX, sceneSizeY, resizeFactor);
for(Polygon hole: holes){
hole.setFill(Color.WHITESMOKE);
hole.setStrokeWidth(1);
hole.setStroke(Color.BLACK);
group.getChildren().add(hole);
}
}
示例11: makeMultiPolygonScene
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
private static void makeMultiPolygonScene(Group group, MultiPolygon mPolygon, int color,
double biggestValue) {
//sceneSize divided by 2 because x and y axis are in the middle
double resizeFactor = sceneSizeY/biggestValue/2;
Color background = Color.web("0xc8c5b4");
Color aColor = Color.GREY;
Color bColor = Color.DARKGREY;
Color sligthlyLighterBlack = Color.web("0x201F18");
Polygon polygon = mPolygon.makeOuterPolygon(sceneSizeX, sceneSizeY, resizeFactor);
Circle refPoint = new Circle(resizeFactor * mPolygon.getOuterPolygon()[0].getxCoord() + sceneSizeX / 2,
-1* resizeFactor *mPolygon.getOuterPolygon()[0].getyCoord() + sceneSizeY / 2 , 5);
switch(color){
case 0:{
polygon.setFill(aColor);
// refPoint.setFill(Color.TRANSPARENT);
// refPoint.setStrokeType(StrokeType.INSIDE);
// refPoint.setStrokeWidth(0);
// refPoint.setStroke(Color.TRANSPARENT);
break;
}
case 1: {
polygon.setFill(bColor);
// refPoint.setFill(bColor);
// refPoint.setStrokeType(StrokeType.INSIDE);
// refPoint.setStrokeWidth(1);
// refPoint.setStroke(Color.TRANSPARENT);
break;
}
}
polygon.setStrokeWidth(2);
polygon.setStroke(Color.BLACK);
group.getChildren().add(polygon);
// group.getChildren().add(refPoint);
Polygon[] holes = mPolygon.makeHoles(sceneSizeX, sceneSizeY, resizeFactor);
for(Polygon hole: holes){
hole.setFill(Color.WHITESMOKE);
hole.setStrokeWidth(1);
hole.setStroke(Color.BLACK);
group.getChildren().add(hole);
}
}
示例12: drawProcedureStateIndicator
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
/**
* Draw arround the fixation point the procedure state indicator.
* - Draw CIRCLE when waiting for starting the procedure;
* - Draw TRIANGLE when procedure is paused;
* - Draw SQUARE when procedure is finished;
* @param indicator
*/
private void drawProcedureStateIndicator(String indicator) {
switch (indicator) {
case "Circle":
double radiusX = fixPointSizeInPxX * 1.5;
double radiusY = fixPointSizeInPxY * 1.5;
Ellipse ellipse = new Ellipse(centerOfTheGridInPxX, centerOfTheGridInPxY, radiusX, radiusY);
ellipse.setFill(Color.TRANSPARENT);
ellipse.setStroke(fixPointColor);
ellipse.setStrokeWidth(4);
displayPane.getChildren().add(ellipse);
break;
case "Triangle":
double triangleSizeX = fixPointSizeInPxX * 4.5;
double triangleSizeY = fixPointSizeInPxY * 4.5;
double twoThirdOfTheTriangleHeightX = (triangleSizeX * Math.sqrt(3)) / 3;
double twoThirdOfTheTriangleHeightY = (triangleSizeY * Math.sqrt(3)) / 3;
double angleForA = Math.toRadians(270);
double angleForB = Math.toRadians(30);
double angleForC = Math.toRadians(150);
double xA = centerOfTheGridInPxX + twoThirdOfTheTriangleHeightX * Math.cos(angleForA);
double yA = centerOfTheGridInPxY - twoThirdOfTheTriangleHeightY * Math.sin(angleForA);
double xB = centerOfTheGridInPxX + twoThirdOfTheTriangleHeightX * Math.cos(angleForB);
double yB = centerOfTheGridInPxY - twoThirdOfTheTriangleHeightY * Math.sin(angleForB);
double xC = centerOfTheGridInPxX + twoThirdOfTheTriangleHeightX * Math.cos(angleForC);
double yC = centerOfTheGridInPxY - twoThirdOfTheTriangleHeightY * Math.sin(angleForC);
Polygon polygon = new Polygon();
polygon.getPoints().addAll(xA, yA, xB, yB, xC, yC);
polygon.setFill(Color.TRANSPARENT);
polygon.setStroke(fixPointColor);
polygon.setStrokeWidth(4);
displayPane.getChildren().add(polygon);
break;
case "Square":
double sizeX = fixPointSizeInPxX * 3;
double sizeY = fixPointSizeInPxY * 3;
Rectangle rectangle = new Rectangle(centerOfTheGridInPxX - (sizeX / 2), centerOfTheGridInPxY - (sizeY / 2), sizeX, sizeY);
rectangle.setFill(Color.TRANSPARENT);
rectangle.setStroke(fixPointColor);
rectangle.setStrokeWidth(4);
displayPane.getChildren().add(rectangle);
break;
}
}
示例13: drawProcedureStateIndicator
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
/**
* Draw arround the fixation point the procedure state indicator.
* - Draw circle when waiting for starting the procedure;
* - Draw triangle when procedure is paused;
* - Draw square when procedure is finished;
* @param indicator
*/
private void drawProcedureStateIndicator(String indicator) {
switch (indicator) {
case "Circle":
double radiusX = (fixationPointSizeX * 1.5) * pixelsForOneDegreeX;
double radiusY = (fixationPointSizeY * 1.5) * pixelsForOneDegreeY;
Ellipse ellipse = new Ellipse(centerOfTheGridInPixelsX, centerOfTheGridInPixelsY, radiusX, radiusY);
ellipse.setFill(Color.TRANSPARENT);
ellipse.setStroke(fixationPointColor);
ellipse.setStrokeWidth(4);
displayPane.getChildren().add(ellipse);
break;
case "Triangle":
double triangleSizeX = (fixationPointSizeX * 4.5) * pixelsForOneDegreeX;
double triangleSizeY = (fixationPointSizeY * 4.5) * pixelsForOneDegreeY;
double twoThirdOfTheTriangleHeightX = (triangleSizeX * Math.sqrt(3)) / 3;
double twoThirdOfTheTriangleHeightY = (triangleSizeY * Math.sqrt(3)) / 3;
double angleForA = Math.toRadians(270);
double angleForB = Math.toRadians(30);
double angleForC = Math.toRadians(150);
double xA = centerOfTheGridInPixelsX + twoThirdOfTheTriangleHeightX * Math.cos(angleForA);
double yA = centerOfTheGridInPixelsY - twoThirdOfTheTriangleHeightY * Math.sin(angleForA);
double xB = centerOfTheGridInPixelsX + twoThirdOfTheTriangleHeightX * Math.cos(angleForB);
double yB = centerOfTheGridInPixelsY - twoThirdOfTheTriangleHeightY * Math.sin(angleForB);
double xC = centerOfTheGridInPixelsX + twoThirdOfTheTriangleHeightX * Math.cos(angleForC);
double yC = centerOfTheGridInPixelsY - twoThirdOfTheTriangleHeightY * Math.sin(angleForC);
Polygon polygon = new Polygon();
polygon.getPoints().addAll(xA, yA, xB, yB, xC, yC);
polygon.setFill(Color.TRANSPARENT);
polygon.setStroke(fixationPointColor);
polygon.setStrokeWidth(4);
displayPane.getChildren().add(polygon);
break;
case "Square":
double sizeX = (fixationPointSizeX * 3) * pixelsForOneDegreeX;
double sizeY = (fixationPointSizeY * 3) * pixelsForOneDegreeY;
Rectangle rectangle = new Rectangle(centerOfTheGridInPixelsX - (sizeX / 2), centerOfTheGridInPixelsY - (sizeY / 2), sizeX, sizeY);
rectangle.setFill(Color.TRANSPARENT);
rectangle.setStroke(fixationPointColor);
rectangle.setStrokeWidth(4);
displayPane.getChildren().add(rectangle);
break;
}
}
示例14: VisualEdge
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
public VisualEdge(Edge<Vertex<V>> edge, Pane pane) {
super(edge.getFrom().get(Position.class).pos.x * Const.cellSize + Const.cellSize / 2, edge.getFrom().get(Position.class).pos.y * Const.cellSize + Const.cellSize / 2,
edge.getTo().get(Position.class).pos.x * Const.cellSize + Const.cellSize / 2, edge.getTo().get(Position.class).pos.y * Const.cellSize + Const.cellSize / 2);
this.edge = edge;
setId("E" + edge.hashCode());
getStyleClass().add("visual-edge");
left = WSeminar.r.nextBoolean();
text = new Text();
if (edge instanceof WeightedEdge) {
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(2);
text.setText(nf.format(((WeightedEdge<Vertex<V>>) edge).getWeight()));
text.setOpacity(0);
pane.getChildren().add(text);
}
p = new Polygon(-5, 4, 5, 4, 0, -6);
if (edge.isDirected()) {
p.setOpacity(0);
pane.getChildren().add(p);
}
ChangeListener<Number> cl = (obs, newVal, oldVal) -> {
setColor(color);
text.setTranslateX(0.5f * (getStartX() + getEndX()) - (left ? text.getBoundsInLocal().getWidth() : 0));
text.setTranslateY(0.5f * (getStartY() + getEndY()));
Vector2 dir = new Vector2((float) getEndX() - (float) getStartX(), (float) getEndY() - (float) getStartY()).nor();
Vector2 back = dir.clone().scl(18);
p.setTranslateX(getEndX() - back.x);
p.setTranslateY(getEndY() - back.y);
p.setRotate(Math.toDegrees(Math.atan2(dir.y, dir.x)) + 90);
};
opacityProperty().addListener((obs, newVal, oldVal) -> {
if (newVal.doubleValue() == 1 && oldVal.doubleValue() == 0) return;
text.setOpacity(newVal.doubleValue());
p.setOpacity(newVal.doubleValue());
});
setColor(Color.DARKGRAY);
cl.changed(null, 0, 0); // initial placement for sub elements
EventHandler<MouseEvent> en = e -> {
if (!path) setColor(Color.valueOf("#5f5f5f"));
};
EventHandler<MouseEvent> ex = e -> {
if (!path) setColor(active ? Color.valueOf("#2279e5") : Color.DARKGRAY);
};
pane.getParent().addEventHandler(ScrollEvent.ANY, e -> {
if (getScene() == null) return;
Slider zoom = ((Slider) getScene().lookup("#zoom"));
setStrokeWidth(2 + Math.max(0, 15 * (100 - zoom.getValue()) / 100));
});
setOnMouseEntered(en);
setOnMouseExited(ex);
p.setOnMouseEntered(en);
p.setOnMouseExited(ex);
startXProperty().addListener(cl);
startYProperty().addListener(cl);
endXProperty().addListener(cl);
endYProperty().addListener(cl);
setStrokeWidth(2);
setStrokeLineCap(StrokeLineCap.ROUND);
p.setStrokeWidth(1);
}
示例15: drawPolygon
import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
private void drawPolygon() {
int categLength = categoriesName.length;
for (int j = 0; j < allCircle.size() / categLength; j++) {
double points[] = new double[categLength * 2];
int index = 0;
for (int i = 0; i < categLength; i++) {
points[index] = allCircle.get(i + categLength * j).getCenterX();
points[index + 1] = allCircle.get(i + categLength * j).getCenterY();
index = index + 2;
}
Polygon polygon = new Polygon(points);
polygon.setStroke(Color.TRANSPARENT);
polygon.setFill(getPolygonColor(j));
polygon.setStrokeWidth(2);
if (isAnimated) {
polygonTransitioAnimation = new ScaleTransition(Duration.millis(700), polygon);
polygonTransitioAnimation.setFromX(0);
polygonTransitioAnimation.setFromY(0);
polygonTransitioAnimation.setByX(1.0f);
polygonTransitioAnimation.setByY(1.0f);
polygonTransitioAnimation.play();
}
getChildren().add(polygon);
}
}