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

项目: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);
}
项目:CapsLock    文件:OverLayWindow.java   
void Exe(int i) {
    if(i==1) {
        warnmesse="プレイ開始から5分経過しました\n混雑している場合は次の人に\n交代してください";
        fontsize=25;
    }else if(i==2) {
        warnmesse="プレイ開始から10分経過しました\n混雑している場合は次の人に\n交代してください";
        fontsize=25;
    }else if(i==-1) {
        warnmesse="user timer is reset";
        fontsize=35;
    }

    final Stage primaryStage = new Stage(StageStyle.TRANSPARENT);
    primaryStage.initModality(Modality.NONE);
    final StackPane root = new StackPane();

    final Scene scene = new Scene(root, 350, 140);
    scene.setFill(null);

    final Label label = new Label(warnmesse);
    label.setFont(new Font("Arial", fontsize));
    BorderPane borderPane = new BorderPane();
    borderPane.setCenter(label);
    borderPane.setStyle("-fx-background-radius: 10;-fx-background-color: rgba(0,0,0,0.3);");

    root.getChildren().add(borderPane);

    final Rectangle2D d = Screen.getPrimary().getVisualBounds();
    primaryStage.setScene(scene);
    primaryStage.setAlwaysOnTop(true);
    primaryStage.setX(d.getWidth()-350);
    primaryStage.setY(d.getHeight()-300);

    primaryStage.show();

    final Timeline timer = new Timeline(new KeyFrame(Duration.seconds(CLOSE_SECONDS), (ActionEvent event) -> primaryStage.close()));
    timer.setCycleCount(Timeline.INDEFINITE);
    timer.play();
}
项目:dynamo    文件:LevelBarSkin.java   
private void updatePointer() {
    currentValueText.setText(formatCurrentValue(getSkinnable().getCurrentValue(), getSkinnable().getDecimals()));
    currentValueText.setFont(Font.font("Digital-7", width * CURRENT_VALUE_FONT_SIZE_FACTOR));
    currentValueText.setTextOrigin(VPos.TOP);
    currentValueText.setTextAlignment(TextAlignment.RIGHT);

    currentValuePointer.getStyleClass().clear();
    currentValuePointer.getStyleClass().setAll("normal-current-value-pointer");
    currentValuePointer.setPrefSize(currentValueText.getLayoutBounds().getWidth()*1.10, currentValueText.getLayoutBounds().getHeight()*1.10);
    currentValuePointerGroup.setTranslateX((width/2 + barWidth/2) - currentValuePointerGroup.getLayoutBounds().getWidth());

    final double newPosition =  getSkinnable().getCurrentValue() < getSkinnable().getMinValue() ? height - (currentValuePointerGroup.getLayoutBounds().getHeight() * 0.5) :
                                getSkinnable().getCurrentValue() > getSkinnable().getMaxValue() ? height - barHeight - (currentValuePointerGroup.getLayoutBounds().getHeight() * 0.5) :
                                height - (currentValuePointerGroup.getLayoutBounds().getHeight() * 0.5) - (barHeight * (getSkinnable().getCurrentValue()-getSkinnable().getMinValue()) / (getSkinnable().getMaxValue()-getSkinnable().getMinValue()));

    if(getSkinnable().getAnimated()){
        timeline.stop();
        final KeyValue KEY_VALUE = new KeyValue(currentValuePointerGroup.translateYProperty(), newPosition, Interpolator.EASE_BOTH);
        final KeyFrame KEY_FRAME = new KeyFrame(Duration.millis(getSkinnable().getAnimationDuration()), KEY_VALUE);
        timeline.getKeyFrames().setAll(KEY_FRAME);
        timeline.play();
    }else {
        currentValuePointerGroup.setTranslateY(newPosition);
    }
}
项目: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;
}
项目:hygene    文件:NodeDrawingToolkit.java   
/**
 * Sets the node height used for drawing.
 * <p>
 * Also updates the font size used for drawing sequences within nodes.
 *
 * @param nodeHeight the node height
 */
