Java 类javafx.scene.text.FontWeight 实例源码

项目:domino-todolist    文件:DesktopLayoutView.java   
@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.setOnShowing(event -> uiHandlers.onShow());
    BorderPane border = new BorderPane();
    hbox = new HBox();
    border.setTop(hbox);
    hbox.setMinHeight(60);
    hbox.setAlignment(Pos.CENTER_LEFT);
    hbox.setBackground(new Background(new BackgroundFill(Color.web("#2196f3"), CornerRadii.EMPTY, Insets.EMPTY)));
    hbox.setPadding(new Insets(10));

    menu = new VBox();
    menu.setPadding(new Insets(20, 0, 0, 0));
    BorderStroke borderStroke = new BorderStroke(Color.GRAY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(0,1,0,0));

    menu.setBorder(new Border(borderStroke));
    menu.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
    menu.setMinWidth(50);
    menu.setSpacing(20);
    border.setLeft(menu);


    primaryStage.setTitle("Todo list");

    Text text = new Text("Todo List");
    text.setFill(Color.WHITE);
    text.setFont(Font.font("Verdana", FontWeight.BOLD, 25));

    center = new VBox();
    center.setPadding(new Insets(20));
    center.setSpacing(10);
    Image image = new Image(getClass().getResourceAsStream("/add.png"));
    Button add = new Button("", new ImageView(image));
    add.setCursor(Cursor.HAND);
    add.setBackground(Background.EMPTY);
    add.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE);
    add.setOnAction(event -> uiHandlers.onCreate());

    border.setCenter(center);

    hbox.setPadding(new Insets(10, 10, 10, 10));

    final Pane spacer = new Pane();
    HBox.setHgrow(spacer, Priority.ALWAYS);
    spacer.setMinSize(10, 1);
    hbox.getChildren().addAll(text, spacer, add);

    primaryStage.setScene(new Scene(border, 500, 500));
    primaryStage.show();
}
项目:marathonv5    文件:ResultPane.java   
private void setLabel() {
    String text;
    if (failuresList == null) {
        text = "";
    } else if (failuresList.size() > 0) {
        String errorString = failuresList.size() == 1 ? " error" : " errors";
        text = failuresList.size() + errorString;
        tableLabel.setTextFill(Color.RED);
    } else {
        text = "No Errors";
        tableLabel.setTextFill(Color.GREEN);
    }

    tableLabel.setText(text);
    tableLabel.setFont(Font.font(tableLabel.getFont().toString(), FontWeight.BOLD, 12));
    tableLabel.setLabelFor(resultTable);
}
项目:marathonv5    文件:HTMLEditorSample.java   
public static Node createIconContent() {

        Text htmlStart = new Text("<html>");
        Text htmlEnd = new Text("</html>");
        htmlStart.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlStart.setStyle("-fx-font-size: 20px;");
        htmlStart.setTextOrigin(VPos.TOP);
        htmlStart.setLayoutY(11);
        htmlStart.setLayoutX(20);

        htmlEnd.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlEnd.setStyle("-fx-font-size: 20px;");
        htmlEnd.setTextOrigin(VPos.TOP);
        htmlEnd.setLayoutY(31);
        htmlEnd.setLayoutX(20);

        return new Group(htmlStart, htmlEnd);
    }
项目:marathonv5    文件:StringBindingSample.java   
public static Node createIconContent() {
    Text text = new Text("abc");
    text.setTextOrigin(VPos.TOP);
    text.setLayoutX(10);
    text.setLayoutY(11);
    text.setFill(Color.BLACK);
    text.setOpacity(0.5);
    text.setFont(Font.font(null, FontWeight.BOLD, 20));
    text.setStyle("-fx-font-size: 20px;");

    Text text2 = new Text("abc");
    text2.setTextOrigin(VPos.TOP);
    text2.setLayoutX(28);
    text2.setLayoutY(51);
    text2.setFill(Color.BLACK);
    text2.setFont(javafx.scene.text.Font.font(null, FontWeight.BOLD, 20));
    text2.setStyle("-fx-font-size: 20px;");

    Line line = new Line(30, 32, 45, 57);
    line.setStroke(Color.DARKMAGENTA);

    return new javafx.scene.Group(text, line, text2);
}
项目:marathonv5    文件:HTMLEditorSample.java   
public static Node createIconContent() {

        Text htmlStart = new Text("<html>");
        Text htmlEnd = new Text("</html>");
        htmlStart.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlStart.setStyle("-fx-font-size: 20px;");
        htmlStart.setTextOrigin(VPos.TOP);
        htmlStart.setLayoutY(11);
        htmlStart.setLayoutX(20);

        htmlEnd.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlEnd.setStyle("-fx-font-size: 20px;");
        htmlEnd.setTextOrigin(VPos.TOP);
        htmlEnd.setLayoutY(31);
        htmlEnd.setLayoutX(20);

        return new Group(htmlStart, htmlEnd);
    }
