本文整理汇总了Java中javafx.scene.canvas.GraphicsContext.fillRoundRect方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicsContext.fillRoundRect方法的具体用法?Java GraphicsContext.fillRoundRect怎么用?Java GraphicsContext.fillRoundRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.canvas.GraphicsContext
的用法示例。
在下文中一共展示了GraphicsContext.fillRoundRect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawShapes
import javafx.scene.canvas.GraphicsContext; //导入方法依赖的package包/类
private static void drawShapes(GraphicsContext gc) {
gc.setFill(Color.GREEN);
gc.setStroke(Color.BLUE);
gc.setLineWidth(5);
gc.strokeLine(40, 10, 10, 40);
gc.fillOval(10, 60, 30, 30);
gc.strokeOval(60, 60, 30, 30);
gc.fillRoundRect(110, 60, 30, 30, 10, 10);
gc.strokeRoundRect(160, 60, 30, 30, 10, 10);
gc.fillArc(10, 110, 30, 30, 45, 240, ArcType.OPEN);
gc.fillArc(60, 110, 30, 30, 45, 240, ArcType.CHORD);
gc.fillArc(110, 110, 30, 30, 45, 240, ArcType.ROUND);
gc.strokeArc(10, 160, 30, 30, 45, 240, ArcType.OPEN);
gc.strokeArc(60, 160, 30, 30, 45, 240, ArcType.CHORD);
gc.strokeArc(110, 160, 30, 30, 45, 240, ArcType.ROUND);
gc.fillPolygon(new double[]{10, 40, 10, 40},
new double[]{210, 210, 240, 240}, 4);
gc.strokePolygon(new double[]{60, 90, 60, 90},
new double[]{210, 210, 240, 240}, 4);
gc.strokePolyline(new double[]{110, 140, 110, 140},
new double[]{210, 210, 240, 240}, 4);
}
示例2: render
import javafx.scene.canvas.GraphicsContext; //导入方法依赖的package包/类
public void render(int indexX, int indexY, GraphicsContext gc) {
if (this == STANDARD) {
gc.setFill(Color.valueOf("#debf89"));
gc.fillRoundRect(indexX * 64, indexY * 64, 64, 64, 10, 10);
}
if (this == CORK) {
gc.setFill(Color.valueOf("#debf89").brighter().brighter());
gc.fillRoundRect(indexX * 64, indexY * 64, 64, 64, 10, 10);
}
if (this == HOLE) {
gc.setFill(Color.GRAY.brighter());
gc.fillOval(indexX * 64, indexY * 64, 64, 64);
}
}
示例3: render
import javafx.scene.canvas.GraphicsContext; //导入方法依赖的package包/类
public void render(GraphicsContext g)
{
g.setFill(COLOR_BACKGROUND);
g.fillRect(this.x, this.y, this.width, this.height);
g.setLineWidth(this.enabled ? OUTLINE_LINE_WIDTH : INACTIVE_LINE_WIDTH);
g.setStroke(this.outline);
g.strokeRoundRect(this.x, this.y, this.width, this.height,
OUTLINE_ROUND_RADIUS, OUTLINE_ROUND_RADIUS);
this.onRender(g);
if (!this.enabled)
{
g.setFill(COLOR_DISABLED_OVERLAY);
g.fillRoundRect(this.x, this.y, this.width, this.height,
OUTLINE_ROUND_RADIUS, OUTLINE_ROUND_RADIUS);
}
}
示例4: showPlayerInfo
import javafx.scene.canvas.GraphicsContext; //导入方法依赖的package包/类
public void showPlayerInfo(GraphicsContext gc) {
for (Tank tank : framework.getTanks()) {
int width = tank.getId().name().length() * 7 + 10;
gc.setFill(Color.LIGHTGRAY);
gc.fillRoundRect(tank.getX() - width / 2, tank.getY() - 65, width, 25, 4, 4);
gc.setFill(Color.WHITESMOKE);
gc.fillText(tank.getId().name(), tank.getX() - width / 2 + 5, tank.getY() - 50);
}
}
示例5: update
import javafx.scene.canvas.GraphicsContext; //导入方法依赖的package包/类
public void update(GraphicsContext gc) {
angle += rotation;
x += Math.sin(Math.toRadians(-angle)) * velocity;
y += Math.cos(Math.toRadians(-angle)) * velocity;
bounds.setLocation(x, y, 64, 64, angle);
//RENDER
gc.save();
Affine transform = new Affine(new Rotate(angle, x, y));
gc.transform(transform);
gc.setFill(Color.GREY);
gc.fillRoundRect(x - 32, y - 32, 64, 64, 3, 3);
gc.setFill(color);
gc.fillRect(x - 32 + 12, y - 32, 64 - 24, 64);
gc.restore();
//Update turret
turret.update(gc);
if (currentPickUp != null && currentPickUp.getTime() == 0) {
currentPickUp = null;
bulletType = BulletType.STANDARD;
}
}