Package javafx.scene.text

Examples of javafx.scene.text.Text


      rects[i].setArcHeight(screenHeight);
      hbox.getChildren().add(rects[i]);

    }

    final Text durationLabel = new Text(25, 25, MediaUtils.activeInfo);
    durationLabel.setFill(Color.WHITESMOKE);
    durationLabel.setFont(Font.font(java.awt.Font.SANS_SERIF, 25));
    final DropShadow ds = new DropShadow();
    ds.setOffsetY(3.0f);
    ds.setColor(Color.BLACK);

    durationLabel.setEffect(ds);

    vbox.getChildren().add(hbox);
    root.getChildren().add(UISession.getMediaView());
    root.getChildren().add(vbox);

    root.getChildren().add(durationLabel);
    durationLabel.setTranslateX(-25);
    vbox.setMaxWidth(screenWidth);

    hbox.setTranslateY(translatLocation);
    final Scene scene = new Scene(root, screenWidth, screenHeight,
        Color.rgb(35, 35, 35));
View Full Code Here


   */
  protected Node createTickValueDisplay(final double height,
      final ObjectProperty<Paint> backgroundFillProperty,
      final ObjectProperty<Paint> textFillProperty) {
    final StackPane valContainer = new StackPane();
    final Text val = new Text(getTickValueLabel(false));
    val.setFont(tickValueFont);
    final DropShadow outerGlow = new DropShadow();
    outerGlow.setOffsetX(0);
    outerGlow.setOffsetY(0);
    outerGlow.setColor(Color.BLUE);
    outerGlow.setRadius(2d);
    val.setEffect(outerGlow);
    Bindings.bindBidirectional(val.fillProperty(), textFillProperty);
    //val.setStyle("-fx-text-fill: white;");
    angleProperty.addListener(new ChangeListener<Number>() {
      @Override
      public void changed(ObservableValue<? extends Number> observable,
          Number oldValue, Number newValue) {
        val.setText(getTickValueLabel(false));//newValue.doubleValue()));
      }
    });
    final double rimThickness = outerRadius - innerRadius;
    Shape border;
    if (isCircular()) {
      final Rectangle rec = new Rectangle(outerRadius, height);
      rec.setArcHeight(5d);
      rec.setArcWidth(5d);
      rec.setTranslateY(5d);
      border = rec;
      val.setTranslateY(rec.getHeight() / 2d);
      valContainer.setTranslateX(centerX - rec.getWidth() / 2d);
      valContainer.setTranslateY(centerY + rec.getHeight());
    } else {
      // create the background border for the tick mark value
      final double width = outerRadius - rimThickness;
      final double offsetY = centerY + rimThickness;
      // TODO : replace square root with proper angle offset
      final double offsetX = centerX + dialCenterBackgroundRadius - Math.sqrt(offsetY);
      // rotate value text so that it is never upside down
      final double angle = -getGeometericStartAngle();
      if (Math.abs(angle) > 90d && Math.abs(angle) < 270d) {
        val.setRotate(180d);
      }
      final Circle dialCutout = new Circle(centerX, centerY, innerRadius);
      final Circle gaugeCutout = new Circle(centerX, centerY, dialCenterBackgroundRadius
          + rimThickness);
      // create the border rectangle
      final Polygon rec = new Polygon(centerX, offsetY, centerX + width, offsetY,
          centerX + width, offsetY + height, centerX, offsetY + height);
      // carve out outer rim rectangle edge
      final Shape recArc = Shape.intersect(rec, dialCutout);
      // carve out inner dial rectangle edge
      border = Shape.subtract(recArc, gaugeCutout);

      border.setTranslateX(offsetX);
      border.setTranslateY(offsetY);
      val.setTranslateX(offsetX);
      val.setTranslateY(offsetY);
      valContainer.getTransforms().add(new Rotate(angle, centerX, centerY));
    }
    Bindings.bindBidirectional(border.fillProperty(), backgroundFillProperty);
    border.setStroke(Color.GRAY);
    border.setStrokeWidth(1d);
View Full Code Here

    lbl.setY(lbl.getY() + heightOffset);
    lbl.getTransforms().addAll(new Rotate(labelAngle, centerX, centerY),
        new Rotate(90d, lbl.getBoundsInParent().getMinX() + lbl.getBoundsInParent().getWidth() / 2d,
            0));
    */   
    final Text lbl = new Text(x, y, label);
    lbl.setFont(tickValueFont);
    Bindings.bindBidirectional(lbl.fillProperty(), tickMarkLabelFillProperty);
    // center text horizontally
    lbl.setLayoutX((lbl.getBoundsInLocal().getWidth() / 2d) * -1);
    // center text vertically
    lbl.setTextOrigin(VPos.CENTER);
    return lbl;
  }
