当前位置: 首页>>代码示例>>Java>>正文


Java Group.setCache方法代码示例

本文整理汇总了Java中javafx.scene.Group.setCache方法的典型用法代码示例。如果您正苦于以下问题:Java Group.setCache方法的具体用法?Java Group.setCache怎么用?Java Group.setCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.Group的用法示例。


在下文中一共展示了Group.setCache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: RaceTrack

import javafx.scene.Group; //导入方法依赖的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

示例2: initGraphics

import javafx.scene.Group; //导入方法依赖的package包/类
private void initGraphics() {
    main = new Region();
    main.getStyleClass().setAll("main");

    frame = new Region();
    frame.getStyleClass().setAll("frame");

    sectionsCanvas = new Canvas(width, barHeight);
    sections = sectionsCanvas.getGraphicsContext2D();

    currentValuePointer = new Region();
    currentValuePointer.getStyleClass().setAll("normal-current-value-pointer");
    currentValuePointer.setPrefSize(50, 20);
    currentValuePointer.setCache(true);
    currentValuePointer.setCacheHint(CacheHint.SPEED);

    currentValueText = new Text(Double.toString(getSkinnable().getCurrentValue()));
    currentValueText.getStyleClass().setAll("current-value-text");
    currentValueText.setCache(true);
    currentValueText.setCacheHint(CacheHint.SPEED);

    currentValuePointerGroup = new Group(currentValuePointer, currentValueText);
    currentValuePointerGroup.setCache(true);
    currentValuePointerGroup.setCacheHint(CacheHint.SPEED);

    titleText = new Text(getSkinnable().getTitle());
    titleText.getStyleClass().setAll("title");

    unitText = new Text(getSkinnable().getUnit());
    unitText.getStyleClass().setAll("unit");

    pane = new Pane();
    pane.getChildren().setAll(main,
            frame,
            sectionsCanvas,
            unitText,
            titleText,
            currentValuePointerGroup);

    getChildren().setAll(pane);

    resize();
}
 
开发者ID:assemblits,项目名称:dynamo,代码行数:44,代码来源:LevelBarSkin.java


注:本文中的javafx.scene.Group.setCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。