项目:marathonv5    文件:StringBindingSample.java   
public static Node createIconContent() {
    Text text = new Text("abc");
    text.setTextOrigin(VPos.TOP);
    text.setLayoutX(10);
    text.setLayoutY(11);
    text.setFill(Color.BLACK);
    text.setOpacity(0.5);
    text.setFont(Font.font(null, FontWeight.BOLD, 20));
    text.setStyle("-fx-font-size: 20px;");

    Text text2 = new Text("abc");
    text2.setTextOrigin(VPos.TOP);
    text2.setLayoutX(28);
    text2.setLayoutY(51);
    text2.setFill(Color.BLACK);
    text2.setFont(javafx.scene.text.Font.font(null, FontWeight.BOLD, 20));
    text2.setStyle("-fx-font-size: 20px;");

    Line line = new Line(30, 32, 45, 57);
    line.setStroke(Color.DARKMAGENTA);

    return new javafx.scene.Group(text, line, text2);
}
项目:PSE    文件:ItemViewAdapter.java   
/**
 * Creates the title and description text.
 * @return Returns a VBox containing the data.
 */
public VBox createText(){

    final VBox layout = new VBox(15.0f);
    layout.setAlignment(Pos.CENTER_LEFT);
    layout.setPadding(new Insets(10,10,10,10));
    layout.setMaxWidth(300.0f);

    lblTitle = new Label(this.title);
    lblTitle.setTextFill(javafx.scene.paint.Paint.valueOf("#ff0000"));
    lblTitle.setFont( javafx.scene.text.Font.font(FONT_NAME, FontWeight.EXTRA_BOLD,FONT_SIZE) );

    txtDescription = new Text(this.description);
    txtDescription.setFill(Paint.valueOf("#ffffff"));
    txtDescription.setFont( javafx.scene.text.Font.font(FONT_NAME, FontWeight.BOLD,12.0f) );
    txtDescription.setBoundsType(TextBoundsType.LOGICAL_VERTICAL_CENTER);

    layout.getChildren().add(lblTitle);
    layout.getChildren().add(txtDescription);

    return layout;

}
项目:jedai-ui    文件:HelpTooltip.java   
public HelpTooltip(String tooltipText) {
    // Set text as question mark and general style
    this.setText("?");
    this.setPrefSize(35, 35);
    this.setMinSize(35, 35);
    this.setFont(Font.font("System", FontWeight.BOLD, 20));
    this.setAlignment(Pos.CENTER);
    this.setStyle("-fx-background-color: #9098ff; -fx-background-radius: 30px");

    // Create and add tooltip (need to set its font because otherwise it's inherited from the Label)
    Tooltip descriptionTooltip = new Tooltip(tooltipText);
    descriptionTooltip.setPrefWidth(250);
    descriptionTooltip.setWrapText(true);
    descriptionTooltip.setFont(new Font("System", 12));
    this.setTooltip(descriptionTooltip);
}
项目:projectintern    文件:NewGame.java   
private void displayAuxObjects() {
    // Format btnTitleScreen
    btnTitleScreen.setPrefSize(WIDTH / 4, HEIGHT / 10);
    btnTitleScreen.setAlignment(Pos.CENTER);

    // Format txtSelectClass
    txtSelectClass.setFill(Color.rgb(234, 234, 234));
    txtSelectClass.setFont(Font.font("Verdana", FontWeight.BOLD, 50));

    // Modify vbTopObjects
    vbTopObjects = new VBox(WIDTH / 100);
    vbTopObjects.getChildren().addAll(btnTitleScreen, txtSelectClass);
    vbTopObjects.setAlignment(Pos.CENTER);

    this.setTop(vbTopObjects);
}
项目:wall-t    文件:ProjectTileView.java   
private void createBuildInformation( ) {
    final Label tileTitle = new Label( );
    tileTitle.setFont( UIUtils.font( 50, FontWeight.BOLD ) );
    tileTitle.setTextFill( Color.WHITE );
    tileTitle.setPadding( new Insets( 5 ) );
    tileTitle.setWrapText( true );
    tileTitle.textProperty( ).bind( _model.displayedNameProperty( ) );
    tileTitle.setEffect( UIUtils.shadowEffect( ) );
    tileTitle.prefWidthProperty( ).bind( widthProperty( ) );
    tileTitle.prefHeightProperty( ).bind( heightProperty( ) );
    tileTitle.alignmentProperty( ).bind( createObjectBinding( ( ) -> _model.isLightMode( ) ? Pos.CENTER : CENTER_LEFT, _model.lightModeProperty( ) ) );
    tileTitle.textAlignmentProperty( ).bind( createObjectBinding( ( ) -> _model.isLightMode( ) ? CENTER : LEFT, _model.lightModeProperty( ) ) );
    HBox.setHgrow( tileTitle, Priority.SOMETIMES );
    getChildren( ).add( tileTitle );

    final VBox contextPart = createContextPart( );
    contextPart.visibleProperty( ).bind( _model.lightModeProperty( ).not( ) );
    contextPart.prefWidthProperty( ).bind( createIntegerBinding( ( ) -> contextPart.isVisible( ) ? 90 : 0, contextPart.visibleProperty( ) ) );
    contextPart.prefHeightProperty( ).bind( heightProperty( ) );
    contextPart.setMinSize( USE_PREF_SIZE, USE_PREF_SIZE );
    contextPart.setMaxSize( USE_PREF_SIZE, USE_PREF_SIZE );
    getChildren( ).add( contextPart );
}
项目:wall-t    文件:TileView.java   
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;
}
项目:WebPLP    文件:CpuWindow.java   
private HBox createTopBar()
{
    HBox counterHBox = new HBox();
    counterHBox.setPadding(new Insets(15, 15, 15, 15));
    counterHBox.setSpacing(10);

    Label programCounterLabel = new Label("Program Count");
    programCounterLabel.setFont(Font.font("Arial", FontWeight.NORMAL, 16));

    TextField programCounterText = new TextField();
    programCounterText.setPrefWidth(50);

    Label nextInstructionLabel = new Label("Next Instruction");
    nextInstructionLabel.setFont(Font.font("Arial", FontWeight.NORMAL, 16));

    TextField nextInstructionText = new TextField();
    nextInstructionText.setPrefWidth(200);
    counterHBox.getChildren().addAll(programCounterLabel, programCounterText,
            nextInstructionLabel, nextInstructionText);

    return counterHBox;
}
项目:AlphaLab    文件:FrmGerenciarHorario.java   
private List<StackPane> buildBoxHorario() {
    List<StackPane> boxHorarios = new ArrayList<>();

    for (ReservaEntity reservaEntity : novasReservas) {

        VBox vbox = new VBox(7);
        vbox.setAlignment(Pos.CENTER);

        Rectangle rect = new Rectangle(100, 150);
        rect.setStroke(Color.BLACK);
        rect.setStrokeWidth(2);
        rect.setFill(Color.TRANSPARENT);

        Text data = new Text(new SimpleDateFormat("dd/MM/yyyy").format(reservaEntity.getDataInicio()));
        data.setFont(Font.font("Verdana", FontWeight.BOLD, 12.0));
        vbox.getChildren().add(data);

        for (Horario horario : reservaEntity.getHorarios()) {
            vbox.getChildren().add(new Text(horario.getEstampa()));
        }

        boxHorarios.add(new StackPane(rect, vbox));
    }

    return boxHorarios;
}
项目:AlphaLab    文件:FrmSolicitarReservaHorarioPorRequisito.java   
/**
 * Constroi a caixa de hor�rio exibida na tabPreencherDados
 * 
 * @return
 */
