當前位置: 首頁>>代碼示例>>Java>>正文


Java Polygon.setStroke方法代碼示例

本文整理匯總了Java中javafx.scene.shape.Polygon.setStroke方法的典型用法代碼示例。如果您正苦於以下問題:Java Polygon.setStroke方法的具體用法?Java Polygon.setStroke怎麽用?Java Polygon.setStroke使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.shape.Polygon的用法示例。


在下文中一共展示了Polygon.setStroke方法的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;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:PolygonSample.java

示例2: initialize

import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
public void initialize() 
{
   // points that define a five-pointed star shape
   Double[] points = {205.0,150.0, 217.0,186.0, 259.0,186.0, 
      223.0,204.0, 233.0,246.0, 205.0,222.0, 177.0,246.0, 187.0,204.0, 
      151.0,186.0, 193.0,186.0};
   
   // create 18 more stars
   for (int count = 0; count < 18; ++count)
   {
      // create a new Polygon and copy existing points into it
      Polygon newStar = new Polygon();
      newStar.getPoints().addAll(points); 

      // create random Color and set as newStar's fill
      newStar.setStroke(Color.GREY);
      newStar.setFill(Color.rgb(random.nextInt(255), 
         random.nextInt(255), random.nextInt(255), 
         random.nextDouble())); 

      // apply a rotation to the shape
      newStar.getTransforms().add(
         Transform.rotate(count * 20, 150, 150));
      anchorPane.getChildren().add(newStar);
   } 
}
 
開發者ID:cleitonferreira,項目名稱:LivroJavaComoProgramar10Edicao,代碼行數:27,代碼來源:DrawStarsController.java

示例3: 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);
       }
	
}
 
開發者ID:TonyWauters,項目名稱:JNFP,代碼行數:27,代碼來源:NoFitPolygonStages.java

示例4: 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);
      }   
  }
 
開發者ID:TonyWauters,項目名稱:JNFP,代碼行數:25,代碼來源:PolygonPairStages.java

示例5: 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);
}
 
開發者ID:AlmasB,項目名稱:Consume,代碼行數:22,代碼來源:LevelMenu.java

示例6: displayTriangles

import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
private void displayTriangles(int order, Point2D p1,
		Point2D p2, Point2D p3) {
	if (order == 0) {
		// Draw a triangle to connect three points
		Polygon triangle = new Polygon();
		triangle.getPoints().addAll(p1.getX(), p1.getY(), p2.getX(),
			p2.getY(), p3.getX(), p3.getY());
		triangle.setStroke(Color.BLACK);
		triangle.setFill(Color.WHITE);

		this.getChildren().add(triangle);
	}
	else {
		//Get the midpoint on each edge in the triangle
		Point2D p12= p1.midpoint(p2);
		Point2D p23= p2.midpoint(p3);
		Point2D p31= p3.midpoint(p1);

		// Recursively display three triangles
		displayTriangles(order - 1, p1, p12, p31);
		displayTriangles(order - 1, p12, p2, p23);
		displayTriangles(order - 1, p31, p23, p3);
	}
}
 
開發者ID:jsquared21,項目名稱:Intro-to-Java-Programming,代碼行數:25,代碼來源:Exercise_18_19.java

示例7: displayTriangles

import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
private void displayTriangles(int order, Point2D p1,
		Point2D p2, Point2D p3) {
	if (order == 0) {
		// Draw a triangle to connect three points
		Polygon triangle = new Polygon();
		triangle.getPoints().addAll(p1.getX(), p1.getY(), p2.getX(),
			p2.getY(), p3.getX(), p3.getY());
		triangle.setStroke(Color.BLACK);
		triangle.setFill(Color.BLACK);

		this.getChildren().add(triangle);
	}
	else {
		//Get the midpoint on each edge in the triangle
		Point2D p12= p1.midpoint(p2);
		Point2D p23= p2.midpoint(p3);
		Point2D p31= p3.midpoint(p1);

		// Recursively display three triangles
		displayTriangles(order - 1, p1, p12, p31);
		displayTriangles(order - 1, p12, p2, p23);
		displayTriangles(order - 1, p31, p23, p3);
	}
}
 
開發者ID:jsquared21,項目名稱:Intro-to-Java-Programming,代碼行數:25,代碼來源:Exercise_18_36.java

