javafx 用GraphicsContext如何画虚线?
展开全部
Line line1 = new Line(20, 40, 270, 40);
line1.getStrokeDashArray().addAll(25d, 20d, 5d, 20d);
Line line2 = new Line(20, 60, 270, 60);
line2.getStrokeDashArray().addAll(50d, 40d);
Line line3 = new Line(20, 80, 270, 80);
line3.getStrokeDashArray().addAll(25d, 10d);
Line line4 = new Line(20, 100, 270, 100);
line4.getStrokeDashArray().addAll(2d);
Line line5 = new Line(20, 120, 270, 120);
line5.getStrokeDashArray().addAll(2d, 21d);
pane.getChildren().addAll(line1, line2, line3, line4, line5);
更多追问追答
追问
如果我是用GraphicsContext画出来的线,用什么办法把它设置成虚线,如:
graphicsContext.strokeLine(20,100,170,100)
追答
没找到GraphicsContent画虚线的方法。和Java 2D完全不一样了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询