private StackPane buildBoxHorario() {
    VBox vbox = new VBox(7);
    vbox.setAlignment(Pos.CENTER);

    Rectangle rect = new Rectangle(200, 150);
    rect.setStroke(Color.BLACK);
    rect.setStrokeWidth(2);
    rect.setFill(Color.TRANSPARENT);

    Text data = new Text(new SimpleDateFormat("dd/MM/yyyy").format(dtSolicitacaoReserva));
    data.setFont(Font.font("Verdana", FontWeight.BOLD, 12.0));
    vbox.getChildren().add(data);

    for (Horario horario : listaHorariosSelecionados) {
        vbox.getChildren().add(new Text(horario.getEstampa()));
    }

    StackPane caixa = new StackPane(rect, vbox);
    return caixa;
}
项目:fxexperience2    文件:FontPickerController.java   
private void changeFont() {
    try {
        double size = numberFormat.parse(sizeComboBox.getValue()).doubleValue();

        FontWeight weight = styleChoiceBox.getSelectionModel().isSelected(0) ||
                styleChoiceBox.getSelectionModel().isSelected(1)
                ? FontWeight.BOLD : FontWeight.NORMAL;
        FontPosture posture = styleChoiceBox.getSelectionModel().isSelected(1) ||
                styleChoiceBox.getSelectionModel().isSelected(2)
                ? FontPosture.ITALIC : FontPosture.REGULAR;
        String family = familyComboBox.getValue();
        font.setValue(Font.font(family, weight, posture, size));
        sampleFontText.setFont(font.get());
    } catch (java.text.ParseException ex) {
        Logger.getLogger(FontPickerController.class.getName()).log(Level.SEVERE, null, ex);
    }
}
项目:fx-gson    文件:FontTypeAdapter.java   
@Override
public Font read(JsonReader in) throws IOException {
    if (in.peek() == JsonToken.NULL) {
        in.nextNull();
        return null;
    }
    String value = in.nextString();
    String path = in.getPath();

    String[] components = splitComponents(value, path);
    String family = components[0];
    String style = components[1];
    String sizeStr = components[2];

    FontWeight weight = extractWeight(style);
    FontPosture posture = extractPosture(style);
    double size = extractSize(sizeStr, path);

    return Font.font(family, weight, posture, size);
}
项目:ics4u    文件:HelloWorldPicture.java   
@Override
public void start(Stage mainStage) {
    mainStage.setTitle("Canvas Example");

    Group root = new Group();
    Scene mainScene = new Scene(root);
    mainStage.setScene(mainScene);

    Canvas canvas = new Canvas(400,400);
    root.getChildren().add(canvas);

    GraphicsContext gc = canvas.getGraphicsContext2D();

    gc.setFill(Color.RED);
    gc.setStroke(Color.BLACK);
    gc.setLineWidth(2);
    gc.setFont(Font.font("Times New Roman", FontWeight.BOLD, 48));
    gc.fillText("Hello, World!",  60, 50);
    gc.strokeText("Hello, World!", 60, 50);

    gc.drawImage(new Image("earth.png"), 180, 100);

    mainStage.show();
}
项目:Game-Engine-Vooga    文件:ProjectInitializationPrompt.java   
@Override
protected void initializeContainer () {
    container = new GridPane();
    container.setHgap(SPACING);
    container.setVgap(SPACING);
    container.setAlignment(Pos.CENTER);
    initializeFields();
    container.add(new CustomText("Welcome!", FontWeight.BOLD, HEADER_SIZE), 0, 0);
    container.add(new CustomText("Build a new game.", FontWeight.BOLD), 0, 1);
    container.add(new CustomText("Name:"), 0, 2);
    container.add(name, 1, 2);
    container.add(new CustomText("Description:"), 0, 3);
    container.add(description, 1, 3);
    container.add(new CustomText("Game Dimensions:"), 0, 4);
    container.add(dimensions, 1, 4);
}
项目:Game-Engine-Vooga    文件:ConnectionPrompt.java   
public ConnectionPrompt(String start, String end, CompleteAuthoringModelable model) {
    String startLevel = (start == null) ? NO_LEVEL_SELECTED : start;
    String endLevel = (end == null) ? NO_LEVEL_SELECTED : end;
    causeList = new VBox();
    LevelCauseWindow levelCause = new LevelCauseWindow(model, endLevel);
    Button addCond = new ButtonMaker().makeButton("Add Condition", e -> {
        levelCause.showAndWait();
        List<Cause> causes = levelCause.getCauseDetails();
        for(Cause c : causes) {
            causeList.getChildren().add(new CustomText(c.toString()));
        }
    });
    addCond.setDisable(start == null || end == null);
    container = new VBox();
    container.setAlignment(Pos.CENTER);
    container.getChildren().addAll(GUIUtils.makeRow(new CustomText("Start:", FontWeight.BOLD), new CustomText(startLevel)),
            GUIUtils.makeRow(new CustomText("End:", FontWeight.BOLD), new CustomText(endLevel)), GUIUtils.makeRow(addCond),
            causeList);
    Scene scene = new VoogaScene(container, SCENE_SIZE, SCENE_SIZE);
    this.setScene(scene);
}
项目:Gargoyle    文件:FontViewComposite.java   
/**
 * FontWeight이름의 값을 이용, weight값으로 변환후 slider에 값을 update처리.
 * @작성자 : KYJ
 * @작성일 : 2016. 12. 2.
 */
