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


Java Polygon.setFill方法代碼示例

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


在下文中一共展示了Polygon.setFill方法的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: DynamicArrowView

import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
public DynamicArrowView(Shape source, Shape target) {
	Polygon polygon = new Polygon(0, 0, 30, 0, 15, 15);
	transformArrow(source, target, polygon);

	source.translateXProperty().addListener(getChangeListener(source, target, polygon));
	target.translateXProperty().addListener(getChangeListener(source, target, polygon));
	source.translateYProperty().addListener(getChangeListener(source, target, polygon));
	target.translateYProperty().addListener(getChangeListener(source, target, polygon));

	polygon.getTransforms().addAll(trans1, rot, trans2);
	trans2.setX(-15);
	trans2.setY(-15);
	polygon.setFill(Color.GRAY);

	getChildren().add(polygon);
}
 
開發者ID:alexejsailer,項目名稱:FXGraphs,代碼行數:17,代碼來源:DynamicArrowView.java

示例5: 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

示例6: apply

import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
@Override
public Node apply(int lineNumber) {
    Polygon triangle = new Polygon(0.0, 0.0, 40.0, 5.0, 0.0, 10.0);
    triangle.setFill(Color.GREEN);

    ObservableValue<Boolean> visible = Val.map(
            shownLine,
            sl -> sl == lineNumber);

    triangle.visibleProperty().bind(
            Val.flatMap(triangle.sceneProperty(), scene -> {
                return scene != null ? visible : Val.constant(false);
            })
    );

    return triangle;
}
 
開發者ID:iazarny,項目名稱:gitember,代碼行數:18,代碼來源:ArrowFactory.java

示例7: setupResizer

import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
/** Add and initializes a resizer element to this block */
private void setupResizer() {
    Polygon triangle = new Polygon();
    triangle.getPoints().addAll(new Double[]{20.0, 20.0, 20.0, 0.0, 0.0, 20.0});
    triangle.setFill(Color.BLUE);

    this.resizer = new Pane(triangle);
    triangle.setLayoutX(10);
    triangle.setLayoutY(10);
    this.resizer.setManaged(false);
    this.getChildren().add(this.resizer);
    this.resizer.relocate(240-20, 320-20);

    DragContext sizeDrag = new DragContext(this.resizer);
    sizeDrag.setDragLimits(new BoundingBox(200, 200, Integer.MAX_VALUE, Integer.MAX_VALUE));
}
 
開發者ID:viskell,項目名稱:viskell,代碼行數:17,代碼來源:Lane.java

示例8: 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

示例9: 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

示例10: 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

示例11: createArrow

import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
public static Polygon createArrow() {
    Polygon polygon = new Polygon(new double[]{
        7.5, 0,
        15, 15,
        10, 15,
        10, 30,
        5, 30,
        5, 15,
        0, 15
    });
    polygon.setFill(Color.web("#ff0900"));
    
    return polygon;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:15,代碼來源:TranslateSample.java

示例12: 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

示例13: 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

示例14: apply

import javafx.scene.shape.Polygon; //導入方法依賴的package包/類
@Override
public Node apply(int lineNumber) {
    Polygon triangle = new Polygon(0.0, 0.0, 10.0, 5.0, 0.0, 10.0);
    triangle.setFill(Color.GREEN);
    ObservableValue<Boolean> visible = Val.map(shownLine, sl -> sl == lineNumber);
    triangle.visibleProperty().bind(
            Val.flatMap(triangle.sceneProperty(), scene -> {
                return scene != null ? visible : Val.constant(false);
            }));
    return triangle;
}
 
開發者ID:kasirgalabs,項目名稱:ETUmulator,代碼行數:12,代碼來源:ArrowFunction.java

示例15: 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


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