当前位置: 首页>>代码示例>>Java>>正文


Java Label.setTextAlignment方法代码示例

本文整理汇总了Java中javafx.scene.control.Label.setTextAlignment方法的典型用法代码示例。如果您正苦于以下问题:Java Label.setTextAlignment方法的具体用法?Java Label.setTextAlignment怎么用?Java Label.setTextAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.Label的用法示例。


在下文中一共展示了Label.setTextAlignment方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:u2032,项目名称:wall-t,代码行数:25,代码来源:TileView.java

示例2: 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;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:17,代码来源:LEDDisplay.java

示例3: text

import javafx.scene.control.Label; //导入方法依赖的package包/类
private static Label text(Resolution res, YCbCr matrix, int col) {
    Label l = new Label(Integer.toString(getLuma(matrix, col)));
    l.setFont(font(res.height / 54));
    l.setTextFill(gray(matrix.fromLumaCode(matrix.YMIN * 4)));
    l.setTextAlignment(TextAlignment.CENTER);
    l.setAlignment(Pos.CENTER);
    l.setPrefSize(getW(res.width, col), getLabelH(res.height));
    return l;
}
 
开发者ID:testing-av,项目名称:testing-video,代码行数:10,代码来源:BlackLevelBase.java

示例4: 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;
}
 
开发者ID:u2032,项目名称:wall-t,代码行数:28,代码来源:TileView.java

示例5: updateItem

