本文整理汇总了Java中javafx.scene.control.Label.setPrefWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Label.setPrefWidth方法的具体用法?Java Label.setPrefWidth怎么用?Java Label.setPrefWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Label
的用法示例。
在下文中一共展示了Label.setPrefWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ProcessCell
import javafx.scene.control.Label; //导入方法依赖的package包/类
public ProcessCell() {
processName = new Label();
processName.setPrefWidth(Metrics.PROCESS_NAME_W);
cpu = new Label();
cpu.setPrefWidth(Metrics.PROCESS_CPU_W);
myView = new HBox(processName, cpu);
}
示例3: 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;
}
示例4: showTrainInformations
import javafx.scene.control.Label; //导入方法依赖的package包/类
public void showTrainInformations() throws Exception{
int heightCounter = 0;
informations.getChildren().clear();
for(Zug z : trains){
debugMessage("INFORMATION: Maus befindet sich ueber " + z.getZugName() + " und zeigt die Informationen: " + settingsShowInformations, true);
Label trainName = new Label(z.getZugName() + z.getVerspaetungToString());
trainName.setStyle("-fx-text-fill: white");
trainName.setFont(Font.font(settingsFontSize-2));
trainName.setTranslateY(heightCounter);
if(z.getFahrplan() != null){
for(FahrplanHalt fh : z.getFahrplan()){
if(fh.getFlaggedTrain() != null){
trainName.setText(trainName.getText() + " => " + fh.getFlaggedTrain().getZugName() + fh.getFlaggedTrain().getVerspaetungToString());
break;
}
}
}
Label vonBis = new Label(z.getVon() + " - " + z.getNach());
vonBis.setStyle("-fx-text-fill: white");
vonBis.setFont(Font.font(settingsFontSize-5));
vonBis.setTranslateY(heightCounter + 25);
informations.getChildren().addAll(trainName, vonBis);
for(int i = 0; i < z.getFahrplan().length; i++){
long lAnkunft = z.getFahrplan(i).getAnkuft() + z.getVerspaetung()*1000*60;
long lAbfahrt = z.getFahrplan(i).getAbfahrt() + z.getVerspaetung()*1000*60;
if(z.getVerspaetung() > 3 && (lAbfahrt-lAnkunft)/1000/60 > 3){
lAbfahrt = lAnkunft + 4*1000*60;
}
String durchfahrt = "";
if(z.getFahrplan(i).isCrossing()) durchfahrt = " Df.";
Date anunft = new Date(lAnkunft);
Date abfahrt = new Date(lAbfahrt);
SimpleDateFormat ft = new SimpleDateFormat("HH:mm");
Label l = new Label("Gleis: " + z.getFahrplan(i).getGleis() + " " + ft.format(anunft) + " - " + ft.format(abfahrt) + durchfahrt);
l.setFont(Font.font(settingsFontSize-5));
l.setTranslateY(heightCounter + 55);
l.setPrefWidth(settingsInformationWith-25);
if(z.getGleis().equals(z.getFahrplan(i).getGleis()) && z.getAmGleis()){
l.setStyle("-fx-text-fill: white; -fx-background-color: green");
} else if(z.getFahrplan(i).getGleis().equals(bahnsteige[bahnsteig])){
l.setStyle("-fx-text-fill: white; -fx-background-color: #505050");
} else{
l.setStyle("-fx-text-fill: white");
}
informations.getChildren().add(l);
heightCounter += 20;
}
heightCounter += 75;
}
informations.setPrefHeight(heightCounter);
}