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