private void updateFontWeightByName() {

    if (ValueUtil.isNotEmpty(cbFontWeight.getValue())) {
        String fontWeight = cbFontWeight.getValue();

        /*
         *  this code is bug  jdk 1.8.11- > FontWeight.findByName(fontWeight);
         *  2016-12-02 by kyj.
         */

        FontWeight findByName = findByName(fontWeight);

        int weight = findByName.getWeight();
        sliderFontWeight.setValue(weight);
    }
}
项目:arma-dialog-creator    文件:HistoryListPopup.java   
public HistoryListItemNode(@NotNull HistoryListItem item) {
    super(5);
    final VBox vboxTitle = new VBox(5);
    final Label lblTitle = new Label(item.getItemTitle());
    lblTitle.setFont(Font.font(15));
    vboxTitle.getChildren().add(lblTitle);

    Font subInfoLabelFont = Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, 10);
    Font subInfoTextFont = Font.font(subInfoLabelFont.getSize());
    for (HistoryListItemSubInfo subInfo : item.getSubInfo()) {
        final Label lbl = new Label(subInfo.getLabel());
        lbl.setFont(subInfoLabelFont);
        final Label lblInfo = new Label(subInfo.getInfo());
        lblInfo.setFont(subInfoTextFont);
        vboxTitle.getChildren().add(new HBox(5, lbl, lblInfo));
    }

    getChildren().add(vboxTitle);
    final Label lblMainInfo = new Label(item.getInformation());
    lblMainInfo.setWrapText(true);
    getChildren().add(lblMainInfo);
}
项目:helloiot    文件:TopicInfoEdit.java   
@Override
public Node getGraphic() {

    Text t = new Text();
    t.setFill(Color.WHITE);
    t.setFont(Font.font(ExternalFonts.ROBOTOBOLD, FontWeight.BOLD, 10.0));
    TextFlow tf = new TextFlow(t);
    tf.setPrefWidth(55);
    tf.setTextAlignment(TextAlignment.CENTER);
    tf.setPadding(new Insets(2, 5, 2, 5));

    if ("Subscription".equals(getType())) {
        t.setText("SUB");
        tf.setStyle("-fx-background-color: #001A80; -fx-background-radius: 12px;");
    } else if ("Publication".equals(getType())) {
        t.setText("PUB");
        tf.setStyle("-fx-background-color: #4D001A; -fx-background-radius: 12px;");
    } else { // "Publication/Subscription"
        t.setText("P/SUB");
        tf.setStyle("-fx-background-color: #003300; -fx-background-radius: 12px;");
    }
    return tf;
}
项目:helloiot    文件:TopicInfoCode.java   
@Override
public Node getGraphic() {

    Text t = new Text();
    t.setFill(Color.WHITE);
    t.setFont(Font.font(ExternalFonts.ROBOTOBOLD, FontWeight.BOLD, 10.0));
    TextFlow tf = new TextFlow(t);
    tf.setPrefWidth(55);
    tf.setTextAlignment(TextAlignment.CENTER);
    tf.setPadding(new Insets(2, 5, 2, 5));

    t.setText("CODE");
    tf.setStyle("-fx-background-color: #001A80; -fx-background-radius: 12px;");

    return tf;
}
项目:JttDesktop    文件:JobPolicyPanel.java   
/**
 * Method to provide the control to set {@link BuildWallJobPolicy} for all {@link JenkinsJob}s at once.
 */
