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


Java Text.setFill方法代碼示例

本文整理匯總了Java中javafx.scene.text.Text.setFill方法的典型用法代碼示例。如果您正苦於以下問題:Java Text.setFill方法的具體用法?Java Text.setFill怎麽用?Java Text.setFill使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.text.Text的用法示例。


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

示例1: createLetter

import javafx.scene.text.Text; //導入方法依賴的package包/類
private void createLetter(String c) {
    final Text letter = new Text(c);
    letter.setFill(Color.BLACK);
    letter.setFont(FONT_DEFAULT);
    letter.setTextOrigin(VPos.TOP);
    letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2);
    letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2);
    getChildren().add(letter);
    // over 3 seconds move letter to random position and fade it out
    final Timeline timeline = new Timeline();
    timeline.getKeyFrames().add(
            new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
                @Override public void handle(ActionEvent event) {
                    // we are done remove us from scene
                    getChildren().remove(letter);
                }
            },
            new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR),
            new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR),
            new KeyValue(letter.opacityProperty(), 0f)
    ));
    timeline.play();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:KeyStrokeMotion.java

示例2: ColorPickerSample

import javafx.scene.text.Text; //導入方法依賴的package包/類
public ColorPickerSample() {
    final ColorPicker colorPicker = new ColorPicker(Color.GRAY);
    ToolBar standardToolbar = ToolBarBuilder.create().items(colorPicker).build();

    final Text coloredText = new Text("Colors");
    Font font = new Font(53);
    coloredText.setFont(font);
    final Button coloredButton = new Button("Colored Control");
    Color c = colorPicker.getValue();
    coloredText.setFill(c);
    coloredButton.setStyle(createRGBString(c));

    colorPicker.setOnAction(new EventHandler() {

        public void handle(Event t) {
            Color newColor = colorPicker.getValue();
            coloredText.setFill(newColor);                          
            coloredButton.setStyle(createRGBString(newColor));
        }
    });

    VBox coloredObjectsVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(coloredText, coloredButton).build();        
    VBox outerVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(150).padding(new Insets(0, 0, 120, 0)).children(standardToolbar, coloredObjectsVBox).build();
    getChildren().add(outerVBox);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:26,代碼來源:ColorPickerSample.java

示例3: add_row

import javafx.scene.text.Text; //導入方法依賴的package包/類
/**
 * Create a row with text and radio buttons
 * @param name of the row
 * @param i iterator
 */
private void add_row(String name, int i){
    Text text = new Text(name);
    text.setStyle("-fx-font-weight: bold;" +
            "-fx-font-size: 17px");
    text.setFill(Color.WHITESMOKE);
    gridPane.add(text, 0, i+1);

    RadioButton readButton = new RadioButton();
    GridPane.setHalignment(readButton, HPos.CENTER);
    gridPane.add(readButton, 1,i+1);

    RadioButton editButton = new RadioButton();
    GridPane.setHalignment(editButton, HPos.CENTER);
    gridPane.add(editButton, 2, i+1);

    editButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            readButton.setSelected(true);
        }
    });

    radioButtonArrayList.add(readButton);
    radioButtonArrayList.add(editButton);
}
 
開發者ID:Moccko,項目名稱:campingsimulator2017,代碼行數:31,代碼來源:PermissionsDialog.java

示例4: InnerShadowSample

import javafx.scene.text.Text; //導入方法依賴的package包/類
public InnerShadowSample() {
    Text sample = new Text(0,100,"Shadow");
    sample.setFont(Font.font("Arial Black",80));
    sample.setFill(Color.web("#BBBBBB"));
    final InnerShadow innerShadow = new InnerShadow();
    innerShadow.setRadius(5d);
    innerShadow.setOffsetX(2);
    innerShadow.setOffsetY(2);
    sample.setEffect(innerShadow);
    getChildren().add(sample);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Text Fill", sample.fillProperty()),
            new SimplePropertySheet.PropDesc("Inner Shadow Radius", innerShadow.radiusProperty(), 0d,60d),
            new SimplePropertySheet.PropDesc("Inner Shadow Offset X", innerShadow.offsetXProperty(), -10d, 10d),
            new SimplePropertySheet.PropDesc("Inner Shadow Offset Y", innerShadow.offsetYProperty(), -10d, 10d),
            new SimplePropertySheet.PropDesc("Inner Shadow Color", innerShadow.colorProperty())
    );
    // END REMOVE ME
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:21,代碼來源:InnerShadowSample.java

