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


Java CycleMethod類代碼示例

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


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

示例1: RadialGradientSample

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
public RadialGradientSample() {
    //create simple radial gradient
    RadialGradient gradient1 = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(1, Color.BLACK)
    });
    Circle circle1 = new Circle(45, 45, 40, gradient1);

    //create complex radial gradient
    RadialGradient gradient2 = new RadialGradient(20, 1, 0.5, 0.5, 0.6, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0,  Color.TRANSPARENT),
        new Stop(0.5,  Color.DARKGRAY),
        new Stop(0.64, Color.WHITESMOKE),
        new Stop(0.65, Color.YELLOW),
        new Stop(1, Color.GOLD)
    });
    Circle circle2 = new Circle(145, 45, 40, gradient2);

    HBox hb = new HBox(10);
    hb.getChildren().addAll(circle1, circle2);
    
    // show the circles
    getChildren().addAll(hb);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:25,代碼來源:RadialGradientSample.java

示例2: draw

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
private void draw(final int LIMIT, final double RESOLUTION) {
    int limit        = LIMIT > points.size() ? points.size() : LIMIT + 1;
    double pixelSize = 2 * RESOLUTION;

    ctx.clearRect(0, 0, width, height);

    for (double y = 0 ; y < height ; y += RESOLUTION) {
        for (double x = 0 ; x < width ; x += RESOLUTION) {
            double value = getValueAt(limit, x, y);
            if (value != -255) {
                Color          color    = getUseColorMapping() ? getColorForValue(value) : getColorForValue(value, isDiscreteColors());
                RadialGradient gradient = new RadialGradient(0, 0, x, y, RESOLUTION,
                                                             false, CycleMethod.NO_CYCLE,
                                                             new Stop(0, Color.color(color.getRed(), color.getGreen(), color.getBlue(), getHeatMapOpacity())),
                                                             new Stop(1, Color.color(color.getRed(), color.getGreen(), color.getBlue(), 0.0)));
                ctx.setFill(gradient);
                ctx.fillOval(x - RESOLUTION, y - RESOLUTION, pixelSize, pixelSize);
            }
        }
    }
}
 
開發者ID:HanSolo,項目名稱:charts,代碼行數:22,代碼來源:AreaHeatMap.java

示例3: initBackground

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
private void initBackground() {
    Rectangle bg0 = new Rectangle(getWidth(), getHeight(),
            new LinearGradient(getWidth() / 2, 0, getWidth() / 2, getHeight(),
                    false, CycleMethod.NO_CYCLE,
                    new Stop(0.2, Color.AQUA), new Stop(0.8, Color.BLACK)));

    Rectangle bg1 = new Rectangle(getWidth(), getHeight(), Color.color(0, 0, 0, 0.2));
    bg1.setBlendMode(BlendMode.DARKEN);

    EntityView bg = new EntityView(RenderLayer.BACKGROUND);
    bg.addNode(bg0);
    bg.addNode(bg1);

    // we add IrremovableComponent because regardless of the level
    // the background and screen bounds stay in the game world
    Entities.builder()
            .viewFromNode(bg)
            .with(new IrremovableComponent())
            .buildAndAttach(getGameWorld());

    Entity screenBounds = Entities.makeScreenBounds(40);
    screenBounds.addComponent(new IrremovableComponent());

    getGameWorld().addEntity(screenBounds);
}
 
開發者ID:AlmasB,項目名稱:FXGLGames,代碼行數:26,代碼來源:BreakoutApp.java

示例4: drawNode

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
@Override
public Node drawNode() {

    Group group = new Group();
    final Canvas canvas = new Canvas(120, 120);
    GraphicsContext gc = canvas.getGraphicsContext2D();
    group.getChildren().add(canvas);

    gc.setFill(Color.GREEN);
    gc.fillRect(10,10, 70, 70);

    ColorInput effect = new ColorInput();
    effect.setPaint(new LinearGradient(0, 0, 0.5f, 0.1f, true, CycleMethod.REPEAT, new Stop[] {
                    new Stop(0, Color.RED),
                    new Stop(1, Color.GREEN),
                }));
    effect.setX(15);
    effect.setY(15);
    effect.setWidth(70);
    effect.setHeight(70);

    gc.applyEffect(effect);
    return group;

}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:26,代碼來源:CanvasEffects2App.java