private void provideSetAllControl() {
   setAllBox = new SimplePropertyBox<>();
   setAllBox.getItems().addAll( BuildWallJobPolicy.values() );
   setAllBox.setMaxWidth( Double.MAX_VALUE );
   setAllBox.getSelectionModel().select( BuildWallJobPolicy.NeverShow );
   add( setAllBox, 0, 0 );

   setAllButton = new Button( "Set All" );
   Font setAllButtonFont = setAllButton.getFont();
   setAllButton.setFont( Font.font( setAllButtonFont.getFamily(), FontWeight.BOLD, FontPosture.REGULAR, setAllButtonFont.getSize() ) );
   setAllButton.setMaxWidth( Double.MAX_VALUE );
   add( setAllButton, 1, 0 );

   setAllButton.setOnAction( event -> setAllBoxesToSelectedPolicy() );
}
项目:SEGP_Group10    文件:AllocatedPATsController.java   
/**
 * 
 * @param index
 * @param student 
 * This methos will fill the data with studnes information
 */
public void fillTable(int index, ObservableList<Student> student) {

    TreeItem<Student> root = new RecursiveTreeItem<Student>(student, RecursiveTreeObject::getChildren);
    JFXTreeTableView<Student> table = new JFXTreeTableView<>();
    table.getColumns().setAll(studentUOB, studentName, emailAddress, studentYear, personalContact, dept);
    table.setRoot(root);
    table.setShowRoot(false);

    Label groupNumber = new Label("Group Number:  " + (index + 1));
    groupNumber.setFont(Font.font("Verdana", FontWeight.BOLD, 15));
    Label teacherName = new Label("Personal Accadeic Tutor Name: " + teachersInformation.get(index).split(",")[1]);
    teacherName.setFont(Font.font("Verdana", FontWeight.BOLD, 15));
    VBox vbox = new VBox();
    vbox.getChildren().addAll(groupNumber, teacherName, table);
    vbox.setSpacing(10);
    vBox.getChildren().addAll(groupNumber, teacherName, vbox);

}
项目:MULE    文件:VisualGrid.java   
@Override
public void printText(String toPrint) {
    if (overlayText != null) {
        clearText();
    }

    overlayText = new Text(0, 0, toPrint);
    overlayText.setFont(Font.font("monospaced", FontWeight.BOLD, FontPosture.REGULAR, 25));
    overlayText.yProperty().bind(
        this.upperPane.heightProperty().multiply(TEXT_DISPLAY_RATIO));

    overlayText.xProperty().bind(this.upperPane.widthProperty().multiply(0).add(TEXT_BUFFER));
    overlayText.wrappingWidthProperty().bind(this.upperPane.widthProperty().subtract(TEXT_BUFFER * 2));
    overlayText.setTextAlignment(TextAlignment.CENTER);

    this.upperPane.getChildren().add(overlayText);
}
项目:MULE    文件:VisualGrid.java   
@Override
public void printHeadline(String toPrint) {
    if (overlayHeadline != null) {
        clearText();
    }

    overlayHeadline = new Text(0, 0, toPrint);
    overlayHeadline.setFont(Font.font("monospaced", FontWeight.BOLD, FontPosture.REGULAR, 25));
    overlayHeadline.yProperty().bind(
        this.upperPane.heightProperty().multiply(HEADLINE_DISPLAY_RATIO));

    overlayHeadline.xProperty().bind(this.upperPane.widthProperty().multiply(0).add(TEXT_BUFFER));
    overlayHeadline.wrappingWidthProperty().bind(this.upperPane.widthProperty().subtract(TEXT_BUFFER * 2));
    overlayHeadline.setTextAlignment(TextAlignment.CENTER);

    this.upperPane.getChildren().add(overlayHeadline);
}
项目:mars-sim    文件:MenuTitle.java   
public MenuTitle(String name, int size, Color color, boolean useSpread) {
    String spread = "";
    if (useSpread) {
     for (char c : name.toCharArray()) {
         spread += c + " ";
     }
     text = new Text(spread);
     text.setFont(Font.loadFont(MenuApp.class.getResource("/fonts/Penumbra-HalfSerif-Std_35114.ttf").toExternalForm(), size));
     text.setEffect(new DropShadow(50, Color.BLACK));
    }
    else {
        text = new Text(name);
        text.setFont(Font.font(null, FontWeight.LIGHT, size));
    }

    text.setFill(color);
    text.setTextAlignment(TextAlignment.CENTER);

    getChildren().addAll(text);
}
项目:sgf4j-gui    文件:BoardSquare.java   
public void addOverlayText(String str) {
  // there are SGF files that place multiple labels
  // on a single square - right now won't support that
  // and always showing the latest one
  removeOverlayText();
  text = new Text(str);
  Font font = Font.font(Font.getDefault().getName(), FontWeight.MEDIUM, width/FONT_MULTIPLIER);
  text.setFont(font);
  text.setStroke(Color.SADDLEBROWN);
  text.setFill(Color.SADDLEBROWN);
  setAlignment(text, Pos.CENTER);
  getChildren().add(text);

  lineH.setVisible(false);
  lineV.setVisible(false);

  if (starPoint != null) {
    starPoint.setVisible(false);
  }
}
项目:Map-Projections    文件:ProjectionSelectionDialog.java   
private void describe(Projection p) {
    if (p == null) {
        flow.getChildren().clear();
        text.getChildren().clear();
        return;
    }

    final Text head = new Text(p.getName()+"\n");
    head.setFont(Font.font(head.getFont().getFamily(), FontWeight.BOLD, 18));
    final Text body = new Text(p.getDescription());
    flow.getChildren().setAll(head, body);

    text.getChildren().clear();
    text.addRow(0, new Label("Geometry:"), new Label(p.getType().getName()));
    text.addRow(1, new Label("Property:"), new Label(p.getProperty().getName()));
    text.addRow(2, new Label("Uninterrupted:"), new Label(p.isContinuous() ? "Yes" : "No"));
    text.addRow(3, new Label("Shows entire world:"), new Label(p.isFinite() ? "Yes" : "No"));
    text.addRow(4, new Label("Closed-form solution:"), new Label(p.isSolveable() ? "Yes" : "No"));
    text.addRow(5, new Label("Closed-form inverse:"), new Label(p.isInvertable() ? "Yes" : "No"));
    for (Node label: text.getChildren())
        ((Label)label).setFont(body.getFont());
}
项目:markdown-writer-fx    文件:GeneralOptionsPane.java   
/**
 * Return a list of all the mono-spaced fonts on the system.
 *
 * @author David D. Clark http://clarkonium.net/2015/07/finding-mono-spaced-fonts-in-javafx/
 */