示例8: 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
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:34,代碼來源:PolygonSample.java

示例9: createUMLArrow

import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
public static Polygon createUMLArrow() {
    Polygon polygon = new Polygon(new double[]{
        7.5, 0,
        15, 15,
        7.51, 15,
        7.51, 40,
        7.49, 40,
        7.49, 15,
        0, 15
    });
    polygon.setFill(Color.WHITE);
    polygon.setStroke(Color.BLACK);
    return polygon;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:15,代碼來源:CustomNodeSample.java

示例10: 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);
	}
	
}
 
開發者ID:TonyWauters,項目名稱:JNFP,代碼行數:16,代碼來源:NoFitPolygonStages.java

示例11: 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);
	}
	
}
 
開發者ID:TonyWauters,項目名稱:JNFP,代碼行數:16,代碼來源:NoFitPolygonStages.java

示例12: 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);
	}
	
}
 
開發者ID:TonyWauters,項目名稱:JNFP,代碼行數:16,代碼來源:NoFitPolygonStages.java

示例13: MenuItem

import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
public MenuItem(String name) {
	int n = name.length();
    Polygon bg = new Polygon(
            0, 0,
            220, 0,
            245, 25,
            220, 50,
            0, 50
    );
    bg.setStroke(Color.color(1, 1, 1, 0.1));//75));
    //bg.setEffect(new GaussianBlur());
    bg.fillProperty().bind(
            Bindings.when(pressedProperty())
                    .then(Color.color(1, 1, 1, 0.35))//Color.color(139D/255D, 69D/255D, 19D/255D, 0.35))
                    .otherwise(Color.color(1, 1, 1, 0.15))
    );

    text = new Text(name);
    text.setTranslateX((18 - n) * 6.5);
    text.setTranslateY(34);
    text.setFont(Font.loadFont(MenuApp.class.getResource("/fonts/Penumbra-HalfSerif-Std_35114.ttf").toExternalForm(), 22));
    text.setFill(Color.LIGHTGOLDENRODYELLOW);//.CORAL);//.WHITE);
    text.effectProperty().bind(
            Bindings.when(hoverProperty())
                    .then(shadow)
                    .otherwise(blur)
    );

    getChildren().addAll(bg, text);
}
 
開發者ID:mars-sim,項目名稱:mars-sim,代碼行數:31,代碼來源:MenuItem.java

示例14: Civ6MenuItem

import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
public Civ6MenuItem(String name) {
    Polygon bg = new Polygon(
            0, 0,
            200, 0,
            215, 15,
            200, 30,
            0, 30
    );
    bg.setStroke(Color.color(1, 1, 1, 0.75));
    bg.setEffect(new GaussianBlur());

    bg.fillProperty().bind(
            Bindings.when(pressedProperty())
                    .then(Color.color(0, 0, 0, 0.75))
                    .otherwise(Color.color(0, 0, 0, 0.25))
    );

    text = new Text(name);
    text.setTranslateX(5);
    text.setTranslateY(20);
    text.setFont(Font.loadFont(Civ6MenuApp.class.getResource("res/Penumbra-HalfSerif-Std_35114.ttf").toExternalForm(), 14));
    text.setFill(Color.WHITE);

    text.effectProperty().bind(
            Bindings.when(hoverProperty())
                    .then(shadow)
                    .otherwise(blur)
    );

    getChildren().addAll(bg, text);
}
 
開發者ID:AlmasB,項目名稱:FXTutorials,代碼行數:32,代碼來源:Civ6MenuItem.java

示例15: drawTriangle

import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
/** Create a polygon */
private void drawTriangle(Pane pane, ArrayList<Circle> p) {
	Polygon polygon = new Polygon();
	pane.getChildren().add(polygon);
	ObservableList<Double> points = polygon.getPoints();
	for (int i = 0; i < p.size(); i++) {
		points.add(p.get(i).getCenterX());
		points.add(p.get(i).getCenterY());
	}
	polygon.setFill(Color.WHITE);
	polygon.setStroke(Color.BLACK);
}
 
開發者ID:jsquared21,項目名稱:Intro-to-Java-Programming,代碼行數:13,代碼來源:Exercise_15_20.java


注:本文中的javafx.scene.shape.Polygon.setStroke方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。