當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。