本文整理汇总了Java中javafx.scene.shape.LineBuilder类的典型用法代码示例。如果您正苦于以下问题:Java LineBuilder类的具体用法?Java LineBuilder怎么用?Java LineBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LineBuilder类属于javafx.scene.shape包,在下文中一共展示了LineBuilder类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createTestGridScene
import javafx.scene.shape.LineBuilder; //导入依赖的package包/类
/**
* Create scene with grid.
* @return new scene
*/
private Scene createTestGridScene(){
double height = getMaxScreenHeight();
double width = getMaxScreenWidth();
Pane root = PaneBuilder.create()
.minHeight(height)
.minWidth(width)
.build();
for (int x = 0; x < width; x+=10) {
root.getChildren().add(
LineBuilder.create()
.startX(x)
.endX(x)
.startY(0)
.endY(height)
.build());
}
for (int y = 0; y < height; y+=10) {
root.getChildren().add(
LineBuilder.create()
.startX(0)
.endX(width)
.startY(y)
.endY(y)
.build());
}
return new Scene(root, 200, 200);
}
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:37,代码来源:FSTestApp.java
示例2: renderGraph
import javafx.scene.shape.LineBuilder; //导入依赖的package包/类
/**
* Render a graph to a particular <code>Group</code>
* @param graph
* @param layout
* @param viz
*/
private void renderGraph(Graph<String, Number> graph, Layout<String, Number> layout, Group viz) {
// draw the vertices in the graph
for (String v : graph.getVertices()) {
// Get the position of the vertex
Point2D p = layout.transform(v);
// draw the vertex as a circle
Circle circle = CircleBuilder.create()
.centerX(p.getX())
.centerY(p.getY())
.radius(CIRCLE_SIZE)
.build();
// add it to the group, so it is shown on screen
viz.getChildren().add(circle);
}
// draw the edges
for (Number n : graph.getEdges()) {
// get the end points of the edge
Pair<String> endpoints = graph.getEndpoints(n);
// Get the end points as Point2D objects so we can use them in the
// builder
Point2D pStart = layout.transform(endpoints.getFirst());
Point2D pEnd = layout.transform(endpoints.getSecond());
// Draw the line
Line line = LineBuilder.create()
.startX(pStart.getX())
.startY(pStart.getY())
.endX(pEnd.getX())
.endY(pEnd.getY())
.build();
// add the edges to the screen
viz.getChildren().add(line);
}
}
开发者ID:jeffreyguenther,项目名称:JavaFXTutorials,代码行数:45,代码来源:JUNGAndJavaFX.java
示例3: RaceTrack
import javafx.scene.shape.LineBuilder; //导入依赖的package包/类
public RaceTrack() {
ImageView carImageView = new ImageView(new Image(
DataAppPreloader.class.getResourceAsStream("images/car.png")));
road = SVGPathBuilder.create()
.content(trackPath).fill(null).stroke(Color.gray(0.4))
.strokeWidth(50)
.effect(DropShadowBuilder.create().radius(20).blurType(BlurType.ONE_PASS_BOX).build())
.build();
SVGPath trackLine = SVGPathBuilder.create()
.content(trackPath).fill(null).stroke(Color.WHITE)
.strokeDashArray(8d,6d).build();
Line startLine = LineBuilder.create()
.startX(610.312).startY(401.055).endX(610.312).endY(450.838)
.stroke(Color.WHITE).strokeDashArray(2d,2d).build();
Text startFinish = TextBuilder.create().text("START/FINISH").fill(Color.WHITE)
.x(570).y(475).build();
percentage = TextBuilder.create().text("0%")
.x(390).y(170).font(Font.font("System", 60))
.fill(Color.web("#ddf3ff"))
.stroke(Color.web("#73c0f7"))
.effect(DropShadowBuilder.create().radius(15).color(Color.web("#3382ba")).blurType(BlurType.ONE_PASS_BOX).build())
.build();
ImageView raceCarImg = new ImageView(new Image(
DataAppPreloader.class.getResourceAsStream("images/Mini-red-and-white.png")));
raceCarImg.setX(raceCarImg.getImage().getWidth()/2);
raceCarImg.setY(raceCarImg.getImage().getHeight()/2);
raceCarImg.setRotate(90);
raceCar = new Group(raceCarImg);
track = new Group(road, trackLine, startLine, startFinish);
track.setCache(true);
// add children
getChildren().addAll(track, raceCar, percentage);
// Create path animation that we will use to drive the car along the track
race = new PathTransition(Duration.seconds(1), road, raceCar);
race.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT);
race.play();
race.pause();
// center our content and set our size
setTranslateX(-road.getBoundsInLocal().getMinX());
setTranslateY(-road.getBoundsInLocal().getMinY());
setPrefSize(road.getBoundsInLocal().getWidth(), road.getBoundsInLocal().getHeight());
setMaxSize(USE_PREF_SIZE, USE_PREF_SIZE);
}
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:47,代码来源:RaceTrack.java
示例4: start
import javafx.scene.shape.LineBuilder; //导入依赖的package包/类
@Override public void start(Stage stage) {
final Group root;
Scene scene = SceneBuilder.create()
.width(500).height(500)
.fill(Color.WHITE)
.root(root = GroupBuilder.create()
.children(RectangleBuilder.create()
.layoutX(5).layoutY(5)
.width(490).height(490)
.fill(Color.LIGHTSKYBLUE)
.onMouseClicked(new EventHandler<MouseEvent>() {
// Eventhandler for mouse click event
@Override public void handle(MouseEvent e) {
if (clickcount > 2) { initialize(); }
for (int j = clickcount; j < 3; j++) {
org_x[j].set(e.getSceneX());
org_y[j].set(e.getSceneY());
}
clickcount++;
}
}).build(),
// line for x-axis through the Origin
LineBuilder.create()
.startX(5).startY(490)
.endX(495).endY(490)
.build(),
// Line for y-axis through the Origin
LineBuilder.create()
.startX(10).startY(5)
.endX(10).endY(495)
.build(),
// grid horizontal lines which interval is of 1cm
a_x_l[0], a_x_l[1], a_x_l[2], a_x_l[3],
a_x_l[4], a_x_l[5], a_x_l[6], a_x_l[7],
a_x_l[8], a_x_l[9], a_x_l[10], a_x_l[11],
// grid vertical lines which interval is of 1cm
a_y_l[0], a_y_l[1], a_y_l[2], a_y_l[3],
a_y_l[4], a_y_l[5], a_y_l[6], a_y_l[7],
a_y_l[8], a_y_l[9], a_y_l[10], a_y_l[11],
// Sides
l[0], l[1], l[2],
// Vertices
c[0], c[1], c[2],
// the printing space of the coordinates and
// the area of triangle
HBoxBuilder.create()
.layoutX(10)
.padding(new Insets(10, 10, 10, 10)).spacing(3)
.alignment(Pos.BOTTOM_CENTER)
.children(
LabelBuilder.create().text("A(").build(),
tx[0],
LabelBuilder.create().text(",").build(),
ty[0],
LabelBuilder.create().text("),").build(),
LabelBuilder.create().text("B(").build(),
tx[1],
LabelBuilder.create().text(",").build(),
ty[1],
LabelBuilder.create().text("),").build(),
LabelBuilder.create().text("C(").build(),
tx[2],
LabelBuilder.create().text(",").build(),
ty[2],
LabelBuilder.create().text(") ⇒ ").build(),
area_Label
).build()
).build()
).build();
stage.setTitle("Triangle Area");
stage.setScene(scene);
stage.show();
}
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:75,代码来源:TriangleArea.java
注:本文中的javafx.scene.shape.LineBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论