Package javafx.scene.text

Examples of javafx.scene.text.Text


        bar.getStyleClass().setAll("bar");

        foreground = new Region();
        foreground.getStyleClass().setAll("foreground");

        titleText = new Text(getSkinnable().getTitle());
        titleText.getStyleClass().setAll("title");

        unitText = new Text(getSkinnable().getUnit());
        unitText.getStyleClass().setAll("unit");

        lcdText = new Label(getSkinnable().getNumberFormat().format(getSkinnable().getValue()));
        lcdText.getStyleClass().setAll("lcd-text");
View Full Code Here


        dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
        dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
        dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
        dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);

        title = new Text(getSkinnable().getTitle());
        title.setMouseTransparent(true);
        title.setTextOrigin(VPos.CENTER);
        title.getStyleClass().setAll("title");
        title.setEffect(getSkinnable().isPlainValue() ? null : blend);

        unit = new Text(getSkinnable().getUnit());
        unit.setMouseTransparent(true);
        unit.setTextOrigin(VPos.CENTER);
        unit.getStyleClass().setAll("unit");
        unit.setEffect(getSkinnable().isPlainValue() ? null : blend);

        value = new Text();
        value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", 0.0));
        value.setMouseTransparent(true);
        value.setTextOrigin(VPos.CENTER);
        value.getStyleClass().setAll("value");
        value.setEffect(getSkinnable().isPlainValue() ? null : blend);
View Full Code Here

        needle.setFillRule(FillRule.EVEN_ODD);       
        needle.getStyleClass().setAll("needle");       
        needle.getTransforms().setAll(needleRotate);
        needle.setStyle("-needle-color: " + Util.colorToCss((Color) getSkinnable().getNeedleColor()));

        value = new Text(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getMinValue()) + getSkinnable().getUnit());
        value.setMouseTransparent(true);
        value.setTextOrigin(VPos.CENTER);
        value.getStyleClass().setAll("value");       

        title = new Text(getSkinnable().getTitle());
        title.setTextOrigin(VPos.CENTER);
        title.getStyleClass().setAll("title");       

        // Add all nodes
        pane = new Pane();
View Full Code Here

//            }
//        });

        // populate with text nodes
        for(StyledText<S> segment: par.getSegments()) {
            Text t = new Text(segment.toString());
            t.setTextOrigin(VPos.TOP);
            t.getStyleClass().add("text");
            applyStyle.accept(t, segment.getStyle());

            // XXX: binding selectionFill to textFill,
            // see the note at highlightTextFill
            t.impl_selectionFillProperty().bind(t.fillProperty());

            getChildren().add(t);
        }
    }
