本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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));
}