private static Collection<String> getMonospacedFonts() {

    // Compare the layout widths of two strings. One string is composed
    // of "thin" characters, the other of "wide" characters. In mono-spaced
    // fonts the widths should be the same.

    final Text thinTxt = new Text("1 l"); // note the space
    final Text thikTxt = new Text("MWX");

    List<String> fontFamilyList = Font.getFamilies();
    List<String> monospacedFonts = new ArrayList<>();

    for (String fontFamilyName : fontFamilyList) {
        Font font = Font.font(fontFamilyName, FontWeight.NORMAL, FontPosture.REGULAR, 14.0d);
        thinTxt.setFont(font);
        thikTxt.setFont(font);
        if (thinTxt.getLayoutBounds().getWidth() == thikTxt.getLayoutBounds().getWidth())
            monospacedFonts.add(fontFamilyName);
    }

    return monospacedFonts;
}
项目:org.csstudio.display.builder    文件:JFXUtil.java   
/** Convert model font into JFX font
 *  @param font {@link WidgetFont}
 *  @return {@link Font}
 */
public static Font convert(final WidgetFont font)
{
    final double calibrated = font.getSize() * font_calibration;
    switch (font.getStyle())
    {
    case BOLD:
        return Font.font(font.getFamily(), FontWeight.BOLD, calibrated);
    case ITALIC:
        return Font.font(font.getFamily(), FontPosture.ITALIC, calibrated);
    case BOLD_ITALIC:
        return Font.font(font.getFamily(), FontWeight.BOLD, FontPosture.ITALIC, calibrated);
    default:
        return Font.font(font.getFamily(), calibrated);
    }
}
项目:CS317-project    文件:Calculator.java   
public static void setDisplay(GridPane pane, String n)
{
    //TextField display = new TextField();
    display.setPrefWidth(175);
    display.setPrefHeight(80);
    display.setPromptText(n);


    display.setFont(Font.font("Verdana", FontWeight.BOLD, 25));
    display.setStyle("-fx-text-inner-color: black;");


    pane.setColumnSpan(display, 5);
    pane.setRowSpan(display, 2);
    pane.add(display, 0, 0);
    pane.setHalignment(display, HPos.CENTER);
}
项目:wikokit    文件:WCMeaning.java   
/** Creates text field with a definition, meaning, sense description. 
 *
 * @param _max_meaning_number total number of different meanings for the current
 *                      POS-language sub-entry
 */