View Full Code Here

        leftPanes.setOrientation(Orientation.VERTICAL);
        leftPanes.setStyle("-fx-background-color:#000000");


        //Set up the GO button
        Text goButton = new Text("Go");
        goButton.setFill(Color.GREEN);
        BorderPane goPane = new BorderPane(goButton);
        goButton.setOnMouseClicked(event -> playSelectedTrack());
        leftPanes.getItems().add(goPane);


        //Set up the STOP button
        Text stopButton = new Text("Stop");
        stopButton.setFill(Color.RED);
        BorderPane stopPane = new BorderPane(stopButton);
        stopButton.setOnMouseClicked(event -> stopSelectedTrack());
        leftPanes.getItems().add(stopPane);

        //Set up the FADE button
        Text fadeButton = new Text("Fade");
        fadeButton.setFill(Color.YELLOW);
        BorderPane fadePane = new BorderPane(fadeButton);
        fadeButton.setOnMouseClicked(event -> fadeSelectedTrack());
        leftPanes.getItems().add(fadePane);

        //Set up the clock
        Text clock = new Text("00:00:00");
        clock.setFill(Color.WHITE);
        BorderPane clockPane = new BorderPane(clock);
        leftPanes.getItems().add(clockPane);
        //Make the clock tick:
        new AnimationTimer() {
            @Override
            public void handle(long now) {
                clock.setText(new SimpleDateFormat("HH:mm:ss").format(new Date()));
            }
        }.start();

        //Evaluating text width is easy - we just ask the Text object for its width boundary.
        // Similarly, the text height is done with the Text height boundary.
        // The maximum width is easily done, too, actually. Just get the width of the pane!
        // However, to calculate the height is a bit trickier...
        //  Typically, we'll need to find the position of the dividers ABOVE and BELOW the pane and subtract them.
        //  To get these positions, we can ask the dividers for their position - but that's actually a percentage of
        //  the entire SplitPane height, so we need to multiply the resulting subtraction by the SplitPane's height.
        //First, let's do the vertical movement of the first divider, which affects panes 0 (Go) and 1 (Stop)
        leftPanes.getDividers().get(0).positionProperty().addListener((observable, oldValue, newValue) -> {
            //Note: Special case, as "ABOVE" is 0 (top of panes)
            double scale = resizeText(goButton.getBoundsInLocal().getWidth(), goButton.getBoundsInLocal().getHeight(), goPane.getWidth(), leftPanes.getHeight() * newValue.doubleValue());
            goButton.setScaleX(scale);
            goButton.setScaleY(scale);

            scale = resizeText(stopButton.getBoundsInLocal().getWidth(), stopButton.getBoundsInLocal().getHeight(), stopPane.getWidth(), leftPanes.getHeight() * (leftPanes.getDividers().get(1).getPosition() - newValue.doubleValue()));
            stopButton.setScaleX(scale);
            stopButton.setScaleY(scale);
        });
        //Then do the vertical movement of the second divider, which affects 1 (Stop) and 2 (Fade)
        leftPanes.getDividers().get(1).positionProperty().addListener((observable, oldValue, newValue) -> {
            double scale = resizeText(stopButton.getBoundsInLocal().getWidth(), stopButton.getBoundsInLocal().getHeight(), stopPane.getWidth(), leftPanes.getHeight() * (newValue.doubleValue() - leftPanes.getDividers().get(0).getPosition()));
            stopButton.setScaleX(scale);
            stopButton.setScaleY(scale);

            scale = resizeText(fadeButton.getBoundsInLocal().getWidth(), fadeButton.getBoundsInLocal().getHeight(), fadePane.getWidth(), leftPanes.getHeight() * (leftPanes.getDividers().get(2).getPosition() - newValue.doubleValue()));
            fadeButton.setScaleX(scale);
            fadeButton.setScaleY(scale);
        });
        //Next, the third divider, affecting 2 (Fade) and 3 (Clock)
        leftPanes.getDividers().get(2).positionProperty().addListener((observable, oldValue, newValue) -> {
            double scale = resizeText(fadeButton.getBoundsInLocal().getWidth(), fadeButton.getBoundsInLocal().getHeight(), fadePane.getWidth(), leftPanes.getHeight() * (newValue.doubleValue() - leftPanes.getDividers().get(1).getPosition()));
            fadeButton.setScaleX(scale);
            fadeButton.setScaleY(scale);

            //Note: Special case, as BELOW is leftPanes.getHeight (bottom of panes)
            scale = resizeText(clock.getBoundsInLocal().getWidth(), clock.getBoundsInLocal().getHeight(), clockPane.getWidth(), leftPanes.getHeight() - (leftPanes.getHeight() * newValue.doubleValue()));
            clock.setScaleX(scale);
            clock.setScaleY(scale);
        });

        //Lastly do the horizontal width of the first pane. In fact, if this pane's width changes, all the panes do.
        goPane.widthProperty().addListener((observable, oldValue, newValue) -> {
            double scale = resizeText(goButton.getBoundsInLocal().getWidth(), goButton.getBoundsInLocal().getHeight(), newValue.doubleValue(), leftPanes.getHeight() * leftPanes.getDividers().get(0).getPosition());
            goButton.setScaleX(scale);
            goButton.setScaleY(scale);
        });
        stopPane.widthProperty().addListener((observable, oldValue, newValue) -> {
            double scale = resizeText(stopButton.getBoundsInLocal().getWidth(), stopButton.getBoundsInLocal().getHeight(), newValue.doubleValue(), leftPanes.getHeight() * (leftPanes.getDividers().get(1).getPosition() - leftPanes.getDividers().get(0).getPosition()));
            stopButton.setScaleX(scale);
            stopButton.setScaleY(scale);
        });

        fadePane.widthProperty().addListener((observable, oldValue, newValue) -> {
            double scale = resizeText(fadeButton.getBoundsInLocal().getWidth(), fadeButton.getBoundsInLocal().getHeight(), newValue.doubleValue(), leftPanes.getHeight() * (leftPanes.getDividers().get(2).getPosition() - leftPanes.getDividers().get(1).getPosition()));
            fadeButton.setScaleX(scale);
            fadeButton.setScaleY(scale);
        });

        clockPane.widthProperty().addListener((observable, oldValue, newValue) -> {
            double scale = resizeText(clock.getBoundsInLocal().getWidth(), clock.getBoundsInLocal().getHeight(), newValue.doubleValue(), leftPanes.getHeight() - (leftPanes.getHeight() * leftPanes.getDividers().get(2).getPosition()));
            clock.setScaleX(scale);
            clock.setScaleY(scale);
        });

        return leftPanes;
    }