import javafx.scene.control.Label; //导入方法依赖的package包/类
@Override 
protected void updateItem(Book item, boolean empty) 
{
    // required to ensure that cell displays properly
   super.updateItem(item, empty);

   if (empty || item == null)
   {
      setGraphic(null); // don't display anything
   }
   else 
   {
      // create layout for cell
      VBox vbox = new VBox(8.0); // 8 points of gap between controls
      vbox.setAlignment(Pos.CENTER); // center contents horizontally
      
      // configure thumbnail image
      ImageView thumbImageView = 
         new ImageView(new Image(item.getThumbImage()));
      thumbImageView.setPreserveRatio(true);
      thumbImageView.setFitHeight(100.0); // thumbnail 100 points tall
      vbox.getChildren().add(thumbImageView); // attach to Vbox
      
      // configure text
      Label label = new Label(item.getTitle());
      label.setWrapText(true); // wrap if text too wide to fit in cell
      label.setTextAlignment(TextAlignment.CENTER); // center text
      vbox.getChildren().add(label); // attach to VBox
      
      setGraphic(vbox); // attach custom layout to ListView cell
      setPrefWidth(USE_PREF_SIZE); // use preferred size for cell width
   }
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:34,代码来源:ImageTextCell.java

示例6: CalendarFXSamplerWelcome

import javafx.scene.control.Label; //导入方法依赖的package包/类
public CalendarFXSamplerWelcome() {
    super("CalendarFX", new Label(""));

    Label label = (Label) getContent();
    label.setWrapText(true);
    label.setMaxWidth(Double.MAX_VALUE);
    label.setMaxHeight(Double.MAX_VALUE);
    label.setTextAlignment(TextAlignment.CENTER);
    label.setAlignment(Pos.CENTER);
    label.setPadding(new Insets(50));
    label.setText("Welcome to the CalendarFX sampler. This application allows you to quickly browse through the "
            + "various controls that are available in this framework. In each sample you can play around with the "
            + "properties and controls shown on the right-hand side.");
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:15,代码来源:CalendarFXSamplerWelcome.java

示例7: 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;
}
 
开发者ID:HearthProject,项目名称:OneClient,代码行数:9,代码来源:ModpackTile.java

示例8: CircularDirectionIndicator

import javafx.scene.control.Label; //导入方法依赖的package包/类
public CircularDirectionIndicator(String name, double radius){
	this.name = name;
	this.radius = radius;
	
	root = new VBox();
	
	StackPane graphicalData = new StackPane();
	graphicalData.setMaxSize(radius * 2, radius * 2);
	lineBox = new Canvas();
	
	outerCircle = new Circle(graphicalData.getWidth() * 0.5, graphicalData.getHeight() * 0.5, radius);
	outerCircle.setFill(Color.TRANSPARENT);
	outerCircle.setStroke(Color.BLACK);
	/*innerCircle = new Circle(graphicalData.getWidth() * 0.5, graphicalData.getHeight() * 0.5, radius * 0.5);
	innerCircle.setFill(Color.TRANSPARENT);
	innerCircle.setStroke(Color.BLACK);*/
	
	lineBox.setWidth(radius * 2);
	lineBox.setHeight(radius * 2);
	
	graphicalData.getChildren().addAll(outerCircle, lineBox);
	
	valLbl = new Label(name+": 0.0");
	valLbl.setMinWidth(radius * 2);
	valLbl.setTextAlignment(TextAlignment.CENTER);
	
	HBox labalBox = new HBox();
	labalBox.getChildren().add(valLbl);
	labalBox.setAlignment(Pos.CENTER);
	
	root.setAlignment(Pos.CENTER);
	root.setSpacing(2.0);
	root.getChildren().addAll(labalBox, graphicalData);
	
	setValue(0);
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:37,代码来源:CircularDirectionIndicator.java

示例9: setupInfoLabel

import javafx.scene.control.Label; //导入方法依赖的package包/类
private static void setupInfoLabel(final Label label) {
	label.setMaxHeight(Double.MAX_VALUE);
	label.setMaxWidth(Double.MAX_VALUE);
	label.setTextAlignment(TextAlignment.CENTER);

	HBox.setHgrow(label, Priority.ALWAYS);
}
 
开发者ID:Bios-Marcel,项目名称:ServerBrowser,代码行数:8,代码来源:ServerListController.java

示例10: WizardUneditableStringPage

import javafx.scene.control.Label; //导入方法依赖的package包/类
public WizardUneditableStringPage(String title, String description,
    StringProperty uneditableText) {
  super(title);
  TextField uneditableTextField = new TextField();
  uneditableTextField.textProperty().bind(uneditableText);
  Label descriptionLabel = new Label(description);
  descriptionLabel.setWrapText(true);
  descriptionLabel.setTextAlignment(TextAlignment.JUSTIFY);
  this.getChildren().addAll(descriptionLabel, uneditableTextField);
  uneditableTextField.setDisable(true);
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:12,代码来源:WizardUneditableStringPage.java

示例11: createStateLabels

import javafx.scene.control.Label; //导入方法依赖的package包/类
private void createStateLabels() {
    Group overlay = map.getOverlayGroup();
    for(String state: Region.ALL_STATES) {
        Node stateNode = map.lookup("#"+state);
        if (stateNode != null) {
            Label label = new Label("+10");
            label.getStyleClass().add("heatmap-label");
            label.setTextAlignment(TextAlignment.CENTER);
            label.setAlignment(Pos.CENTER);
            label.setManaged(false);
            label.setOpacity(0);
            label.setVisible(false);
            Bounds stateBounds = stateNode.getBoundsInParent();
            if ("DE".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX()-25, stateBounds.getMinY(), 
                        stateBounds.getWidth()+50, stateBounds.getHeight());
            } else if ("VT".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX(), stateBounds.getMinY()-25, 
                        stateBounds.getWidth(), stateBounds.getHeight());
            } else if ("NH".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX(), stateBounds.getMinY()+30, 
                        stateBounds.getWidth(), stateBounds.getHeight());
            } else if ("MA".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX()-20, stateBounds.getMinY()-18, 
                        stateBounds.getWidth(), stateBounds.getHeight());
            } else if ("RI".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX(), stateBounds.getMinY(), 
                        stateBounds.getWidth()+40, stateBounds.getHeight());
            } else if ("ID".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX(), stateBounds.getMinY()+60, 
                        stateBounds.getWidth(), stateBounds.getHeight());
            } else if ("MI".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX()+60, stateBounds.getMinY(), 
                        stateBounds.getWidth(), stateBounds.getHeight());
            } else if ("FL".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX()+95, stateBounds.getMinY(), 
                        stateBounds.getWidth(), stateBounds.getHeight());
            } else if ("LA".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX()-50, stateBounds.getMinY(), 
                        stateBounds.getWidth(), stateBounds.getHeight());
            } else {
                label.resizeRelocate(stateBounds.getMinX(), stateBounds.getMinY(), 
                        stateBounds.getWidth(), stateBounds.getHeight());
            }
            stateLabelMap.put(state, label);
            overlay.getChildren().add(label);
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:50,代码来源:HeatTabController.java


注:本文中的javafx.scene.control.Label.setTextAlignment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。