本文整理匯總了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));
}