示例5: setRadarValuesLabels

import javafx.scene.text.Text; //導入方法依賴的package包/類
private void setRadarValuesLabels() {

		Text startValueText = new Text(xCenter - 20, yCenter, String.valueOf(minValue));
		startValueText.setFill(Color.RED);
		startValueText.setFont(Font.font(15));

		Text middleValueText = new Text(xCenter - 20, yCenter - radius / 2, String.valueOf(maxValue / 2));
		middleValueText.setFill(Color.RED);
		middleValueText.setFont(Font.font(15));

		Text maxValueText = new Text(xCenter - 20, yCenter - radius, String.valueOf(maxValue));
		maxValueText.setFill(Color.RED);
		maxValueText.setFont(Font.font(15));

		getChildren().addAll(startValueText, middleValueText, maxValueText);
	}
 
開發者ID:JKostikiadis,項目名稱:PolygonChart,代碼行數:17,代碼來源:PolygonChart.java

示例6: createNumber

import javafx.scene.text.Text; //導入方法依賴的package包/類
private Text createNumber(String number, double layoutX, double layoutY) {
    Text text = new Text(number);
    text.setLayoutX(layoutX);
    text.setLayoutY(layoutY);
    text.setTextAlignment(TextAlignment.CENTER);
    text.setFill(FILL_COLOR);
    text.setFont(NUMBER_FONT);
    return text;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:StopWatch.java

示例7: createDot

import javafx.scene.text.Text; //導入方法依賴的package包/類
private Text createDot(String string) {
    Text text = new Text(string);
    text.setFill(Color.web("#000000"));
    text.setFont(FONT);
    text.setTextOrigin(VPos.TOP);
    text.setLayoutX(1);
    text.setLayoutY(-4);
    return text;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:StopWatch.java

示例8: init

import javafx.scene.text.Text; //導入方法依賴的package包/類
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    final ColorPicker colorPicker = new ColorPicker(Color.GRAY);
    ToolBar standardToolbar = ToolBarBuilder.create().items(colorPicker).build();

    final Text coloredText = new Text("Colors");
    Font font = new Font(53);
    coloredText.setFont(font);
    final Button coloredButton = new Button("Colored Control");
    Color c = colorPicker.getValue();
    coloredText.setFill(c);
    coloredButton.setStyle(createRGBString(c));

    colorPicker.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent t) {
            Color newColor = colorPicker.getValue();
            coloredText.setFill(newColor);                          
            coloredButton.setStyle(createRGBString(newColor));
        }
    });

    VBox coloredObjectsVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(coloredText, coloredButton).build();        
    VBox outerVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(150).padding(new Insets(0, 0, 120, 0)).children(standardToolbar, coloredObjectsVBox).build();
    root.getChildren().add(outerVBox);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:ColorPickerDemo.java

示例9: displayVersion

import javafx.scene.text.Text; //導入方法依賴的package包/類
public void displayVersion(boolean display) {
    if (display == true) { // Display
        // Assign value
        txtVersion = new Text("Version: " + GAME_VERSION);
        // Label for display version
        txtVersion.setFill(Color.rgb(234, 234, 234));

        // Move txtVersion to bottom left of pane
        txtVersion.setY(HEIGHT + 8);

        getChildren().add(txtVersion); // Add txtVersion to pane
    } else if (display == false) { // Do not display
        getChildren().remove(txtVersion);
    }
}
 
開發者ID:spencerhendon,項目名稱:projectintern,代碼行數:16,代碼來源:TitleScreen.java

示例10: init