示例5: createNeedle

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
private void createNeedle() {
    double needleWidth  = size * 0.04;
    double needleHeight = size * 0.4675;
    needle.getElements().clear();
    needle.getElements().add(new MoveTo(0.3125 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.3125 * needleWidth, 0.005319148936170213 * needleHeight,
                                              0.4375 * needleWidth, 0.0,
                                              0.5 * needleWidth, 0.0));
    needle.getElements().add(new CubicCurveTo(0.5625 * needleWidth, 0.0,
                                              0.6875 * needleWidth, 0.005319148936170213 * needleHeight,
                                              0.6875 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.6875 * needleWidth, 0.015957446808510637 * needleHeight,
                                              needleWidth, 0.9946808510638298 * needleHeight,
                                              needleWidth, 0.9946808510638298 * needleHeight));
    needle.getElements().add(new LineTo(0.0, 0.9946808510638298 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.0, 0.9946808510638298 * needleHeight,
                                              0.3125 * needleWidth, 0.015957446808510637 * needleHeight,
                                              0.3125 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new ClosePath());
    needle.setFill(new LinearGradient(needle.getLayoutBounds().getMinX(), 0,
                                      needle.getLayoutBounds().getMaxX(), 0,
                                      false, CycleMethod.NO_CYCLE,
                                      new Stop(0.0, gauge.getNeedleColor().darker()),
                                      new Stop(0.5, gauge.getNeedleColor()),
                                      new Stop(1.0, gauge.getNeedleColor().darker())));
}
 
開發者ID:HanSolo,項目名稱:Medusa,代碼行數:27,代碼來源:SectionSkin.java

示例6: redraw

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
@Override protected void redraw() {
    sectionsVisible = gauge.getSectionsVisible();
    drawSections();
    needle.setFill(new LinearGradient(needle.getLayoutBounds().getMinX(), 0,
                                      needle.getLayoutBounds().getMaxX(), 0,
                                      false, CycleMethod.NO_CYCLE,
                                      new Stop(0.0, gauge.getNeedleColor().darker()),
                                      new Stop(0.5, gauge.getNeedleColor()),
                                      new Stop(1.0, gauge.getNeedleColor().darker())));
    titleText.setFill(gauge.getTitleColor());
    valueText.setFill(gauge.getValueColor());
    mask.setFill(gauge.getBackgroundPaint());
    knob.setFill(gauge.getKnobColor());
    titleText.setText(gauge.getTitle());
    resizeText();
}
 
開發者ID:HanSolo,項目名稱:Medusa,代碼行數:17,代碼來源:SectionSkin.java

示例7: handleMouseEvent

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
public void handleMouseEvent(final MouseEvent EVENT) {
    if (gauge.isDisabled()) return;
    final EventType TYPE = EVENT.getEventType();
    if (MouseEvent.MOUSE_PRESSED.equals(TYPE)) {
        gauge.fireEvent(gauge.BTN_PRESSED_EVENT);
        centerKnob.setFill(new LinearGradient(0.5 * size, 0.2708333333333333 * size,
                                              0.5 * size, 0.7291666666666666 * size,
                                              false, CycleMethod.NO_CYCLE,
                                              new Stop(0.0, Color.rgb(31, 31, 31)),
                                              new Stop(1.0, Color.rgb(69, 70, 73))));
        valueText.setTranslateY(size * 0.501);
        subTitleText.setTranslateY(size * 0.3525);
        unitText.setTranslateY(size * 0.6675);
    } else if (MouseEvent.MOUSE_RELEASED.equals(TYPE)) {
        gauge.fireEvent(gauge.BTN_RELEASED_EVENT);
        centerKnob.setFill(new LinearGradient(0.5 * size, 0.2708333333333333 * size,
                                              0.5 * size, 0.7291666666666666 * size,
                                              false, CycleMethod.NO_CYCLE,
                                              new Stop(0.0, Color.rgb(69, 70, 73)),
                                              new Stop(1.0, Color.rgb(31, 31, 31))));
        valueText.setTranslateY(size * 0.5);
        subTitleText.setTranslateY(size * 0.35);
        unitText.setTranslateY(size * 0.67);
    }
}
 
開發者ID:HanSolo,項目名稱:Medusa,代碼行數:26,代碼來源:ModernSkin.java

示例8: Player

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
/**
 * Constructor without cards
 * @param name the name of the player
 * @param role the role of the player
 */
public Player(String name, Role role) {
    this.name = name;
    this.role = role;
    color = role.roleToColor();
    hand = new LinkedList<>();
    handDeck = null;
    pane = new Pane();
    pane.setBackground(new Background(new BackgroundFill(new RadialGradient(0, 0, .5, .5, .8, true, CycleMethod.NO_CYCLE, new Stop(0, color.deriveColor(0,1,1,.25)), new Stop(1, color.deriveColor(0,1,.5,.25))), new CornerRadii(5), new Insets(0))));

    Label description = new Label(role.roleToDescription());
    description.setTextFill(role.roleToColor().brighter());
    pane.getChildren().add(description);
    nameLabel = new Label(name);
    nameLabel.setTextFill(role.roleToColor().brighter());
    nameLabel.setLayoutX(350);
    nameLabel.setLayoutY(20);
    pane.getChildren().add(nameLabel);


    pawn = new Pawn(this);
}
 
開發者ID:MrFouss,項目名稱:The-Projects,代碼行數:27,代碼來源:Player.java

示例9: createTopHighlightBorder

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
private void createTopHighlightBorder() {
    Stop[] stops = new Stop[] {
            new Stop(0, Color.WHITE),
            new Stop(.3, Color.LIGHTGRAY),
            new Stop(1, Color.TRANSPARENT)
    };
    LinearGradient lg1 = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, stops);

    topHighlightBorder =
            new Border(new BorderStroke(
                    lg1, null, null, null,
                    BorderStrokeStyle.SOLID, BorderStrokeStyle.NONE, BorderStrokeStyle.NONE, BorderStrokeStyle.NONE,
                    CornerRadii.EMPTY,
                    new BorderWidths( 8.0d ),
                    null
            ));
}
 
