本文整理匯總了Java中javafx.scene.control.Label.setAlignment方法的典型用法代碼示例。如果您正苦於以下問題:Java Label.setAlignment方法的具體用法?Java Label.setAlignment怎麽用?Java Label.setAlignment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.Label
的用法示例。
在下文中一共展示了Label.setAlignment方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: PremisesAndConclusion
import javafx.scene.control.Label; //導入方法依賴的package包/類
public PremisesAndConclusion(String sPremises, String sConclusion) {
premises = new TextField(sPremises);
premises.textProperty().addListener((ov, oldValue, newValue) -> {
parseAndStyle(premises, newValue);
});
parseAndStyle(premises, sPremises);
premises.getStyleClass().add("myText");
turnstile = new Label("⊢");
turnstile.setPrefHeight(25);
turnstile.setPrefWidth(26.0);
turnstile.setPadding(new Insets(5,0,0,0));
turnstile.setAlignment(Pos.CENTER);
conclusion = new TextField(sConclusion);
conclusion.textProperty().addListener((ov, oldValue, newValue) -> {
parseAndStyle(conclusion, newValue);
});
parseAndStyle(conclusion, sConclusion);
conclusion.getStyleClass().add("myText");
consumeKeys(premises);
consumeKeys(conclusion);
this.getChildren().addAll(premises, turnstile, conclusion);
setPrefs();
}
示例2: 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;
}
示例3: init
import javafx.scene.control.Label; //導入方法依賴的package包/類
public void init() {
ImageView splash = new ImageView(new Image(
SPLASH_IMAGE
));
loadProgress = new ProgressBar();
loadProgress.setPrefWidth(SPLASH_WIDTH - 20);
loadProgress.setStyle("-fx-padding: 10; ");
progressText = new Label("Loading Chess Bot");
splashLayout = new VBox();
splashLayout.getChildren().addAll(splash, loadProgress, progressText);
progressText.setAlignment(Pos.CENTER);
splashLayout.setStyle(
"-fx-padding: 10; "
+ "-fx-background-color: white; "
+ "-fx-border-width:3; "
+ "-fx-border-color: "
+ "linear-gradient("
+ "to bottom, "
+ "chocolate, "
+ "derive(chocolate, 50%)"
+ ");"
);
splashLayout.setEffect(new DropShadow());
}
示例4: LabelContainer
import javafx.scene.control.Label; //導入方法依賴的package包/類
public LabelContainer(int labelIndex, int bahnsteig, ArrayList<LabelContainer> labelTime) throws Exception{
this.labelTime = labelTime;
this.bahnsteig = bahnsteig;
this.labelIndex = labelIndex;
trains = new ArrayList<>();
hervorhebungDurchGleis = false;
l = new Label();
l.setFont(Font.font(settingsFontSize-5));
l.setMinWidth(settingsGridWidth);
l.setMaxWidth(settingsGridWidth);
l.setAlignment(Pos.CENTER);
if(bahnsteig > -1){
updateLabel();
}
}
示例5: addState
import javafx.scene.control.Label; //導入方法依賴的package包/類
private void addState(State<?,?> state, HBox line, Color color, int stateIndex, String stateDescription) {
final Rectangle rectangle = new Rectangle(WIDTH, WIDTH, color);
rectangle.setArcHeight(WIDTH);
rectangle.setArcWidth(WIDTH);
rectangle.setUserData(state);
Label text = new Label(computeStateLabel(stateIndex));
text.setTextOverrun(OverrunStyle.ELLIPSIS);
text.setAlignment(Pos.CENTER);
text.setMouseTransparent(true);
text.setTextFill(Color.WHITE);
text.setFont(STATE_FONT);
text.setMaxWidth(WIDTH);
final Tooltip tooltip = new Tooltip(stateDescription);
Tooltip.install(rectangle, tooltip);
StackPane layout = new StackPane();
StackPane.setMargin(rectangle, MARGIN_INSETS);
layout.getChildren().addAll(rectangle, text);
line.getChildren().add(layout);
}
示例6: initVBox
import javafx.scene.control.Label; //導入方法依賴的package包/類
private void initVBox(){
EnumerationNode node = (EnumerationNode) getRefNode();
vbox.setPadding(new Insets(5, 0, 5, 0));
vbox.setSpacing(5);
titlePane = new VBox();
titlePane.setSpacing(5);
firstLine = new Separator();
firstLine.setMaxWidth(node.getWidth());
type = new Label();
type.setFont(Font.font("Helvetica", FontWeight.BOLD, 13));
type.setText("<<" + node.getType().toLowerCase() + ">>");
type.setTextFill(Color.web("#4B6299"));
type.setAlignment(Pos.TOP_CENTER);
title = new Label();
title.setFont(Font.font("Verdana", FontWeight.BOLD, 12));
title.setManaged(false);
if(node.getTitle() != null) {
title.setText(node.getTitle());
title.setVisible(true);
title.setManaged(true);
}
title.setAlignment(Pos.BOTTOM_CENTER);
values = new Label(node.getValues());
values.setFont(Font.font("Verdana", 10));
titlePane.getChildren().add(type);
titlePane.getChildren().add(title);
vbox.getChildren().addAll(titlePane, firstLine, values);
}
示例7: fixedLetter
import javafx.scene.control.Label; //導入方法依賴的package包/類
private void fixedLetter(final char symbol, int row, int col) {
Label l = new Label("" + symbol);
l.setFont(prototype.getFont());
l.setAlignment(Pos.CENTER);
l.setPrefWidth(prototype.getPrefWidth());
gameField.add(l, col, row);
game[row][col] = symbol;
}
示例8: initComponents
import javafx.scene.control.Label; //導入方法依賴的package包/類
private void initComponents() {
messageLabel = new Label(message);
messageLabel.setAlignment(Pos.CENTER);
messageLabel.setStyle("-fx-background-color:#000000");
messageLabel.setTextFill(javafx.scene.paint.Color.WHITE);
messageLabel.setMaxWidth(Double.MAX_VALUE);
setScene(new Scene(new VBox(FXUIUtils.getImage("wait"), messageLabel)));
}
示例9: createBlurbTitle
import javafx.scene.control.Label; //導入方法依賴的package包/類
private HBox createBlurbTitle() {
Label bulrbTitleLabel = createLabel(versionInfo.getBlurbTitle());
bulrbTitleLabel.setId("blurbTitle");
bulrbTitleLabel.setAlignment(Pos.TOP_CENTER);
HBox titleBox = new HBox();
titleBox.setId("titleBar");
titleBox.setAlignment(Pos.TOP_CENTER);
titleBox.getChildren().addAll(bulrbTitleLabel);
return titleBox;
}
示例10: createBox
import javafx.scene.control.Label; //導入方法依賴的package包/類
private Node createBox(Cursor cursor) {
Label label = new Label(cursor.toString());
label.setAlignment(Pos.CENTER);
label.setPrefSize(85, 85);
label.setStyle("-fx-border-color: #aaaaaa; -fx-background-color: #dddddd;");
label.setCursor(cursor);
return label;
}
示例11: 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;
}
示例12: 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.");
}
示例13: createIconLabel
import javafx.scene.control.Label; //導入方法依賴的package包/類
public static Label createIconLabel(GlyphIcons icon, String iconSize, String text, ContentDisplay contentDisplay, Paint colour, String style, Pos alignment, int width)
{
Text iconLabel = GlyphsDude.createIcon(icon, iconSize);
iconLabel.setFill(colour);
Label label = new Label(text);
label.setTextFill(colour);
label.setStyle(style);
label.setGraphic(iconLabel);
label.setContentDisplay(contentDisplay);
label.setMinWidth(width);
label.setMaxWidth(width);
label.setAlignment(alignment);
return label;
}
示例14: 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;
}
示例15: 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);
}
}
}