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


Java CacheHint類代碼示例

本文整理匯總了Java中javafx.scene.CacheHint的典型用法代碼示例。如果您正苦於以下問題:Java CacheHint類的具體用法?Java CacheHint怎麽用?Java CacheHint使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CacheHint類屬於javafx.scene包,在下文中一共展示了CacheHint類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import javafx.scene.CacheHint; //導入依賴的package包/類
private void init(Stage primaryStage) {
    VBox root  = new VBox();
    fpsLabel = new Label("FPS:");
    fpsLabel.setStyle("-fx-font-size: 5em;-fx-text-fill: red;");
    fpsLabel.setOnMouseClicked((event) -> {
        tracker.resetAverageFPS();
    });


    FlowPane flow = new FlowPane();
    flow.setCache(true);
    flow.setCacheHint(CacheHint.SPEED);
    root.getChildren().addAll(fpsLabel,flow);
    Scene scene = new Scene(root, 500, 2000);
    createPerformanceTracker(scene);
    primaryStage.setScene(scene);
    List< ScatterChart<Number, Number>> result = new ArrayList<>();
    for(int i =0; i<10;i++) {
        ScatterChart<Number, Number> tmp = createChart();
        result.add(tmp);
    }
    flow.getChildren().setAll(result);
}
 
開發者ID:amoAHCP,項目名稱:JavaOne2015JavaFXPitfalls,代碼行數:24,代碼來源:AdvancedScatterChartSample.java

示例2: RowPane

import javafx.scene.CacheHint; //導入依賴的package包/類
public RowPane(boolean isFirstRowInBox, int nrOfClosingBoxes) {
    super();
    this.isFirstRowInBox = isFirstRowInBox;
    this.setNrOfClosingBoxes(nrOfClosingBoxes);
    this.numberOfPrompts = 0;
    TextField tfExpression = new TextField();
    tfExpression.setPromptText("Formula");
    tfExpression.setId("expression");
    tfExpression.getStyleClass().add("myText");
    tfExpression.setPrefWidth(580);
    this.setCenter(tfExpression);
    this.setRight(new RulePane());
    this.setCache(true);
    this.setCacheShape(true);
    this.setCacheHint(CacheHint.DEFAULT);
}
 
開發者ID:nonilole,項目名稱:Conan,代碼行數:17,代碼來源:RowPane.java

示例3: UnitedStatesMapPane