public void createDefinitionText(TMeaning _tmeaning, Integer _max_meaning_number) {
    String s_debug = "";
    if(WConstants.DEBUGUI)
        s_debug = "; meaning.id={_tmeaning.getID()}; meaning _n/max={meaning_n+1}/{_max_meaning_number}";

    // Meaning (sense) number.
    Integer meaning_n = _tmeaning.getMeaningNumber();

    // 1.a Definition
    // numbering logic: if only one definition then without number 1.
    String s_number = "";
    if(_max_meaning_number > 1)
        s_number = String.format("%d. ", meaning_n + 1);

    TWikiText twiki_text = _tmeaning.getWikiText();
    if(null != twiki_text)
        definition_value = s_number + twiki_text.getText() + s_debug;

    text_definition = new Text(definition_value);
    text_definition.setFont(Font.font("Times New Roman", FontWeight.NORMAL, 14));
    text_definition.setWrappingWidth(WConstants.wordcard_width - 35);
}
项目:FXMaps    文件:MapPane.java   
/**
 * Called internally to configure size, position and style of the overlay.
 */
private void configureOverlay() {
    dimmer = new StackPane();
    dimmer.setManaged(false);
    dimmerMessage = new Label(DEFAULT_OVERLAY_MESSAGE);
    dimmerMessage.setFont(Font.font(dimmerMessage.getFont().getFamily(), FontWeight.BOLD, 18));
    dimmerMessage.setTextFill(Color.WHITE);
    dimmer.getChildren().add(dimmerMessage);
    dimmer.setStyle("-fx-background-color: rgba(0, 0, 0, 0.6);");
    getChildren().add(dimmer);

    layoutBoundsProperty().addListener((v, o, n) -> {
        Platform.runLater(() -> {
            if(MapPane.this.getScene().getWindow() == null) return;
            Point2D mapPoint = contentPane.localToParent(0, 0);
            double topHeight = contentPane.getTop() == null ? 0 : contentPane.getTop().getLayoutBounds().getHeight();
            dimmer.resizeRelocate(mapPoint.getX(), mapPoint.getY() + topHeight, 
                contentPane.getWidth(), contentPane.getHeight() - topHeight);
        });
    });
}
项目:ftc_app_networked_simulator    文件:LegoLightSensorDevice.java   
public void setupDebugGuiVbox(VBox vbox) {
    vbox.setPadding(new Insets(10));
    vbox.setSpacing(8);

    Text title = new Text(mType.getName());
    title.setFont(Font.font("Arial", FontWeight.BOLD, 14));
    vbox.getChildren().add(title);

    HBox hboxMotor1 = new HBox();
    hboxMotor1.setPadding(new Insets(5, 12, 5, 12));
    hboxMotor1.setSpacing(10);

    Text motor1Text = new Text(mSimData[0].getName());
    VBox.setMargin(motor1Text, new Insets(0, 0, 0, 8));
    hboxMotor1.getChildren().add(motor1Text);

    Label lightSensorDebugLabel = new Label("label");
    this.mLightSensorDebugLabel = lightSensorDebugLabel;
    hboxMotor1.getChildren().add(mLightSensorDebugLabel);
    vbox.getChildren().add(hboxMotor1);
}
项目:Wallet    文件:Controller.java   
public void createSendButtons(){
    Label labelSend = AwesomeDude.createIconLabel(AwesomeIcon.SEND, "16");
labelSend.setPadding(new Insets(0,0,0,3));
btnSendTx.setGraphic(labelSend);
btnSendTx.setFont(Font.font(null, FontWeight.NORMAL, 14));
Label labelClear = AwesomeDude.createIconLabel(AwesomeIcon.TRASH_ALT, "18");
labelClear.setPadding(new Insets(0,0,0,3));
btnClearSendPane.setGraphic(labelClear);
btnClearSendPane.setFont(Font.font(null, FontWeight.NORMAL, 14));
txFee.lengthProperty().addListener(new ChangeListener<Number>(){
          @Override
          public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { 
        if(newValue.longValue() > oldValue.longValue()){
              char ch = txFee.getText().charAt(oldValue.intValue());  
              //Check if the new character is the number or other's
              if(!(ch >= '0' && ch <= '9') && ch != '.'){       
                   //if it's not number then just setText to previous one
                  setFeeTipText(); 
                  return;
              }
        }
        else
            setFeeTipText();
          }
      });
  }