View Full Code Here

            final ImageView imgView = new ImageView(image);
            frame.getStyleClass().add("displayshelfpopup");
            VBox.setMargin(imgView, new Insets(10, 10, 0, 10));
            final VBox info = new VBox();
            VBox.setMargin(info, new Insets(0, 10, 0, 10));
            final Text infoText = new Text(label.getText());
            infoText.setWrappingWidth(imgView.getImage().getWidth());
            info.setPrefHeight(imgView.getImage().getHeight() / 7);
            info.getChildren().add(infoText);
            frame.getChildren().addAll(imgView, info);
            final Popup popup = new Popup();
            popup.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
View Full Code Here

      final Rectangle2D bounds = screen.getVisualBounds();
      dummyPopup.initModality(Modality.NONE);
      dummyPopup.initStyle(StageStyle.UTILITY);
      dummyPopup.setOpacity(0d);
      final Group root = new Group();
      root.getChildren().add(new Text("Close"));
      dummyPopup.setScene(new Scene(root, NOTIFY_WINDOW_WIDTH,
          NOTIFY_WINDOW_HEIGHT, Color.TRANSPARENT));
      dummyPopup.setX(bounds.getMaxX());
      dummyPopup.setY(bounds.getMaxY());
      dummyPopup.show();
View Full Code Here

    toolBar.getItems().add(pBox);
    VBox personBox = new VBox(10);
    personBox.setPadding(new Insets(10, 10, 10, 50));
    VBox beanPane = new VBox(10);
    beanPane.setPadding(new Insets(10, 10, 10, 10));
    final Text title = new Text(
        "Person POJO using auto-generated JavaFX properties. "
            + "Duplicate field controls exist to demo multiple control binding");
    title.setWrappingWidth(400d);
    HBox hobbyBox = beanTF("allHobbies", "hobbies", "name", Hobby.class, 0,
        ListView.class, null, HOBBY_OVERWRITE);
    HBox langBox = beanTF("allLanguages", "languages", null, String.class,
        0, ListView.class, null, shouldNeverAppear);
    final HBox stBox = beanTF("address.location.state", null, null, null,
        2, ComboBox.class, "[a-zA-z]", STATES);
    personBox.getChildren().addAll(
        beanTF("name", null, null, null, 50, null, "[a-zA-z0-9\\s]*"),
        beanTF("age", null, null, null, 100, Slider.class, null),
        beanTF("age", null, null, null, 100, null, "[0-9]"),
        beanTF("password", null, null, null, 100, PasswordField.class,
            "[a-zA-z0-9]"),
        beanTF("address.street", null, null, null, 50, null,
            "[a-zA-z0-9\\s]*"),
        stBox,
        beanTF("address.location.country", null, null, null, 10, null,
            "[0-9]"),
        beanTF("address.location.country", null, null, null, 2,
            ComboBox.class, "[0-9]", new Integer[] { 0, 1, 2, 3 }),
        beanTF("address.location.international", null, null, null, 0,
            CheckBox.class, null), langBox, hobbyBox);
    beanPane.getChildren().addAll(title, personBox);
    personBox.getChildren().add(createRoleField("role"));
    // JFXtras SimpleCalendar test
    SimpleCalendar sc = new SimpleCalendar();
    personPA.bindBidirectional("dob", sc.dateProperty(), Date.class);
    personBox.getChildren().add(sc);
    // CalendarPicker lCalendarPicker = new CalendarPicker();
    // personPA.bindBidirectional("dob", lCalendarPicker.calendarProperty(),
    // Calendar.class);
    // lCalendarPicker.calendarProperty().addListener(new
    // ChangeListener<Calendar>() {
    // @Override
    // public void changed(ObservableValue<? extends Calendar> observable,
    // Calendar oldValue, Calendar newValue) {
    // dumpPojo(personPA);
    // }
    // });
    // personBox.getChildren().add(lCalendarPicker);

    final TextField pojoNameTF = new TextField();
    Button pojoNameBtn = new Button("Set Person's Name");
    pojoNameBtn.setOnMouseClicked(new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent event) {
        personPA.getBean().setName(pojoNameTF.getText());
        dumpPojo(null, null, personPA);
      }
    });
    VBox pojoBox = new VBox(10);
    pojoBox.setPadding(new Insets(10, 10, 10, 10));
    Text lbl = new Text("Set selected person's field data via POJO "
        + "with unbound controls (not working because without "
        + "dependency injection instrumentation, java agent, or "
        + "byte-code manipulation this is not currently possible- "
        + "maybe a JavaFX life-cycle listener would work?):");
    lbl.setWrappingWidth(300d);
    pojoBox.getChildren().addAll(lbl, new Label("Name:"), pojoNameTF,
        pojoNameBtn, new Separator(),
        updateListView(langBox, "Language"),
        updateListView(hobbyBox, "Hobby"), new Separator(),
        new Label("POJO Dump:"), pojoTA);
