本文整理匯總了Java中javafx.scene.control.Label.setTextFill方法的典型用法代碼示例。如果您正苦於以下問題:Java Label.setTextFill方法的具體用法?Java Label.setTextFill怎麽用?Java Label.setTextFill使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.Label
的用法示例。
在下文中一共展示了Label.setTextFill方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createTimeLeftInfoBox
import javafx.scene.control.Label; //導入方法依賴的package包/類
private HBox createTimeLeftInfoBox( final TileViewModel build ) {
final HBox lastBuildInfoPart = new HBox( );
lastBuildInfoPart.setAlignment( Pos.CENTER );
final ImageView lastBuildIcon = new ImageView( UIUtils.createImage( "icons/timeLeft.png" ) );
lastBuildIcon.setPreserveRatio( true );
lastBuildIcon.setFitWidth( 32 );
final Label timeLeftLabel = new Label( );
timeLeftLabel.setMinWidth( 110 );
timeLeftLabel.setTextAlignment( CENTER );
timeLeftLabel.setAlignment( Pos.CENTER );
timeLeftLabel.setFont( UIUtils.font( 32, FontWeight.BOLD ) );
timeLeftLabel.setTextFill( Color.WHITE );
timeLeftLabel.setWrapText( true );
timeLeftLabel.setEffect( UIUtils.shadowEffect( ) );
timeLeftLabel.textProperty( ).bind( createStringBinding( ( ) -> {
final java.time.Duration timeLeft = build.timeLeftProperty( ).get( );
return ( timeLeft.isNegative( ) ? "+ " : "" ) + ( abs( timeLeft.toMinutes( ) ) + 1 ) + "\nmin";
}, build.timeLeftProperty( ) ) );
lastBuildInfoPart.getChildren( ).addAll( lastBuildIcon, timeLeftLabel );
return lastBuildInfoPart;
}
示例2: setLegendTextFill
import javafx.scene.control.Label; //導入方法依賴的package包/類
public void setLegendTextFill(final Series<X, Y> SERIES, final Paint FILL) {
if (getData().isEmpty()) { return; }
if (!getData().contains(SERIES)) { return; }
int seriesIndex = getData().indexOf(SERIES);
if (seriesIndex == -1) { return; }
Legend legend = (Legend) getLegend();
if (null == legend) { return; }
LegendItem item = legend.getItems().get(seriesIndex);
if (null == item) { return; }
String itemText = item.getText();
for (Node node : legend.lookupAll(".chart-legend-item")) {
if (node instanceof Label) {
Label label = (Label) node;
if (label.getText().equals(itemText)) { label.setTextFill(FILL); }
}
}
}
示例3: initializeLabel
import javafx.scene.control.Label; //導入方法依賴的package包/類
private void initializeLabel() {
final Label label = (Label) lookup("#label");
label.setTextFill(color.getTextColor(colorIntensity.next(-5)));
if (command != null) {
label.setText(command.getDescription());
} else {
label.setText("Current state");
}
}
示例4: createLED
import javafx.scene.control.Label; //導入方法依賴的package包/類
private LED createLED(int number)
{
String labelText = Integer.toString(number);
Label ledLabel = new Label(labelText);
ledLabel.setFont(new Font(FONT_NAME, FONT_SIZE));
ledLabel.setTextAlignment(TextAlignment.CENTER);
ledLabel.setTextFill(FONT_COLOR);
LED led = new LED();
led.setMinHeight(DEFAULT_SIZE);
led.setPrefWidth(DEFAULT_SIZE);
led.setCenter(ledLabel);
updateLEDStyle(led);
return led;
}
示例5: overlay
import javafx.scene.control.Label; //導入方法依賴的package包/類
private static Parent overlay(int version, int display,
YCbCr params, int yCode, String suffix) {
double ye = params.fromLumaCode(yCode);
Label label = new Label(getLabel(version, display, params, yCode,
suffix));
label.setFont(font(40));
label.setTextFill(gray(max(0.25, min(0.5, ye))));
BorderPane.setMargin(label, new Insets(20));
BorderPane layout = new BorderPane();
layout.setBackground(EMPTY);
layout.setBottom(label);
return layout;
}
示例6: createText
import javafx.scene.control.Label; //導入方法依賴的package包/類
/**
* Creates the title and description text
* @return Returns a VBox containing the texts.
*/
public VBox createText(){
final VBox layout = new VBox(5.0f);
layout.setAlignment(Pos.CENTER_LEFT);
layout.setPadding(new Insets(10,10,10,10));
layout.setMaxWidth(300.0f);
title = new Label(content.getName());
title.setTextFill(javafx.scene.paint.Paint.valueOf(TEXT_COLOR));
title.setFont( javafx.scene.text.Font.font(FONT_NAME, FontWeight.EXTRA_BOLD,FONT_SIZE) );
description = new Text(content.getDescription());
description.setFill(Paint.valueOf("#ffffff"));
description.setFont( javafx.scene.text.Font.font(FONT_NAME, FontWeight.BOLD,12.0f) );
description.setBoundsType(TextBoundsType.LOGICAL_VERTICAL_CENTER);
layout.getChildren().add(title);
layout.getChildren().add(description);
return layout;
}
示例7: generate
import javafx.scene.control.Label; //導入方法依賴的package包/類
/**
* Generates a panel image form char.
* <p>First, this function converts ch to upper case if ch is lower case.</p>
* <p>Then, this generates javafx's image from ch.And return it.</p>
* You can fix the resolution of image through {@link capslock.CharPanelGenerator#PANEL_IMAGE_SIZE}
* and {@link capslock.CharPanelGenerator#FONT_SIZE}.
* @param ch パネルの生成に使う1文字.
* @param color 背景色.
* @return 生成されたパネル.
*/
static final Image generate(char ch, Color color){
final Label label = new Label(Character.toString(Character.toUpperCase(ch)));
label.setMinSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
label.setMaxSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
label.setPrefSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
label.setFont(Font.font(FONT_SIZE));
label.setAlignment(Pos.CENTER);
label.setTextFill(Color.WHITE);
label.setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)));
final Scene scene = new Scene(new Group(label));
final WritableImage img = new WritableImage(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
scene.snapshot(img);
return img ;
}
示例8: buildCircularTextImage
import javafx.scene.control.Label; //導入方法依賴的package包/類
public void buildCircularTextImage(){
gc.setFill(Color.web(MATERIAL.get(new Random().nextInt(13))));
gc.fillOval(0,0,50,50);
Label l = new Label(text);
l.setAlignment(Pos.CENTER);
l.setFont(new Font(28));
l.setTextFill(Color.WHITE);
parent.getChildren().setAll(canvas,l);
}
示例9: info
import javafx.scene.control.Label; //導入方法依賴的package包/類
public Label info(String value) {
Label l = new Label(value);
l.setTextFill(Color.web("#FFFFFF"));
l.setId("oc-info-label");
l.setWrapText(true);
l.setTextAlignment(TextAlignment.JUSTIFY);
return l;
}
示例10: createSuccessBox
import javafx.scene.control.Label; //導入方法依賴的package包/類
private StackPane createSuccessBox( ) {
final StackPane pane = new StackPane( );
final ImageView background = new ImageView( UIUtils.createImage( "icons/square-green.png" ) );
background.setPreserveRatio( true );
background.setFitHeight( 70 );
final Label label = new Label( "8" );
label.setFont( UIUtils.font( 32, FontWeight.BOLD ) );
label.setTextFill( Color.WHITE );
label.setEffect( UIUtils.shadowEffect( ) );
label.textProperty( ).bind( _model.successCountProperty( ).asString( ) );
pane.getChildren( ).addAll( background, label );
return pane;
}
示例11: initializeLabel
import javafx.scene.control.Label; //導入方法依賴的package包/類
private void initializeLabel() {
final Label label = (Label) lookup("#label");
label.setTextFill(color.getTextColor(colorIntensity.next(-5)));
if (thread != null) {
label.setText(thread.getName());
}
}
示例12: createIconLabel
import javafx.scene.control.Label; //導入方法依賴的package包/類
public static Label createIconLabel(GlyphIcons icon, String iconSize, String text, ContentDisplay contentDisplay, Paint iconColour, Paint textColour, String style)
{
Text iconLabel = GlyphsDude.createIcon(icon, iconSize);
iconLabel.setFill(iconColour);
Label label = new Label(text);
label.setTextFill(textColour);
label.setStyle(style);
label.setGraphic(iconLabel);
label.setContentDisplay(contentDisplay);
return label;
}
示例13: createTitle
import javafx.scene.control.Label; //導入方法依賴的package包/類
/**
* Setup the Header title and adjust the positions.
* @param title Header title.
* @return Returns a label aligned containing the title.
*/
private Label createTitle(String title){
final Label auxTitle = new Label(title);
auxTitle.setTextFill(Paint.valueOf("#00f6ff"));
auxTitle.setFont( Font.font(FONT_NAME, FontWeight.EXTRA_BOLD,FONT_SIZE) );
auxTitle.setMaxWidth( 150.0f );
return auxTitle;
}
示例14: initializeIdLabel
import javafx.scene.control.Label; //導入方法依賴的package包/類
private void initializeIdLabel() {
final Location location = controller.getLocation();
final Label idLabel = controller.idLabel;
final DropShadow ds = new DropShadow();
ds.setRadius(2);
ds.setSpread(1);
idLabel.setEffect(ds);
idLabel.textProperty().bind((location.idProperty()));
// Center align the label
idLabel.widthProperty().addListener((obsWidth, oldWidth, newWidth) -> idLabel.translateXProperty().set(newWidth.doubleValue() / -2));
idLabel.heightProperty().addListener((obsHeight, oldHeight, newHeight) -> idLabel.translateYProperty().set(newHeight.doubleValue() / -2));
final ObjectProperty<Color> color = location.colorProperty();
final ObjectProperty<Color.Intensity> colorIntensity = location.colorIntensityProperty();
// Delegate to style the label based on the color of the location
final BiConsumer<Color, Color.Intensity> updateColor = (newColor, newIntensity) -> {
idLabel.setTextFill(newColor.getTextColor(newIntensity));
ds.setColor(newColor.getColor(newIntensity));
};
updateColorDelegates.add(updateColor);
// Set the initial color
updateColor.accept(color.get(), colorIntensity.get());
// Update the color of the circle when the color of the location is updated
color.addListener((obs, old, newColor) -> updateColor.accept(newColor, colorIntensity.get()));
}
示例15: createTraceWidget
import javafx.scene.control.Label; //導入方法依賴的package包/類
private Pane createTraceWidget(ITraceExtractor<Step<?>, State<?,?>, TracedObject<?>, Dimension<?>, Value<?>> extractor, String label, ReadOnlyDoubleProperty width) {
final Pane pane = new Pane();
pane.setBackground(TRANSPARENT_BACKGROUND);
final Rectangle rectangle = new Rectangle(0, 0, 0, 12);
rectangle.setFill(Color.LIGHTGRAY);
rectangle.widthProperty().bind(width.subtract(10));
rectangle.setArcHeight(12);
rectangle.setArcWidth(12);
Label text = new Label(label);
text.setTextOverrun(OverrunStyle.ELLIPSIS);
text.setAlignment(Pos.CENTER);
text.setMouseTransparent(true);
text.setTextFill(Color.WHITE);
text.setFont(FONT);
text.setMaxWidth(0);
text.maxWidthProperty().bind(rectangle.widthProperty());
StackPane layout = new StackPane();
layout.getChildren().addAll(rectangle, text);
pane.getChildren().add(layout);
layout.setTranslateY(13);
layout.setTranslateX(5);
pane.setPrefHeight(25);
pane.setMinHeight(25);
pane.setMaxHeight(25);
final Shape arrow1 = createCursor();
final Shape arrow2 = createCursor();
arrow1.setTranslateX(5);
arrow1.setTranslateY(4);
arrow2.translateXProperty().bind(rectangle.widthProperty().add(5));
arrow2.setTranslateY(4);
pane.getChildren().add(arrow1);
pane.getChildren().add(arrow2);
return pane;
}