项目:ch.bfh.mobicomp    文件:AltitudeProfileView.java   
private NumberAxis initYAxis() {
final NumberAxis yAxis = new NumberAxis();
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
    @Override
    public String toString(final Number object) {
    return String.format("%6.2f", object);
    }
});
yAxis.setTickLabelFont(Font.font("Arial", FontWeight.MEDIUM, 18));
yAxis.setPrefWidth(120);
yAxis.setAutoRanging(true);
yAxis.setLabel("Meters⁻²");
yAxis.setForceZeroInRange(false);
yAxis.setAnimated(true);
return yAxis;
   }
项目:ch.bfh.mobicomp    文件:VelocityProfileView.java   
private NumberAxis initYAxis() {
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
        @Override
        public String toString(final Number object) {
            return String.format("%6.2f", object);
        }
    });
    yAxis.setTickLabelFont(Font.font("Arial", FontWeight.MEDIUM, 18));
    yAxis.setPrefWidth(120);
    yAxis.setAutoRanging(true);
    yAxis.setLabel("m/s");
    yAxis.setForceZeroInRange(false);
    yAxis.setAnimated(false);
    return yAxis;
}
项目:ch.bfh.mobicomp    文件:EstimatedAltitudeProfileView.java   
private NumberAxis initYAxis() {
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
        @Override
        public String toString(final Number object) {
            return String.format("%6.2f", object);
        }
    });
    yAxis.setTickLabelFont(Font.font("Arial", FontWeight.MEDIUM, 18));
    yAxis.setPrefWidth(120);
    yAxis.setAutoRanging(true);
    yAxis.setLabel("Meters");
    yAxis.setForceZeroInRange(false);
    yAxis.setAnimated(true);
    return yAxis;
}