import javafx.scene.text.Text; //導入方法依賴的package包/類
@Override
protected void init() {
    String tooltip = "999";
    Text icon = new Text(tooltip);
    icon.setFill(Color.BISQUE);
    DropShadow ds = new DropShadow();
    ds.setOffsetY(3.0F);
    ds.setColor(Color.GOLDENROD);
    icon.setEffect(ds);
    initializeButton(tooltip, icon);
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:12,代碼來源:TempPopulationNinesBC.java

示例11: init

import javafx.scene.text.Text; //導入方法依賴的package包/類
@Override
protected void init() {
    String tooltip = "Dense";
    Text icon = new Text(tooltip);
    icon.setFill(Color.BISQUE);

    DropShadow ds = new DropShadow();
    ds.setOffsetY(3.0F);
    ds.setColor(Color.GOLDENROD);
    icon.setEffect(ds);
    initializeButton(tooltip, icon);
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:13,代碼來源:TempDenseBC.java

示例12: createIconContent

import javafx.scene.text.Text; //導入方法依賴的package包/類
public static Node createIconContent() {
    Text sample = new Text("FX");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80));
    sample.setStyle("-fx-font-size: 80px;");
    sample.setFill(Color.web("#aaaaaa"));
    final InnerShadow innerShadow = new InnerShadow();
    innerShadow.setRadius(4);
    innerShadow.setOffsetX(1);
    innerShadow.setOffsetY(1);
    innerShadow.setColor(Color.web("#333333"));
    sample.setEffect(innerShadow);
    return sample;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:14,代碼來源:InnerShadowSample.java

示例13: draw

import javafx.scene.text.Text; //導入方法依賴的package包/類
public void draw() {
    // Draw elevator
    Rectangle rgB = new Rectangle(WIDTH, HEIGHT);
    rgB.setFill(Color.TRANSPARENT);
    this.getChildren().add(rgB);
    
    rgT = new Rectangle((WIDTH / 3) * 2 + (WIDTH / (WIDTH / 8)), HEIGHT / 1.5 + (HEIGHT / (HEIGHT / 4)));
    rgT.setFill(Color.web("bfbfbf"));
    rgT.setX(WIDTH / 2 - rgT.getWidth() / 2);
    rgT.setY(HEIGHT - rgT.getHeight());
    this.getChildren().add(rgT);

    //Left side elevator shaft door
    rgD1 = new Rectangle(WIDTH / 3, HEIGHT / 1.5);
    rgD1.setFill(Color.web("a5a5a5"));
    rgD1.setX(WIDTH / 2 - rgD1.getWidth());
    rgD1.setY(HEIGHT - rgD1.getHeight());
    this.getChildren().add(rgD1);

    //Right side elevator shaft door
    rgD2 = new Rectangle(WIDTH / 3, HEIGHT / 1.5);
    rgD2.setFill(Color.web("a5a5a5"));
    rgD2.setX(WIDTH / 2);
    rgD2.setY(HEIGHT - rgD2.getHeight());
    this.getChildren().add(rgD2);
    
    // Draw text
    tFloorNum = new Text(String.valueOf(FLOORNUM));
    tFloorNum.setFill(Color.web("bfbfbf"));
    tFloorNum.setFont(Font.font("Verdana", 20));
    tFloorNum.setX(WIDTH / 2 - tFloorNum.getBoundsInParent().getWidth() / 2);
    tFloorNum.setY(rgT.getY() - tFloorNum.getBoundsInParent().getHeight() / 2);
    this.getChildren().add(tFloorNum);
}
 
開發者ID:spencerhendon,項目名稱:projectintern,代碼行數:35,代碼來源:Elevator.java

示例14: HeaderView

import javafx.scene.text.Text; //導入方法依賴的package包/類
public HeaderView(String t){

        setPadding(new Insets(15));
        setStyle("-fx-background-color: #336699;");
        Text title = new Text(t);
        title.setFill(Color.WHITESMOKE);
        title.setFont(Font.font("DejaVu Sans", 30));
        setCenter(title);
    }
 
開發者ID:Moccko,項目名稱:campingsimulator2017,代碼行數:10,代碼來源:HeaderView.java

示例15: Drone

import javafx.scene.text.Text; //導入方法依賴的package包/類
/**
 * Creates a drone based on a sprite
 * @param uiUpdates - uiupdates
 * @param image - Path to the sprite image
 */
Drone(BlockingQueue<UIUpdate> uiUpdates, String image) {
    super(uiUpdates, image);
    new SpriteAnimation(imageView, Duration.millis(200), DRONE_SPRITE_COLUMNS, DRONE_SPRITE_COLUMNS, 0, 0, Settings.SPRITE_WIDTH, Settings.SPRITE_HEIGTH).play();
    heightText = new Text(0, 20, "Height: 0");
    heightText.setFill(Color.WHITE);
    imageView.setFitHeight(Settings.DRONE_HEIGHT);
    imageView.setFitWidth(Settings.DRONE_WIDTH);
    imageView.setId("drone");
    currentHP = -1;
    uiUpdates.add(new AddDrone(heightText));
}
 
開發者ID:INAETICS,項目名稱:Drones-Simulator,代碼行數:17,代碼來源:Drone.java


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