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