import javafx.scene.CacheHint; //導入依賴的package包/類
public UnitedStatesMapPane() {
    getStyleClass().add("map-pane");
    setMinSize(USE_PREF_SIZE, USE_PREF_SIZE);
    setPrefHeight(450);
    setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    
    liveMap.setId("liveMap");
    liveMap.setManaged(false);
        liveMap.setCache(true);
        liveMap.setCacheHint(CacheHint.SCALE);
    getChildren().add(liveMap);
    overlayGroup.setId("overlay");
    
    // setip map transforms
    liveMap.getTransforms().setAll(mapPreTranslate, mapScale, mapPostTranslate);
    // load map fxml
    try {
        statesGroup = FXMLLoader.load(UnitedStatesMapPane.class.getResource("us-states-map.fxml"));
    } catch (IOException e) {
        e.printStackTrace();
    }
    // set live map children
    liveMap.getChildren().addAll(statesGroup, overlayGroup);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:25,代碼來源:UnitedStatesMapPane.java

示例4: newSong

import javafx.scene.CacheHint; //導入依賴的package包/類
@Override
public void newSong(final Song song) {
	play.setGraphic(pauseImage);
	artwork.setImage(song.getAlbum().getArtwork());
	artwork.setSmooth(true);
	artwork.setCache(true);
	artwork.setCacheHint(CacheHint.QUALITY);
	artwork.setPreserveRatio(true);
	artwork.setFitWidth(100);
	songLength.setText(song.getDuration());

	final StringBuilder title = new StringBuilder(song.getTitle());

	if (song.getArtist() != null) {
		title.append(" - ").append(song.getArtist().getName());
	}
	songTitle.setText(title.toString());
}
 
開發者ID:jakemanning,項目名稱:boomer-tuner,代碼行數:19,代碼來源:RootView.java

示例5: addImageView

import javafx.scene.CacheHint; //導入依賴的package包/類
private void addImageView(final Image i) {
	try {
		final String imageName = i.getUri().toURL().toString();
		ImageView imageView = new ImageView(new javafx.scene.image.Image(imageName));
		imageView.setSmooth(true);
		imageView.setCache(true);
		imageView.setCacheHint(CacheHint.SPEED);
		imageView.setPreserveRatio(true);
		imageView.setFitWidth(200);

		Platform.runLater(() -> {
			tilePane.getChildren().add(imageView);
		});

	} catch (MalformedURLException e) {
		System.out.println("URL Conversion didn't work");
		e.printStackTrace();
	}
}
 
開發者ID:jakemanning,項目名稱:boomer-tuner,代碼行數:20,代碼來源:ImagesView.java

示例6: flipForward

import javafx.scene.CacheHint; //導入依賴的package包/類
private void flipForward() {
    timeline.stop();

    flap.setCache(true);
    flap.setCacheHint(CacheHint.ROTATE);
    //flap.setCacheHint(CacheHint.SPEED);

    currentSelectionIndex++;
    if (currentSelectionIndex >= characters.size()) {
        currentSelectionIndex = 0;
    }
    nextSelectionIndex = currentSelectionIndex + 1;
    if (nextSelectionIndex >= characters.size()) {
        nextSelectionIndex = 0;
    }
    KeyValue keyValueFlap = new KeyValue(rotateFlap.angleProperty(), 180, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
    //KeyValue keyValueFlap = new KeyValue(rotateFlap.angleProperty(), 180, Interpolator.EASE_IN);
    KeyFrame keyFrame     = new KeyFrame(Duration.millis(tile.getFlipTimeInMS()), keyValueFlap);
    timeline.getKeyFrames().setAll(keyFrame);
    timeline.play();
}
 
開發者ID:HanSolo,項目名稱:tilesfx,代碼行數:22,代碼來源:FlipTileSkin.java

示例7: resize

import javafx.scene.CacheHint; //導入依賴的package包/類
private void resize() {
    width  = getWidth() - getInsets().getLeft() - getInsets().getRight();
    height = getHeight() - getInsets().getTop() - getInsets().getBottom();

    if (ASPECT_RATIO * width > height) {
        width = 1 / (ASPECT_RATIO / height);
    } else if (1 / (ASPECT_RATIO / height) > width) {
        height = ASPECT_RATIO * width;
    }

    if (width > 0 && height > 0) {
        if (isZoomEnabled()) resetZoom();

        pane.setCache(true);
        pane.setCacheHint(CacheHint.SCALE);

        pane.setScaleX(width / PREFERRED_WIDTH);
        pane.setScaleY(height / PREFERRED_HEIGHT);

        group.resize(width, height);
        group.relocate((getWidth() - width) * 0.5, (getHeight() - height) * 0.5);

        pane.setCache(false);
    }
}
 
開發者ID:haris44,項目名稱:Paradinc-FX,代碼行數:26,代碼來源:World.java

示例8: flipToFront

import javafx.scene.CacheHint; //導入依賴的package包/類
public void flipToFront() {
    if (Double.compare(rotate.getAngle(), 0) == 0) return;
    KeyValue kvStart = new KeyValue(rotate.angleProperty(), 180, Interpolator.EASE_IN);
    KeyValue kvStop  = new KeyValue(rotate.angleProperty(), 0, Interpolator.EASE_OUT);
    KeyFrame kfStart = new KeyFrame(Duration.ZERO, kvStart);
    KeyFrame kfStop  = new KeyFrame(Duration.millis(flipTime), kvStop);
    flipToFront.getKeyFrames().setAll(kfStart, kfStop);
    
    front.setCache(true);
    front.setCacheHint(CacheHint.ROTATE);
    back.setCache(true);
    back.setCacheHint(CacheHint.ROTATE);
    
    flipToFront.setOnFinished(event -> {
        front.setCache(false);
        back.setCache(false);
        fireEvent(new FlipEvent(FlipPanel.this, FlipPanel.this, FlipEvent.FLIP_TO_FRONT_FINISHED));
    });
    flipToFront.play();
}
 
開發者ID:Naoghuman,項目名稱:Incubator,代碼行數:21,代碼來源:FlipPanel.java

示例9: flipToBack

import javafx.scene.CacheHint; //導入依賴的package包/類
public void flipToBack() {
    if (Double.compare(rotate.getAngle(), 180) == 0) return;
    KeyValue kvStart = new KeyValue(rotate.angleProperty(), 0, Interpolator.EASE_IN);
    KeyValue kvStop  = new KeyValue(rotate.angleProperty(), 180, Interpolator.EASE_OUT);
    KeyFrame kfStart = new KeyFrame(Duration.ZERO, kvStart);
    KeyFrame kfStop  = new KeyFrame(Duration.millis(flipTime), kvStop);
    flipToBack.getKeyFrames().setAll(kfStart, kfStop);

    front.setCache(true);
    front.setCacheHint(CacheHint.ROTATE);
    back.setCache(true);
    back.setCacheHint(CacheHint.ROTATE);
    
    flipToBack.setOnFinished(event -> {
        front.setCache(false);
        back.setCache(false);
        fireEvent(new FlipEvent(FlipPanel.this, FlipPanel.this, FlipEvent.FLIP_TO_BACK_FINISHED));
    });
    flipToBack.play();
}
 
開發者ID:Naoghuman,項目名稱:Incubator,代碼行數:21,代碼來源:FlipPanel.java

示例10: Particle

import javafx.scene.CacheHint; //導入依賴的package包/類
public Particle() {
    super();

    // Size
    double size = 50 * (RND.nextDouble() * 0.6) + 0.1;
    setPrefSize(size, size);

    //getStyleClass().add("bubble");
    getChildren().addAll(createBubble(size));

    // Position
    setLayoutX(RND.nextDouble() * WIDTH);
    setLayoutY(HEIGHT + size);

    // Velocity
    vX = (RND.nextDouble() * 0.5) - 0.25;
    vY = (-(RND.nextDouble() * 2) - 0.5) * (size / 50);

    // Opacity
    setOpacity((RND.nextDouble() * 0.6) + 0.4);

    // Enable Caching
    setCache(true);
    setCacheHint(CacheHint.SPEED);
}
 
開發者ID:HanSolo,項目名稱:particlesfx,代碼行數:26,代碼來源:NodeBubbles.java

示例11: redraw

import javafx.scene.CacheHint; //導入依賴的package包/類
@Override protected void redraw() {
    sectionsVisible = gauge.getSectionsVisible();
    locale          = gauge.getLocale();
    barColor        = gauge.getBarColor();
    thresholdColor  = gauge.getThresholdColor();
    needle.setFill(gauge.getNeedleColor());
    titleText.setFill(gauge.getTitleColor());
    subTitleText.setFill(gauge.getSubTitleColor());
    unitText.setFill(gauge.getUnitColor());
    valueText.setFill(gauge.getValueColor());
    buttonTooltip.setText(gauge.getButtonTooltipText());

    mainCanvas.setCache(false);
    mainCanvas.setWidth(size);
    mainCanvas.setHeight(size);
    drawMainCanvas();
    mainCanvas.setCache(true);
    mainCanvas.setCacheHint(CacheHint.QUALITY);
    resizeText();
}
 
開發者ID:HanSolo,項目名稱:Medusa,代碼行數:21,代碼來源:ModernSkin.java

示例12: redraw

import javafx.scene.CacheHint; //導入依賴的package包/類
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    shadowGroup.setEffect(clock.getShadowsEnabled() ? dropShadow : null);

    // Tick Marks
    tickCanvas.setCache(false);
    drawTicks();
    tickCanvas.setCache(true);
    tickCanvas.setCacheHint(CacheHint.QUALITY);

    needle.setStroke(clock.getHourColor());

    ZonedDateTime time = clock.getTime();

    updateTime(time);
}
 
開發者ID:HanSolo,項目名稱:Medusa,代碼行數:19,代碼來源:DesignClockSkin.java

示例13: redraw

import javafx.scene.CacheHint; //導入依賴的package包/類
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    locale               = gauge.getLocale();
    formatString         = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f").toString();
    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();

    barBackground.setStroke(gauge.getBarBackgroundColor());

    // Areas, Sections and Tick Marks
    sectionCanvas.setCache(false);
    sectionCtx.clearRect(0, 0, size, size);
    if (gauge.isGradientBarEnabled() && gauge.getGradientLookup() != null) {
        drawGradientBar();
        if (gauge.getMajorTickMarksVisible()) drawTickMarks();
    } else if (gauge.getSectionsVisible()) {
        drawSections();
        if (gauge.getMajorTickMarksVisible()) drawTickMarks();
    }
    sectionCanvas.setCache(true);
    sectionCanvas.setCacheHint(CacheHint.QUALITY);

    needle.setFill(gauge.getNeedleColor());
}
 