public final void setNodeHeight(final double nodeHeight) {
    this.nodeHeight = nodeHeight;
    this.snpHeight = nodeHeight * SNP_HEIGHT_FACTOR;

    final Text text = new Text("X");
    text.setFont(new Font(DEFAULT_NODE_FONT, 1));

    final double font1PHeight = text.getLayoutBounds().getHeight();

    final String font;

    if (SystemUtils.IS_OS_MAC) {
        font = DEFAULT_MAC_NODE_FONT;
    } else {
        font = DEFAULT_NODE_FONT;
    }

    final double fontSize = DEFAULT_NODE_FONT_HEIGHT_SCALAR * nodeHeight / font1PHeight;
    this.nodeFont = new Font(font, fontSize);
    text.setFont(nodeFont);

    this.charWidth = text.getLayoutBounds().getWidth();
    this.charHeight = text.getLayoutBounds().getHeight();
}
项目:charts    文件:StreamChart.java   
private void resize() {
    width         = getWidth() - getInsets().getLeft() - getInsets().getRight();
    height        = getHeight() - getInsets().getTop() - getInsets().getBottom();
    reducedHeight = height - height * 0.05;
    size          = width < height ? width : height;

    if (width > 0 && height > 0) {
        canvas.setWidth(width);
        canvas.setHeight(height);
        canvas.relocate((getWidth() - width) * 0.5, (getHeight() - height) * 0.5);

        ctx.setTextBaseline(VPos.CENTER);
        ctx.setFont(Font.font(Helper.clamp(8, 24, size * 0.025)));

        groupBy(getCategory());
    }
}
项目:charts    文件:SankeyPlot.java   
private void resize() {
    width  = getWidth() - getInsets().getLeft() - getInsets().getRight();
    height = getHeight() - getInsets().getTop() - getInsets().getBottom();
    size   = width < height ? width : height;

    if (width > 0 && height > 0) {
        canvas.setWidth(width);
        canvas.setHeight(height);
        canvas.relocate((getWidth() - width) * 0.5, (getHeight() - height) * 0.5);

        ctx.setTextBaseline(VPos.CENTER);
        ctx.setFont(Font.font(Helper.clamp(8, 24, size * 0.025)));

        prepareData();
    }
}
项目: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);
    }
}
项目: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;
}
项目: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);
}
项目:LIRE-Lab    文件:ToolTipProvider.java   
public void setToolTip(ImageView imageView, Image image) {
    String msg = "";
    msg += "image: " + image.getImageName() + "\n";

    if(image.getPosition() != -1)
        msg += "position: " + image.getPosition() + "\n";

    if(image.getScore() != -1)
        msg += "score: " + image.getScore() + "\n";

    Tooltip tooltip = new Tooltip(msg);
    tooltip.setFont(new Font("Arial", 16));
    tooltip.setStyle("-fx-background-color: aquamarine; -fx-text-fill: black");

    Tooltip.install(imageView, tooltip);
}
项目:octoBubbles    文件:StartController.java   
@FXML
public void initialize() {
    Image icon = new Image("com/kaanburaksener/octoUML/src/icons/classDiagram.PNG");
    classDiagramButton.setGraphic(new ImageView(icon));
    classDiagramButton.setContentDisplay(ContentDisplay.BOTTOM);

    titleLabel.setFont(Font.font("Verdana", FontWeight.BOLD, 60));
    titleLabel.setTextFill(Color.web("#3F4144"));
}
项目:FEFEditor    文件:ToggleSwitchSkin.java   
@Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
    final String labelText = label.getText();
    final Font font = label.getFont();
    double textWidth = Utils.computeTextWidth(font, labelText, 0);

    return leftInset + textWidth + 20 + thumbArea.prefWidth(-1) + rightInset;
}
项目:FEFEditor    文件:ToggleSwitchSkin.java   
@Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)
{
    final Font font = label.getFont();
    final String labelText = label.getText();
    final double textHeight = Utils.computeTextHeight(font, labelText, 0, label.getLineSpacing(), label.getBoundsType());

    return topInset + Math.max(thumb.prefHeight(-1), textHeight) + bottomInset;
}
项目:CSS-Editor-FX    文件:OptionsController.java   
private <T> void handle(OptionGroup og) {
  nowTab++;
  Label label = new Label(og.getDescribe());
  Font font = label.getFont();
  label.setFont(Font.font(font.getSize() + 10 - nowTab * 3));
  add(label);
  og.getChildren().forEach(e -> e.exec(this::handle, this::handle));
  nowTab--;
}
项目:WebPLP    文件:Main.java   
private ObservableList<String> getAvailableFontNames()
{
    ObservableList<String> fontNames = FXCollections.observableArrayList();
    GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment
            .getLocalGraphicsEnvironment();
    java.awt.Font[] fonts = graphicsEnvironment.getAllFonts();
    for (java.awt.Font font : fonts)
    {
        String fontName = font.getFontName();
        fontNames.add(fontName);
    }

    return fontNames;
}
项目:incubator-netbeans    文件:StopWatch.java   
private void configureName(String string) {
    Font font = new Font(9);
    name.setText(string);
    name.setBoundsType(TextBoundsType.VISUAL);
    name.setLayoutX(-name.getBoundsInLocal().getWidth() / 2 + 4.8);
    name.setLayoutY(radius * 1 / 2 + 4);
    name.setFill(FILL_COLOR);
    name.setFont(font);
}
项目:charts    文件:Axis.java   
private double calcTextWidth(final Font FONT, final String TEXT) {
    Text text = new Text(TEXT);
    text.setFont(FONT);
    double width = text.getBoundsInParent().getWidth();
    text = null;
    return width;
}
项目:incubator-netbeans    文件:KeyStrokeMotion.java   
public LettersPane() {
    setId("LettersPane");
    setPrefSize(480,480);
    setFocusTraversable(true);
    setOnMousePressed(new EventHandler<MouseEvent>() {

        @Override public void handle(MouseEvent me) {
            requestFocus();
            me.consume();
        }
    });
    setOnKeyPressed(new EventHandler<KeyEvent>() {

        @Override public void handle(KeyEvent ke) {
            createLetter(ke.getText());
            ke.consume();
        }
    });
    // create press keys text
    pressText = new Text("Press Keys");
    pressText.setTextOrigin(VPos.TOP);
    pressText.setFont(new Font(Font.getDefault().getFamily(), 40));
    pressText.setLayoutY(5);
    pressText.setFill(Color.rgb(80, 80, 80));
    DropShadow effect = new DropShadow();
    effect.setRadius(0);
    effect.setOffsetY(1);
    effect.setColor(Color.WHITE);
    pressText.setEffect(effect);
    getChildren().add(pressText);
}
项目:IOTproject    文件:Main.java   
@Override
    public void start(Stage primaryStage) {
        try {
//          Image setting = new Image(getClass().getResourceAsStream("setting.png"j));
            Image logoimg = new Image(getClass().getResourceAsStream("logo.png"));
//          Button settingbtn = new Button("",new ImageView(setting));
//          settingLabel.setStyle("-fx-background-color:#1d1d1d");
            JFXButton logobtn = new JFXButton("",new ImageView(logoimg));
            Label title = new Label("       Energy Saving System");
            title.setFont(new Font(30));
            title.setPrefSize(650, 60);
            title.setStyle("-fx-background-color:#1d1d1d; \n -fx-text-fill:white ;");
            HBox hbox = new HBox();
            hbox.setStyle("-fx-background-color:#1d1d1d");
            hbox.setSpacing(10);
            hbox.setPadding(new Insets(10,10,10,10));
            hbox.getChildren().addAll(logobtn,title);
            BorderPane root = new BorderPane();
            root.setTop(hbox);
            JFXTabPane pane = new JFXTabPane();
            pane.setSide(Side.RIGHT);
            Tab tab1 = new Tab();
            Tab tab2 = new Tab();
            Tab tab3 = new Tab();
            tab3.setText("Settings");
            tab2.setText("Tweaks");
            tab2.setContent(new Tweaks().getPane());
            tab1.setText("Statistics");
            tab1.setContent(new ChartControls().getPane());
            pane.getTabs().addAll(tab1,tab2,tab3);
            root.setCenter(pane);
            Scene scene = new Scene(root,910,550);
            scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
            primaryStage.setScene(scene);
            primaryStage.show();

        } catch(Exception e) {
            e.printStackTrace();
        }
    }