View Full Code Here

    public Status(StringProperty messageContent) {
        this.messageContent = messageContent;
    }
   
    public Node view(){
        Text label = new Text();
        label.textProperty().bind(this.messageContent);
        return label;
    }
View Full Code Here

    Pane pane = new Pane();
    final Rectangle workflowRectangle = new Rectangle(WIDTH+20, EventAnimationBase.EVENT_HEIGHT+15);
    workflowRectangle.setFill(WORKFLOW_COLOR);
    workflowRectangle.setArcHeight(25);
    workflowRectangle.setArcWidth(25);
    final Text classText = new Text(workflowClass);
    classText.setFontSmoothingType(FontSmoothingType.LCD);
    classText.xProperty().bind(workflowRectangle.xProperty().add(workflowRectangle.getWidth()/2).subtract(classText.getBoundsInLocal().getWidth()/2));
    classText.yProperty().bind(workflowRectangle.yProperty().subtract(16));
    final Text instanceIdText = new Text(id);
    instanceIdText.setFont(Font.font(Font.getDefault().getName(),10));
    instanceIdText.setFontSmoothingType(FontSmoothingType.LCD);
    instanceIdText.xProperty().bind(workflowRectangle.xProperty().add(workflowRectangle.getWidth()/2).subtract(classText.getBoundsInLocal().getWidth()/2));
    instanceIdText.yProperty().bind(workflowRectangle.yProperty().subtract(3));
    pane.getChildren().add(workflowRectangle);
    pane.getChildren().add(classText);
    pane.getChildren().add(instanceIdText);
    return pane;
  }
View Full Code Here

    Pane pane = new Pane();
    final Rectangle rectangle = new Rectangle(EVENT_WIDTH,EVENT_HEIGHT);
    rectangle.setFill(color);
    rectangle.setArcHeight(20);
    rectangle.setArcWidth(20);
    final Text text = new Text(getDisplayText());
    text.setFontSmoothingType(FontSmoothingType.LCD);
    text.translateXProperty().bind(rectangle.translateXProperty());
    text.translateYProperty().bind(rectangle.translateYProperty().add(rectangle.getHeight()/2).add(text.getBoundsInLocal().getHeight()/4));
    pane.getChildren().add(rectangle);
    pane.getChildren().add(text);
    return pane;
  }
View Full Code Here

  }
   
    private void addStaticContent() {
      createLegend();
  
    final Text inputText = new Text("Input");
    inputText.setX(getAnimationPaneWidth()/2- getAnimationPaneWidth()/4-inputText.getBoundsInLocal().getWidth()/2);
    inputText.setY(20);
    inputText.setFont(Font.font(Font.getDefault().getName(), FontWeight.BOLD, Font.getDefault().getSize()));
    inputText.setFontSmoothingType(FontSmoothingType.LCD);
    animationPane.getChildren().add(inputText);
   
    final Text outputText = new Text("Output");
    outputText.setX(getAnimationPaneWidth()/2+ getAnimationPaneWidth()/4-outputText.getBoundsInLocal().getWidth()/2);
    outputText.setY(20);
    outputText.setFont(Font.font(Font.getDefault().getName(), FontWeight.BOLD, Font.getDefault().getSize()));
    outputText.setFontSmoothingType(FontSmoothingType.LCD);
    animationPane.getChildren().add(outputText);
   
    final Text adapterText = new Text("Adapter");
    adapterText.setX(getAnimationPaneWidth()/2-adapterText.getBoundsInLocal().getWidth()/2);
    adapterText.setTranslateY(20);
    adapterText.setFont(Font.font(Font.getDefault().getName(), FontWeight.BOLD, Font.getDefault().getSize()));
    adapterText.setFontSmoothingType(FontSmoothingType.LCD);
    animationPane.getChildren().add(adapterText);
   
    Line lineInput = new Line();
    lineInput.getStrokeDashArray().addAll(5d);
    lineInput.setCache(true);
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.