本文整理匯總了Java中javafx.scene.control.Label.setEffect方法的典型用法代碼示例。如果您正苦於以下問題:Java Label.setEffect方法的具體用法?Java Label.setEffect怎麽用?Java Label.setEffect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.Label
的用法示例。
在下文中一共展示了Label.setEffect方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: createBuildInformation
import javafx.scene.control.Label; //導入方法依賴的package包/類
private void createBuildInformation( ) {
final Label tileTitle = new Label( );
tileTitle.setFont( UIUtils.font( 50, FontWeight.BOLD ) );
tileTitle.setTextFill( Color.WHITE );
tileTitle.setPadding( new Insets( 5 ) );
tileTitle.setWrapText( true );
tileTitle.textProperty( ).bind( _model.displayedNameProperty( ) );
tileTitle.setEffect( UIUtils.shadowEffect( ) );
tileTitle.prefWidthProperty( ).bind( widthProperty( ) );
tileTitle.prefHeightProperty( ).bind( heightProperty( ) );
tileTitle.alignmentProperty( ).bind( createObjectBinding( ( ) -> _model.isLightMode( ) ? Pos.CENTER : CENTER_LEFT, _model.lightModeProperty( ) ) );
tileTitle.textAlignmentProperty( ).bind( createObjectBinding( ( ) -> _model.isLightMode( ) ? CENTER : LEFT, _model.lightModeProperty( ) ) );
HBox.setHgrow( tileTitle, Priority.SOMETIMES );
getChildren( ).add( tileTitle );
final VBox contextPart = createContextPart( );
contextPart.visibleProperty( ).bind( _model.lightModeProperty( ).not( ) );
contextPart.prefWidthProperty( ).bind( createIntegerBinding( ( ) -> contextPart.isVisible( ) ? 90 : 0, contextPart.visibleProperty( ) ) );
contextPart.prefHeightProperty( ).bind( heightProperty( ) );
contextPart.setMinSize( USE_PREF_SIZE, USE_PREF_SIZE );
contextPart.setMaxSize( USE_PREF_SIZE, USE_PREF_SIZE );
getChildren( ).add( contextPart );
}
示例3: 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;
}
示例4: createFailureBox
import javafx.scene.control.Label; //導入方法依賴的package包/類
private StackPane createFailureBox( ) {
final StackPane pane = new StackPane( );
final ImageView background = new ImageView( UIUtils.createImage( "icons/square-red.png" ) );
background.setPreserveRatio( true );
background.setFitHeight( 70 );
final Label label = new Label( );
label.setFont( UIUtils.font( 32, FontWeight.BOLD ) );
label.setTextFill( Color.WHITE );
label.setEffect( UIUtils.shadowEffect( ) );
label.textProperty( ).bind( _model.failureCountProperty( ).asString( ) );
pane.getChildren( ).addAll( background, label );
return pane;
}
示例5: createBuildInformation
import javafx.scene.control.Label; //導入方法依賴的package包/類
private HBox createBuildInformation( ) {
final HBox tileContent = new HBox( );
tileContent.setAlignment( CENTER_LEFT );
final Label tileTitle = new Label( );
tileTitle.setFont( UIUtils.font( 50, FontWeight.BOLD ) );
tileTitle.setTextFill( Color.WHITE );
tileTitle.setPadding( new Insets( 5 ) );
tileTitle.setWrapText( true );
tileTitle.setEffect( UIUtils.shadowEffect( ) );
tileTitle.textProperty( ).bind( _model.displayedNameProperty( ) );
tileTitle.prefWidthProperty( ).bind( widthProperty( ) );
tileTitle.prefHeightProperty( ).bind( heightProperty( ) );
tileTitle.alignmentProperty( ).bind( createObjectBinding( ( ) -> _model.isLightMode( ) ? Pos.CENTER : CENTER_LEFT, _model.lightModeProperty( ) ) );
tileTitle.textAlignmentProperty( ).bind( createObjectBinding( ( ) -> _model.isLightMode( ) ? CENTER : LEFT, _model.lightModeProperty( ) ) );
HBox.setHgrow( tileTitle, Priority.SOMETIMES );
tileContent.getChildren( ).add( tileTitle );
final VBox contextPart = createContextPart( _model );
contextPart.visibleProperty( ).bind( _model.lightModeProperty( ).not( ) );
contextPart.prefWidthProperty( ).bind( createIntegerBinding( ( ) -> contextPart.isVisible( ) ? 145 : 0, contextPart.visibleProperty( ) ) );
contextPart.prefHeightProperty( ).bind( heightProperty( ) );
contextPart.setMinSize( USE_PREF_SIZE, USE_PREF_SIZE );
contextPart.setMaxSize( USE_PREF_SIZE, USE_PREF_SIZE );
tileContent.getChildren( ).add( contextPart );
return tileContent;
}
示例6: createLastBuildInfoBox
import javafx.scene.control.Label; //導入方法依賴的package包/類
private HBox createLastBuildInfoBox( final TileViewModel build ) {
final HBox lastBuildInfoPart = new HBox( );
lastBuildInfoPart.setAlignment( Pos.CENTER );
final ImageView lastBuildIcon = new ImageView( UIUtils.createImage( "icons/lastBuild.png" ) );
lastBuildIcon.setPreserveRatio( true );
lastBuildIcon.setFitWidth( 32 );
final Label lastBuildDate = new Label( );
lastBuildDate.setMinWidth( 110 );
lastBuildDate.setTextAlignment( CENTER );
lastBuildDate.setAlignment( Pos.CENTER );
lastBuildDate.setFont( UIUtils.font( 32, FontWeight.BOLD ) );
lastBuildDate.setTextFill( Color.WHITE );
lastBuildDate.setWrapText( true );
lastBuildDate.setLineSpacing( 2 ); // TODO: Seems do not work
lastBuildDate.setEffect( UIUtils.shadowEffect( ) );
lastBuildDate.textProperty( ).bind( createStringBinding( ( ) -> {
final LocalDateTime localDateTime = build.lastFinishedDateProperty( ).get( );
if ( localDateTime == null )
return "00/00\n00:00";
return localDateTime.format( DateTimeFormatter.ofPattern( "dd/MM\nHH:mm" ) );
}, build.lastFinishedDateProperty( ) ) );
lastBuildInfoPart.getChildren( ).addAll( lastBuildIcon, lastBuildDate );
return lastBuildInfoPart;
}
示例7: 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()));
}