项目:DeskChan    文件:App.java   
/** Load all fonts from 'assets/fonts'. **/
private void loadFonts() {
    try (DirectoryStream<Path> directoryStream =
                 Files.newDirectoryStream(Main.getInstance().getPluginProxy().getAssetsDirPath().resolve("fonts"))) {
        for (Path fontPath : directoryStream) {
            if (fontPath.getFileName().toString().endsWith(".ttf")) {
                Font.loadFont(Files.newInputStream(fontPath), 10);
            }
        }
    } catch (IOException e) {
        Main.log(e);
    }
    Balloon.setDefaultFont(Main.getProperties().getString("balloon.font"));
    LocalFont.setDefaultFont(Main.getProperties().getString("interface.font"));
}
项目:Gleisbelegung    文件:Plugin_Gleisbelegung.java   
private void openLogWindow(){
    Stage stage = new Stage();

    //Label l = new Label("Während deiner aktuellen Sitzung sind Fehler aufgetreten. Durch einen Klick auf Weiter werden deine Log-Datei und deine Anregungen anonym hochgeladen.");
    Label l = new Label("Während deiner aktuellen Sitzung sind Fehler aufgetreten. Durch einen Klick auf Weiter wird deine Log-Datei anonym hochgeladen.");
    l.setStyle("-fx-text-fill: white");
    l.setFont(Font.font(settingsFontSize));
    l.setWrapText(true);
    l.setMaxWidth(450);
    l.setTranslateY(25);
    l.setTranslateX(25);

    /*TextField ta = new TextField();
    ta.setFont(Font.font(settingsFontSize-3));
    ta.setTranslateX(25);
    ta.setTranslateY(125);
    ta.setPrefWidth(450);
    ta.setPrefHeight(100);*/


    Button bno = new Button("Abbrechen");
    bno.setFont(Font.font(settingsFontSize));
    bno.setOnAction(e -> stage.close());
    bno.setTranslateX(250);
    bno.setTranslateY(150);

    Button byes = new Button("Weiter");
    byes.setFont(Font.font(settingsFontSize));
    byes.setTranslateX(150);
    byes.setTranslateY(150);
    byes.setOnAction(e -> {
        byes.setDisable(true);
        bno.setDisable(true);

        Runnable r = () -> {
            sendLogFile(l);
        };
        new Thread(r).start();
    });

    Pane p = new Pane(l, byes, bno);
    p.setStyle("-fx-background-color: #303030");
    p.setMinSize(500,200);
    p.setMaxSize(500, 200);

    Scene s = new Scene(p,500,200);


    stage.setScene(s);
    stage.setTitle("Log-Datei senden?");

    stage.setAlwaysOnTop(true);
    stage.show();
}
项目:Breadth-First-Search    文件:GraphDrawer.java   
/**
 * Ritorna il crea il componente grafico testo utilizzando la stringa passata come parametro
 * @param s testo da visualizzare
 * @return testo creato come componente grafico.
 */