開發者ID:HanSolo,項目名稱:Medusa,代碼行數:27,代碼來源:TinySkin.java

示例14: CPUVisualisation

import javafx.scene.CacheHint; //導入依賴的package包/類
/**
 * Sets up the cpu visualisation along with the containing pane
 */
public CPUVisualisation() {
       width = 530;
       height = 415;
       pane = getContentPane();
       pane.setPrefWidth(width);
       pane.setMinWidth(width);
       pane.setMaxWidth(width);
       pane.setPrefHeight(height);
       pane.setMinHeight(height);
       pane.setMaxHeight(height);
       setMinWidth(width);
       setMinHeight(getMinimalHeight());
	drawVisualisation();
	pane.setCache(true);
	pane.setCacheHint(CacheHint.SPEED);
	setCache(true);
	setCacheHint(CacheHint.SPEED);
}
 
開發者ID:mbway,項目名稱:Simulizer,代碼行數:22,代碼來源:CPUVisualisation.java

示例15: setAttributes

import javafx.scene.CacheHint; //導入依賴的package包/類
/**
 * Sets attributes on the shape and stack pane such as x and y coordinates.
 */
public void setAttributes(){
    this.setPrefHeight(height);
    this.setPrefWidth(width);
    this.setLayoutX(x);
    this.setLayoutY(y);
    this.text.setWrappingWidth(width * 0.9);
    this.shape.getStyleClass().addAll("cpu-component", this.getClass().getSimpleName());
    this.text.getStyleClass().addAll("cpu-component-label", this.getClass().getSimpleName());
    this.getStyleClass().addAll("cpu-container");
    getChildren().addAll(this.shape, text);
    setAlignment(this.shape, Pos.TOP_LEFT);
    setCache(true);
    setCacheShape(true);
    setCacheHint(CacheHint.SPEED);
    this.shape.setCache(true);
    this.shape.setCacheHint(CacheHint.SPEED);
}
 
開發者ID:mbway,項目名稱:Simulizer,代碼行數:21,代碼來源:ComponentStackPane.java


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