View Full Code Here

        HTMLEditor clipNotes = new HTMLEditor();
        rightPanes.getItems().add(clipNotes);

        //Set up the E-STOP button
        Text stopButton = new Text("E-STOP");
        stopButton.setFill(Color.RED);
        BorderPane stopPane = new BorderPane(stopButton);
        stopButton.setOnMouseClicked(event -> stopAllTracks());
        rightPanes.getItems().add(stopPane);

        stopPane.widthProperty().addListener((observable, oldValue, newValue) -> {
            double scale = resizeText(stopButton.getBoundsInLocal().getWidth(), stopButton.getBoundsInLocal().getHeight(), newValue.doubleValue(), rightPanes.getHeight() - (rightPanes.getHeight() * rightPanes.getDividers().get(0).getPosition()));
            stopButton.setScaleX(scale);
            stopButton.setScaleY(scale);
        });
        rightPanes.getDividers().get(0).positionProperty().addListener((observable, oldValue, newValue) -> {
            double scale = resizeText(stopButton.getBoundsInLocal().getWidth(), stopButton.getBoundsInLocal().getHeight(), stopPane.getWidth(), rightPanes.getHeight() - (rightPanes.getHeight() * rightPanes.getDividers().get(0).getPosition()));
            stopButton.setScaleX(scale);
            stopButton.setScaleY(scale);
        });

        rightPanes.setDividerPositions(0.9f);

        return rightPanes;
View Full Code Here

        valueColumn.setCellFactory((p) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, String>() {
            @Override
            public void updateItem(String item, boolean empty) {
                super.updateItem(item, empty);
                if (!isEmpty()) {
                    Text text = new Text(item);
                    text.wrappingWidthProperty().bind(getTableColumn().widthProperty());
                    setGraphic(text);
                } else {
                    setGraphic(null);
                }
            }
View Full Code Here

    public static Node create(VideoFile<?> file) {
        try {
            return new MediaControl(new MediaPlayer(file.getMedia()), file);
        } catch (IOException ex) {
            Logger.getLogger(VideoFile.class.getName()).log(Level.WARNING, "failed to initialize MediaControl for file " + file.getName(), ex);
            return new Text(ex.getLocalizedMessage() + "\nSee the logs for details.");
        } catch (MediaException ex) {
            Logger.getLogger(VideoFile.class.getName()).log(Level.WARNING, ex.getType() + " Failed to initialize MediaControl for file " + file.getName(), ex);
            return new Text(ex.getType() + "\nSee the logs for details.");
        } catch (OutOfMemoryError ex) {
            Logger.getLogger(VideoFile.class.getName()).log(Level.WARNING, "failed to initialize MediaControl for file " + file.getName(), ex);
            return new Text("There was a problem playing video file.\nSee the logs for details.");
        }
    }
View Full Code Here

        mp.errorProperty().addListener((Observable observable) -> {
            final MediaException ex = mp.getError();
            if (ex != null) {
                Platform.runLater(() -> {
                    Logger.getLogger(VideoFile.class.getName()).log(Level.WARNING, ex.getType() + " Failed to initialize MediaControl for file " + file.getName(), ex);
                    setCenter(new Text(ex.getType() + "\nSee the logs for details."));
                    setBottom(null);
                });
            }
        });
        mp.statusProperty().addListener((observableStatus, oldStatus, newStatus) -> {
View Full Code Here

     * @param labelX     the horizontal position in the partPane of the text
     * @param bold       true if the text should be bold, false otherwise
     */
    private synchronized void assignLeafLabel(String labelText, double labelWidth, double labelX, boolean bold) {

        Text label = new Text(" " + labelText + " ");
        label.setTextAlignment(TextAlignment.CENTER);
        label.setFont(Font.font(null, bold ? FontWeight.BOLD : FontWeight.NORMAL, 10));
        //position label accounting for width
        label.relocate(labelX + labelWidth / 2 - label.getBoundsInLocal().getWidth() / 2, 0);
        label.autosize();

        if (leafPane.getChildren().isEmpty()) {
            //just add first label
            leafPane.getChildren().add(label);
        } else {
            //otherwise don't actually add the label if it would intersect with previous label
            final Text lastLabel = (Text) leafPane.getChildren().get(leafPane.getChildren().size() - 1);

            if (!lastLabel.getBoundsInParent().intersects(label.getBoundsInParent())) {
                leafPane.getChildren().add(label);
            }
        }
    }
View Full Code Here

TOP

Related Classes of javafx.scene.text.Text

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.