private Text createText(String s) {
    Text t = new Text();

    t.setText(s);
    t.setFont(new Font(16));
    t.setBoundsType(TextBoundsType.VISUAL);
    t.setStroke(Color.BLACK);
    this.centerText(t);

    return t;
}
项目:CSS-Editor-FX    文件:CSSPaintPaser.java   
public Optional<Color> parseColor(String text) {
  return Optional.ofNullable(TaskUtil.firstSuccess(
      () -> Color.web(text, 1),
      () -> DeriveColorConverter.getInstance().convert(factory.apply(text), Font.getDefault()),
      () -> LadderConverter.getInstance().convert(factory.apply(text), Font.getDefault()),
      () -> context.lookup(text)
      ));
}
项目:email-newsletter-generator    文件:EmailTemplateMakerProgram.java   
private void _initializeGUI() {
    this.setCenter(this._root);
    this._root.setAlignment(Pos.CENTER);

    HBox outputSettingsPane = new HBox(5);
    outputSettingsPane.setAlignment(Pos.CENTER);
    this._root.getChildren().addAll(
            outputSettingsPane,
            this._generateButton
    );

    outputSettingsPane.getChildren().addAll(
            new Label("Output:"),
            this._outputTextField,
            this._browseButton,
            this._openFileButton
    );

    this._browseButton.setCursor(Cursor.HAND);
    Tooltip browseButtonTooltip = new Tooltip("Browse for Output Folder");
    this._browseButton.setTooltip(browseButtonTooltip);

    this._openFileButton.setCursor(Cursor.HAND);
    Tooltip openFileButtonTooltip = new Tooltip("Open Email Template");
    this._openFileButton.setTooltip(openFileButtonTooltip);

    this._generateButton.setCursor(Cursor.HAND);
    Tooltip generateButtonTooltip = new Tooltip("Generate Email Template");
    this._generateButton.setTooltip(generateButtonTooltip);
    this._generateButton.setFont(Font.font(16));
    this._generateButton.setMinWidth(256);
    this._generateButton.setStyle("-fx-background-radius: 50; -fx-padding: 10;");

    ((Stage) this._fileNotExistsAlert.getDialogPane().getScene().getWindow()).getIcons().add(new Image(this.getClass().getResourceAsStream(EmailTemplateMakerApp.ICON)));
}
项目:marathonv5    文件:InnerShadowSample.java   
public static Node createIconContent() {
    Text sample = new Text("FX");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80));
    sample.setStyle("-fx-font-size: 80px;");
    sample.setFill(Color.web("#aaaaaa"));
    final InnerShadow innerShadow = new InnerShadow();
    innerShadow.setRadius(4);
    innerShadow.setOffsetX(1);
    innerShadow.setOffsetY(1);
    innerShadow.setColor(Color.web("#333333"));
    sample.setEffect(innerShadow);
    return sample;
}
项目:marathonv5    文件:DropShadowSample.java   
public DropShadowSample() {
    Text sample = new Text(0,40,"DropShadow Effect");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,36));
    final DropShadow dropShadow = new DropShadow();
    sample.setEffect(dropShadow);
    getChildren().add(sample);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Radius", dropShadow.radiusProperty(), 0d, 20d),
            new SimplePropertySheet.PropDesc("Offset X", dropShadow.offsetXProperty(), -10d, 10d),
            new SimplePropertySheet.PropDesc("Offset Y", dropShadow.offsetYProperty(), -10d, 10d),
            new SimplePropertySheet.PropDesc("Spread", dropShadow.spreadProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Color", dropShadow.colorProperty())
    );
    // END REMOVE ME
}
项目:MasterHash    文件:Welcome.java   
private static Label setupMasterHashTitle() {
    Label masterHashTitle = new Label("Master Hash");

    masterHashTitle.setPadding(new Insets(10));
    masterHashTitle.setFont(Font.font(null, FontWeight.BOLD, 60));

    return masterHashTitle;
}
项目:cyoastudio    文件:FontAdapter.java   
@Override
public Font read(JsonReader reader) throws IOException {
    if (reader.peek() == JsonToken.NULL) {
        reader.nextNull();
        return null;
    }

    return getFont(reader.nextString());
}
项目:marathonv5    文件:ImagePanel.java   
private void drawGraphics() {
    graphics.clearRect(0, 0, canvas.getWidth(), canvas.getHeight());
    graphics.drawImage(image, 0, 0);
    if (annotations.size() > 0) {
        for (int i = 0; i < annotations.size(); i++) {
            Annotation annotationFX = annotations.get(i);
            double x = annotationFX.getX();
            double y = annotationFX.getY();
            graphics.setFill(ANNOTATION_COLOR);
            graphics.fillRect(x, y, annotationFX.getWidth(), annotationFX.getHeight());
            graphics.setFill(Color.RED);
            graphics.fillArc(x - 25, y - 25, 50, 50, 270, 90, ArcType.ROUND);
            graphics.setFill(Color.WHITE);
            graphics.setFont(Font.font(null, FontWeight.EXTRA_BOLD, 14));
            if (i > 8) {
                graphics.fillText(Integer.toString(i + 1), x + 5, y + 15);
            } else {
                graphics.fillText(Integer.toString(i + 1), x + 5, y + 15);
            }
        }
    }
}
项目:marathonv5    文件:StatusBar.java   
public StatusBar() {
    setId("status-bar");
    msgLabel = createLabel("");
    extraLabel = createLabel("               ");
    extraLabel.setFont(Font.font("System", FontPosture.ITALIC, 12.0));
    fixtureLabel = createLabel("       ");
    fixtureLabel.setFont(Font.font("System", FontWeight.BOLD, 12.0));
    rowLabel = createLabel("       ");
    columnLabel = createLabel("       ");
    insertLabel = createLabel("               ");
    Region region = new Region();
    getChildren().addAll(msgLabel, region, createSeparator(), extraLabel, createSeparator(), fixtureLabel, createSeparator(),
            rowLabel, createSeparator(), columnLabel, createSeparator(), insertLabel, createSeparator());
    HBox.setHgrow(region, Priority.ALWAYS);
    getStylesheets().add(ModalDialog.class.getClassLoader().getResource("net/sourceforge/marathon/fx/api/css/marathon.css")
            .toExternalForm());
}
项目:voogasalad-ltub    文件:UserSocialPage.java   
private void configProfile() {
    profileView = new BorderPane();
    VBox profileInfo = new VBox(10);
    ImageView img = new ImageView(myUser.getImage());

    Text name = new Text(myUser.getName());
    name.setFont(new Font(18));
    TextFlow textWrapper = new TextFlow(name);
    textWrapper.setTextAlignment(TextAlignment.CENTER);

    profileInfo.getChildren().addAll(img, textWrapper);
    profileInfo.setAlignment(Pos.CENTER);
    profileView.setCenter(profileInfo);
}
项目:projectintern    文件:Elevator.java   
public void draw() {
    // Draw elevator
    Rectangle rgB = new Rectangle(WIDTH, HEIGHT);
    rgB.setFill(Color.TRANSPARENT);
    this.getChildren().add(rgB);

    rgT = new Rectangle((WIDTH / 3) * 2 + (WIDTH / (WIDTH / 8)), HEIGHT / 1.5 + (HEIGHT / (HEIGHT / 4)));
    rgT.setFill(Color.web("bfbfbf"));
    rgT.setX(WIDTH / 2 - rgT.getWidth() / 2);
    rgT.setY(HEIGHT - rgT.getHeight());
    this.getChildren().add(rgT);

    //Left side elevator shaft door
    rgD1 = new Rectangle(WIDTH / 3, HEIGHT / 1.5);
    rgD1.setFill(Color.web("a5a5a5"));
    rgD1.setX(WIDTH / 2 - rgD1.getWidth());
    rgD1.setY(HEIGHT - rgD1.getHeight());
    this.getChildren().add(rgD1);

    //Right side elevator shaft door
    rgD2 = new Rectangle(WIDTH / 3, HEIGHT / 1.5);
    rgD2.setFill(Color.web("a5a5a5"));
    rgD2.setX(WIDTH / 2);
    rgD2.setY(HEIGHT - rgD2.getHeight());
    this.getChildren().add(rgD2);

    // Draw text
    tFloorNum = new Text(String.valueOf(FLOORNUM));
    tFloorNum.setFill(Color.web("bfbfbf"));
    tFloorNum.setFont(Font.font("Verdana", 20));
    tFloorNum.setX(WIDTH / 2 - tFloorNum.getBoundsInParent().getWidth() / 2);
    tFloorNum.setY(rgT.getY() - tFloorNum.getBoundsInParent().getHeight() / 2);
    this.getChildren().add(tFloorNum);
}
项目:campingsimulator2017    文件:SupplierManagerView.java   
/**
 * @param s
 * @param i
 * add an Element in the scroll
 */
