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


Java Color.web方法代码示例

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


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

示例1: createIconContent

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public static Node createIconContent() {
    StackPane sp = new StackPane();
    AnchorPane anchorPane = new AnchorPane();

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    anchorPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle r1 = new Rectangle(14, 14, Color.web("#1c89f4"));
    Rectangle r2 = new Rectangle(45, 10, Color.web("#349b00"));
    Rectangle r3 = new Rectangle(35, 14, Color.web("#349b00"));

    anchorPane.getChildren().addAll(r1, r2, r3);
    AnchorPane.setTopAnchor(r1, Double.valueOf(1));
    AnchorPane.setLeftAnchor(r1, Double.valueOf(1));
    AnchorPane.setTopAnchor(r2, Double.valueOf(20));
    AnchorPane.setLeftAnchor(r2, Double.valueOf(1));
    AnchorPane.setBottomAnchor(r3, Double.valueOf(1));
    AnchorPane.setRightAnchor(r3, Double.valueOf(5));

    sp.getChildren().addAll(rectangle, anchorPane);
    return new Group(sp);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:24,代码来源:AnchorPaneSample.java

示例2: init

import javafx.scene.paint.Color; //导入方法依赖的package包/类
@Override public void init() {
    ChartItem[] items = {
        new ChartItem("Item 1", 27, Color.web("#96AA3B")),
        new ChartItem("Item 2", 24, Color.web("#29A783")),
        new ChartItem("Item 3", 16, Color.web("#098AA9")),
        new ChartItem("Item 4", 15, Color.web("#62386F")),
        new ChartItem("Item 5", 13, Color.web("#89447B")),
        new ChartItem("Item 6", 5, Color.web("#EF5780"))
    };
    chart = CoxcombChartBuilder.create()
                               .items(items)
                               .textColor(Color.WHITE)
                               .autoTextColor(false)
                               .equalSegmentAngles(true)
                               .order(Order.ASCENDING)
                               .build();
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:18,代码来源:CoxcombChartTest.java

示例3: createIconContent

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public static Node createIconContent() {
    StackPane sp = new StackPane();
    TilePane iconTilePane = new TilePane();
    iconTilePane.setAlignment(Pos.CENTER);

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    iconTilePane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle[] rec = new Rectangle[9];
    for (int i = 0; i < rec.length; i++) {
        rec[i] = new Rectangle(14, 14, Color.web("#349b00"));
        TilePane.setMargin(rec[i], new Insets(2, 2, 2, 2));
    }
    iconTilePane.getChildren().addAll(rec);
    sp.getChildren().addAll(rectangle, iconTilePane);
    return new Group(sp);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:TilePaneSample.java

示例4: createIconContent

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public static Node createIconContent() {
    StackPane sp = new StackPane();
    HBox hbox = new HBox(3);
    hbox.setAlignment(Pos.CENTER);

    Rectangle rectangle = new Rectangle(70, 25, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    hbox.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle r1 = new Rectangle(14, 14, Color.web("#1c89f4"));
    Rectangle r2 = new Rectangle(14, 14, Color.web("#349b00"));
    Rectangle r3 = new Rectangle(18, 14, Color.web("#349b00"));

    hbox.getChildren().addAll(r1, r2, r3);
    sp.getChildren().addAll(rectangle, hbox);

    return new Group(sp);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:HBoxSample.java

示例5: createIconContent

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public static Node createIconContent() {
    StackPane sp = new StackPane();
    VBox vbox = new VBox(3);
    vbox.setAlignment(Pos.CENTER);
    vbox.setPadding(new Insets(5, 5, 5, 5));

    Rectangle rectangle = new Rectangle(32, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    vbox.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
    Rectangle r1 = new Rectangle(18, 14, Color.web("#1c89f4"));
    Rectangle r2 = new Rectangle(18, 14, Color.web("#349b00"));
    Rectangle r3 = new Rectangle(18, 20, Color.web("#349b00"));

    vbox.getChildren().addAll(r1, r2, r3);
    sp.getChildren().addAll(rectangle, vbox);
    return new Group(sp);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:18,代码来源:VBoxSample.java

示例6: TimelineSample

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public TimelineSample() {
    super(280,120);

    //create a circle
    final Circle circle = new Circle(25,25, 20,  Color.web("1c89f4"));
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle
    timeline = new Timeline();        
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can start/pause/stop/play animation by
    //timeline.play();
    //timeline.pause();
    //timeline.stop();
    //timeline.playFromStart();
    
    //add the following keyframes to the timeline
    timeline.getKeyFrames().addAll
        (new KeyFrame(Duration.ZERO,
                      new KeyValue(circle.translateXProperty(), 0)),
         new KeyFrame(new Duration(4000),
                      new KeyValue(circle.translateXProperty(), 205)));


    getChildren().add(createNavigation());
    getChildren().add(circle);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Timeline rate", timeline.rateProperty(), -4d, 4d)
            //TODO it is possible to do it for integer?
    );
    // END REMOVE ME
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:36,代码来源:TimelineSample.java

示例7: createIconContent

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public static Node createIconContent() {
    StackPane sp = new StackPane();
    FlowPane fp = new FlowPane();
    fp.setAlignment(Pos.CENTER);

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    fp.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle[] littleRecs = new Rectangle[4];
    Rectangle[] bigRecs = new Rectangle[4];
    for (int i = 0; i < 4; i++) {
        littleRecs[i] = new Rectangle(14, 14, Color.web("#1c89f4"));
        bigRecs[i] = new Rectangle(16, 12, Color.web("#349b00"));
        fp.getChildren().addAll(littleRecs[i], bigRecs[i]);
        FlowPane.setMargin(littleRecs[i], new Insets(2, 2, 2, 2));
    }
    sp.getChildren().addAll(rectangle, fp);
    return new Group(sp);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:FlowPaneSample.java

示例8: read

import javafx.scene.paint.Color; //导入方法依赖的package包/类
@Override
public Color read(JsonReader reader) throws IOException {
	if (reader.peek() == JsonToken.NULL) {
		reader.nextNull();
		return null;
	}

	return Color.web(reader.nextString());
}
 
开发者ID:Quantencomputer,项目名称:cyoastudio,代码行数:10,代码来源:ColorAdapter.java

示例9: TranslateSample

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public TranslateSample() {
    super(230, 220);

    //create 2 rectangles with different color
    Rectangle rect1 = new Rectangle(90, 90, Color.web("#ed4b00", 0.75));
    Rectangle rect2 = new Rectangle(90, 90, Color.web("#ed4b00", 0.5));

    //translate second one
    rect2.setTranslateX(140);

    // rectangle with adjustable translate
    Rectangle rect3 = new Rectangle(40, 130, 60, 60);
    rect3.setFill(Color.DODGERBLUE);
    rect3.setTranslateX(20);
    rect3.setTranslateY(10);

    //show the rectangles
    getChildren().addAll(rect2, rect1, rect3);

    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Translate X", rect3.translateXProperty(), 0d, 50d),
            new SimplePropertySheet.PropDesc("Translate Y", rect3.translateYProperty(), 0d, 50d)
    );
    // END REMOVE ME
    
    //create arrow
    Polygon polygon = createArrow();
    polygon.setLayoutX(110);
    polygon.setLayoutY(30);
    polygon.setRotate(90);

    getChildren().addAll(polygon);

}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:36,代码来源:TranslateSample.java

示例10: RotateSample

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public RotateSample() {
    super(220, 270);

    //create 2 rectangles
    Rectangle rect1 = new Rectangle(90, 90, Color.web("#ed4b00", 0.75));
    Rectangle rect2 = new Rectangle(90, 90, Color.web("#ed4b00", 0.5));

    //rotate the second one
    rect2.getTransforms().add(new Rotate(135, 90, 90)); // parameters are angle, pivotX and pivotY

    // rectangle with adjustable rotate
    Rectangle rect3 = new Rectangle(40, 180, 60, 60);
    rect3.setFill(Color.DODGERBLUE);
    rect3.setArcWidth(10);
    rect3.setArcHeight(10);
    rect3.setRotate(45);

    //show the rectangles
    getChildren().addAll(rect2, rect1, rect3);

    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Rotate", rect3.rotateProperty(), 0d, 360d)
    );
    // END REMOVE ME
    
    //create arrow
    Polygon polygon = createArrow();
    polygon.setLayoutX(110);
    polygon.setLayoutY(15);
    polygon.setRotate(135);

    getChildren().addAll(polygon);

}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:36,代码来源:RotateSample.java

示例11: Watch

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public Watch() {
    startButton = new Button(Color.web("#8cc700"), Color.web("#71a000"));
    stopButton = new Button(Color.web("#AA0000"), Color.web("#660000"));

    mainDial = new Dial(117, true, 12, 60, Color.RED, true);
    minutesDial = new Dial(30, false, 12, 60, "minutes", Color.BLACK, false);
    tenthsDial = new Dial(30, false, 12, 60, "10ths", Color.BLACK, false);

    configureBackground();
    myLayout();
    configureListeners();
    configureTimeline();
    getChildren().addAll(background, minutesDial, tenthsDial, digitalClock, mainDial, startButton, stopButton);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:15,代码来源:StopWatchSample.java

示例12: createIconContent

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public static Node createIconContent() {
    StackPane sp = new StackPane();

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    sp.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle biggerRec = new Rectangle(55, 55, Color.web("#1c89f4"));
    Rectangle smallerRec = new Rectangle(35, 35, Color.web("#349b00"));

    sp.getChildren().addAll(rectangle, biggerRec, smallerRec);
    return new Group(sp);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:StackPaneSample.java

示例13: updateUI_OnHexaChange

import javafx.scene.paint.Color; //导入方法依赖的package包/类
private Color updateUI_OnHexaChange() {
    // retrieve Hexa TextField value
    final String hexa = hexa_textfield.getText().trim();
    final Color color = Color.web(hexa);
    double hue = color.getHue();
    double saturation = color.getSaturation();
    double brightness = color.getBrightness();
    double alpha = Double.valueOf(alpha_textfield.getText());
    return updateUI(hue, saturation, brightness, alpha);
}
 
开发者ID:EricCanull,项目名称:fxexperience2,代码行数:11,代码来源:ColorPickerControl.java

示例14: testSerialize

import javafx.scene.paint.Color; //导入方法依赖的package包/类
@Test
public void testSerialize() throws Exception {
  String colorString = "#12345678";
  Color color = Color.web(colorString);
  String json = gson.toJson(color);
  assertEquals('"' + colorString + '"', json);
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:8,代码来源:ColorSaverTest.java

示例15: start

import javafx.scene.paint.Color; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
    Group root = new Group();
    Scene scene = new Scene(root, Color.BLACK);
    primaryStage.setScene(scene);

    Group squares = new Group();
    int SPACING = 1;
    for (int y = 0; y < HEIGHT; y += SIDE_SIZE + SPACING) {
        for (int x = 0; x < WIDTH; x += SIDE_SIZE + SPACING) {
            String color;
            if (Math.random() > 0.99) {
                color = "brown";
            } else {
                color = "orange";
            }
            Rectangle square = new Rectangle(SIDE_SIZE, SIDE_SIZE, Color.web(color));
            square.setX(x);
            square.setY(y);

            squares.getChildren().add(square);
        }
    }
    root.getChildren().add(squares);

    primaryStage.show();
}
 
开发者ID:slemonide,项目名称:GraphSpace,代码行数:28,代码来源:Main.java


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