開發者ID:bekwam,項目名稱:examples-javafx-repos1,代碼行數:18,代碼來源:Overlay1Controller.java

示例10: Thermo

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
Thermo(Color color)
{
    setFill(color);

    fill.setArcHeight(6);
    fill.setArcWidth(6);
    fill.setManaged(false);
    border.setFill(new LinearGradient(.3, 0, .7, 0, true, CycleMethod.NO_CYCLE,
            new Stop(0, Color.LIGHTGRAY),
            new Stop(.3, Color.WHITESMOKE),
            new Stop(1, Color.LIGHTGRAY)));
    border.setStroke(Color.BLACK);
    arc.setLargeArcFlag(true);
    rightcorner.setY(0);

    getChildren().add(border);
    getChildren().add(fill);
    getChildren().add(ellipse);
    setBorder(new Border(
            new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
}
 
開發者ID:kasemir,項目名稱:org.csstudio.display.builder,代碼行數:22,代碼來源:ThermometerRepresentation.java

示例11: Thermo

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
Thermo(Color color)
{
    setFill(color);

    fill.setArcHeight(3);
    fill.setArcWidth(3);
    fill.setManaged(false);
    border.setFill(new LinearGradient(.3, 0, .7, 0, true, CycleMethod.NO_CYCLE,
                                    new Stop(0, Color.LIGHTGRAY),
                                    new Stop(.3, Color.WHITESMOKE),
                                    new Stop(1, Color.LIGHTGRAY)));
    border.setStroke(Color.BLACK);
    arc.setLargeArcFlag(true);

    getChildren().add(border);
    getChildren().add(fill);
    getChildren().add(ellipse);
    setBorder(new Border(
            new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
}
 
開發者ID:kasemir,項目名稱:org.csstudio.display.builder,代碼行數:21,代碼來源:ThermoDemo.java

示例12: createAlphaMaskedBall

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
/**
 * Create an alpha masked ball with gradient colors from White to Black/Transparent. Used e. g. for particles.
 * May only be visible when you have a background other than white, ie use black
 *
 * @param radius
 * @return
 */
public static Node createAlphaMaskedBall( double radius) {

    Circle ball = new Circle(radius);

    RadialGradient gradient1 = new RadialGradient(0,
            .1,
            0,
            0,
            radius,
            false,
            CycleMethod.NO_CYCLE,
            new Stop(0, Color.WHITE.deriveColor(1,1,1,1)),
            new Stop(1, Color.BLACK.deriveColor(1,1,1,0)));

    ball.setFill(gradient1);

    return ball;
}
 
開發者ID:amoAHCP,項目名稱:JavaOne2015JavaFXPitfalls,代碼行數:26,代碼來源:Utils.java

示例13: drawLeftImage

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
protected void drawLeftImage() {
    AnchorPane pane = new AnchorPane();
    pane.setPrefWidth(187);
    Stop[] stops = new Stop[] { new Stop(0, Color.web("#3c79b2")), new Stop(1, Color.web("#2d5d8b")) };
    RadialGradient gradient = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, stops);

    Background background = new Background(new BackgroundFill(gradient, null, null));
    pane.setBackground(background);

    Text text = new Text(this.parent.getLeftImageText());
    text.setFill(Color.WHITE);
    text.setFont(Font.font("Maven Pro", 50));
    text.setRotate(-90);
    pane.setPadding(new Insets(-50));
    pane.getChildren().add(text);
    AnchorPane.setBottomAnchor(text, 160.0);
    AnchorPane.setRightAnchor(text, -40.0);

    getParent().getRoot().setLeft(pane);
}
 
開發者ID:PhoenicisOrg,項目名稱:POL-POM-5,代碼行數:21,代碼來源:AbstractStepRepresentation.java

示例14: Banner

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
public Banner(String message) {
	Rectangle rectangle = RectangleBuilder
			.create()
			.x(0)
			.y(0)
			.width(W)
			.height(H)
			.fill(LinearGradientBuilder
					.create()
					.startX(0.0)
					.startY(0.0)
					.endX(10.0)
					.endY(0.0)
					.proportional(false)
					.cycleMethod(CycleMethod.REFLECT)
					.stops(StopBuilder.create().offset(0.0).color(Color.BLUE).build(),
							StopBuilder.create().offset(1.0).color(Color.LIGHTBLUE).build()).build()).build();
	Text text = TextBuilder.create().x(25).y(H / 16).text(message).fill(Color.YELLOW).font(Font.font(null, FontWeight.BOLD, 36))
			.build();
	getChildren().addAll(rectangle, text);
}
 
開發者ID:SaiPradeepDandem,項目名稱:javafx-demos,代碼行數:22,代碼來源:DisplacementMapBannerDemo.java

示例15: changeGradient2Color

import javafx.scene.paint.CycleMethod; //導入依賴的package包/類
private void changeGradient2Color(int index, Color color)
{
	if (index == 0)
	{
		stopsInner[index] = new Stop (0, color);
	} else if (index == 1)
	{
		stopsInner[index] = new Stop (.1, color);
	} else if (index == 2)
	{
		stopsInner[index] = new Stop (.8, color);
	} else if (index == 3)
	{
		stopsInner[index] = new Stop (1, color);
	}
	// reset the gradient containing the given color
	lg2 = new LinearGradient (0, 0, 0, .5, true, CycleMethod.REFLECT,
			stopsInner);
}
 
開發者ID:entitycs,項目名稱:AudioVisualizer2.0,代碼行數:20,代碼來源:RenderTestVis2Frame.java


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