private void createElement(Supplier s, int i){
    HBox suppliersBox = new HBox();

    suppliersBox.setOnMouseClicked(event -> {
        for (int j=0; j<suppliers.getChildren().size(); j++) {
            if(j % 2 == 1)
                suppliers.getChildren().get(j).setStyle("-fx-background-color: #336699;");
            else
                suppliers.getChildren().get(j).setStyle("-fx-background-color: #0F355C;");
        }

        lastClickedValue = s;
        updateDetail(s);
        suppliersBox.setStyle("-fx-background-color: #ff6600;");
    });
    suppliersBox.setMinWidth(HomeView.TAB_CONTENT_W / 4);
    suppliersBox.setPadding(new Insets(20));

    Text supplierText = new Text(s.getName());
    supplierText.setFont(new Font(20));
    supplierText.setFill(Color.WHITE);
    suppliersBox.getChildren().add(supplierText);

    if (i % 2 == 1)
        suppliersBox.setStyle("-fx-background-color: #336699;");
    else
        suppliersBox.setStyle("-fx-background-color: #0F355C;");

    suppliers.getChildren().add(suppliersBox);
}
项目:MasterHash    文件:NewLogin.java   
public static void display() {
    window = new Stage();
    window.initModality(Modality.APPLICATION_MODAL);
    window.setTitle("Log In");
    HEADING = "New Login";

    Label headingLabel = new Label(HEADING);
    headingLabel.setFont(Font.font("Verdana", FontWeight.BOLD, 30));

    TextField nameTextField = new TextField();
    nameTextField.setPromptText("Name");

    TextField userNameTextField = new TextField();
    userNameTextField.setPromptText("Username");

    PasswordField passwordField = new PasswordField();
    passwordField.setPromptText("Password");
    Button generateButton = new Button("Generate");

    HBox generatePasswordArea = new HBox();
    generatePasswordArea.getChildren().addAll(passwordField, generateButton);

    Button submitButton = new Button("Submit");

    VBox layout = new VBox(10);
    layout.setPadding(new Insets(0, 20, 0, 20));
    layout.setAlignment(Pos.CENTER_LEFT);
    layout.getChildren().addAll(headingLabel, nameTextField, userNameTextField, generatePasswordArea, submitButton);

    Scene scene = new Scene(layout, 300, 400);
    window.setScene(scene);
    window.showAndWait();
}
项目:FlappySpaceShip    文件:ViewController.java   
/** Play scale effect to the {@link ViewController#optionsLabel} or opening the options menu. */
public void optionsMenu() {
    if (!backLabel.isVisible())
        optionsLabel.setVisible(true);

    optionsLabel.setOnMouseEntered(MouseEvent -> {
        optionsLabel.setScaleX(1.5);
        optionsLabel.setScaleY(1.5);
    });

    optionsLabel.setOnMouseExited(MouseEvent -> {
        optionsLabel.setScaleX(1);
        optionsLabel.setScaleY(1);
    });

    optionsLabel.setOnMouseClicked(MouseEvent -> {
        logger.info("Options menu.");
        isOptions = true;
        optionsLabel.setFont(Font.font("Press Start 2P", 40));
        optionsLabel.setTranslateX(270);
        optionsLabel.setTranslateY(300);

        backLabel.setVisible(true);
        failLabel.setVisible(false);
        newGameLabel.setVisible(false);
        highScoreLabel.setVisible(false);
        leadBoardLabel.setVisible(false);
        exitLabel.setVisible(false);
        soundText.setVisible(true);
        onButton.setVisible(true);
        doneLabel.setVisible(false);
        playerName.setVisible(false);
        playerNameLabel.setVisible(false);
        resumeLabel.setVisible(false);
        tableView.setVisible(false);
        backMenu();
    });
}
项目:marathonv5    文件:DropShadowSample.java   
public DropShadowSample() {
    Text sample = new Text(0,40,"DropShadow Effect");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,36));
    final DropShadow dropShadow = new DropShadow();
    sample.setEffect(dropShadow);
    getChildren().add(sample);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Radius", dropShadow.radiusProperty(), 0d, 20d),
            new SimplePropertySheet.PropDesc("Offset X", dropShadow.offsetXProperty(), -10d, 10d),
            new SimplePropertySheet.PropDesc("Offset Y", dropShadow.offsetYProperty(), -10d, 10d),
            new SimplePropertySheet.PropDesc("Spread", dropShadow.spreadProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Color", dropShadow.colorProperty())
    );
    // END REMOVE ME
}
项目:marathonv5    文件:DropShadowSample.java   
public static Node createIconContent() {
    Text sample = new Text("FX");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80));
    sample.setStyle("-fx-font-size: 80px;");
    sample.setFill(Color.web("#333333"));
    final DropShadow dropShadow = new DropShadow();
    dropShadow.setOffsetX(4);
    dropShadow.setOffsetY(6);
    dropShadow.setColor(Color.rgb(0,0,0,0.7));
    sample.setEffect(dropShadow);
    return sample;
}
项目:marathonv5    文件:StageSample.java   
public StageSample() {
    //create a button for initializing our new stage
    Button button = new Button("Create a Stage");
    button.setStyle("-fx-font-size: 24;");
    button.setDefaultButton(true);
    button.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent t) {
            final Stage stage = new Stage();
            //create root node of scene, i.e. group
            Group rootGroup = new Group();
            //create scene with set width, height and color
            Scene scene = new Scene(rootGroup, 200, 200, Color.WHITESMOKE);
            //set scene to stage
            stage.setScene(scene);
            //center stage on screen
            stage.centerOnScreen();
            //show the stage
            stage.show();
            //add some node to scene
            Text text = new Text(20, 110, "JavaFX");
            text.setFill(Color.DODGERBLUE);
            text.setEffect(new Lighting());
            text.setFont(Font.font(Font.getDefault().getFamily(), 50));
            //add text to the main root group
            rootGroup.getChildren().add(text);
        }
    });
    getChildren().add(button);
}