Package javafx.scene.text

Examples of javafx.scene.text.Text


    Pane pane = new Pane();
    final Rectangle adapterRectangle = new Rectangle(ADAPTER_WIDTH,ADAPTER_HEIGHT);
    adapterRectangle.setFill(ADAPTER_COLOR);
    adapterRectangle.setArcHeight(25);
    adapterRectangle.setArcWidth(25);
    final Text adapterText = new Text(id);
    adapterText.setFontSmoothingType(FontSmoothingType.LCD);
    adapterText.xProperty().bind(adapterRectangle.xProperty().add(adapterRectangle.getWidth()/2).subtract(adapterText.getBoundsInLocal().getWidth()/2));
    adapterText.yProperty().bind(adapterRectangle.yProperty().subtract(5));
    pane.getChildren().add(adapterRectangle);
    pane.getChildren().add(adapterText);
    return pane;
  }
View Full Code Here


                    .build();

            node = imageViewer;
        } else {

            final Text text = TextBuilder.create()
                    .styleClass(ITEM_CLASS_PREFIX + item.getLevel())
                    .text(item.getValue() == null ? "" : item.getValue())
                    .build();

            node = text;
View Full Code Here

        getRootNode().setMinWidth(200);

        final HBox hbox = HBoxBuilder.create().build();
        final Label label = new Label("Node Name :");
        this.nodeName = new Text();
        hbox.getChildren().addAll(label, this.nodeName);

        getRootNode().getChildren().add(hbox);
    }
View Full Code Here

        this.progressBar.setPrefSize(460, 20);
        p.getChildren().add(this.progressBar);
        StackPane.setAlignment(this.progressBar, Pos.BOTTOM_CENTER);
        StackPane.setMargin(this.progressBar, new Insets(30));

        this.messageText = new Text("Loading");
        p.getChildren().add(this.messageText);
        StackPane.setAlignment(this.messageText, Pos.BOTTOM_CENTER);
        StackPane.setMargin(this.messageText, new Insets(10));

        return new Scene(p, 600, 200, Color.TRANSPARENT);
View Full Code Here

        final StackPane root = new StackPane();
        final FileChooser fileChooser = new FileChooser();
        final Button btn = new Button();
        final Button open1 = new Button();
        final Button open2 = new Button();
        final Text route1 = new Text();
        final Text route2 = new Text();
        final VBox vBox = new VBox();

        open1.setText("Open first file");
        open1.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent actionEvent) {
                File file = fileChooser.showOpenDialog(primaryStage);
                if (file != null) {
                    try {
                        bufferedImage1 = ImageIO.read(new File(String.valueOf(file)));
                        route1.setText(file.toString());
                    } catch (IOException e) {
                        e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
                    }
                }
            }
        });

        open2.setText("Open second file");
        open2.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent actionEvent) {
                File file = fileChooser.showOpenDialog(primaryStage);
                if (file != null) {
                    try {
                        bufferedImage2 = ImageIO.read(new File(String.valueOf(file)));
                        route2.setText(file.toString());
                    } catch (IOException e) {
                        e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
                    }
                }
            }
        });

        primaryStage.setTitle("Image Comparison Requirements");

        btn.setText("execute'");
        btn.setOnAction(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent event) {

                if (bufferedImage1 != null && bufferedImage2 != null){

                    int startX = -1;
                    int startY = -1;
                    int endX = bufferedImage1.getWidth();
                    int endY = bufferedImage1.getHeight();
                    long col1;
                    long col2;
                    long percent;

                    final BufferedImage newBufferedImage = new BufferedImage(bufferedImage1.getWidth(),
                            bufferedImage1.getHeight(), BufferedImage.TYPE_INT_RGB);
                    Graphics g = newBufferedImage.createGraphics();
                    g.setColor(red);

                    for (int x = 0; x < bufferedImage1.getWidth() - 1; x++) {
                        for (int y = 0; y < bufferedImage1.getHeight() - 1; y++) {
                            col1 = bufferedImage1.getRGB(x, y);
                            col2 = bufferedImage2.getRGB(x, y);
                            percent = col1 * 100 / col2;
                            if (percent > 110 || percent < 90) {
                                if (x > endX + 10) {
                                    g.drawRect(startX, startY, endX - startX, endY - startY);
                                    startX = -1;
                                    startY = -1;
                                    endX = bufferedImage1.getWidth();
                                    endY = bufferedImage1.getHeight();
                                }
                                if (startX == -1) {
                                    startX = x;
                                }
                                if (x <= startX) {
                                    startX = x;
                                }
                                if (startY == -1) {
                                    startY = y;
                                }
                                if (y <= startY) {
                                    startY = y;
                                }
                                if (endX == bufferedImage1.getWidth()) {
                                    endX = x;
                                }
                                if (x >= endX) {
                                    endX = x;
                                }
                                if (endY == bufferedImage1.getHeight()) {
                                    endY = y;
                                }
                                if (y >= endY) {
                                    endY = y;
                                }

                                newBufferedImage.setRGB(x, y, bufferedImage2.getRGB(x, y));
                            } else {
                                newBufferedImage.setRGB(x, y, bufferedImage2.getRGB(x, y));
                            }
                        }
                    }
                    g.drawRect(startX, startY, endX - startX, endY - startY);
                    System.out.println("Готово!");

                    Image image = SwingFXUtils.toFXImage(newBufferedImage, null);
                    ImageView iv1 = new ImageView();
                    iv1.setImage(image);
                    iv1.setFitHeight(500);
                    iv1.setFitWidth(800);
                    vBox.getChildren().add(iv1);

                    Button save = new Button();
                    save.setText("Save file");
                    save.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent actionEvent) {
                            FileChooser fileChooser = new FileChooser();
                            fileChooser.setTitle("Save Image");
                            File file = fileChooser.showSaveDialog(primaryStage);
                            if (file != null) {
                                try {
                                    ImageIO.write(newBufferedImage, "jpg", file);
                                } catch (IOException ex) {
                                    System.out.println(ex.getMessage());
                                }
                            }
                        }
                    });
                    vBox.getChildren().add(save);
                else {
                    Text error = new Text();
                    error.setText("No file");
                    vBox.getChildren().add(error);
                }
            }
        });

View Full Code Here

    // initial layout
    VBox lMenuVBox = new VBox(padding);
    lBorderPane.setCenter(lMenuVBox);

    // time
    lMenuVBox.getChildren().add(new Text("Time:"));
    // start
    final CalendarTextField lStartCalendarTextField = new CalendarTextField().withDateFormat(SimpleDateFormat.getDateTimeInstance());
    lStartCalendarTextField.setLocale(getSkinnable().getLocale());
    lStartCalendarTextField.setCalendar(abstractAppointmentPane.appointment.getStartTime());
    lMenuVBox.getChildren().add(lStartCalendarTextField);
    // end
    final CalendarTextField lEndCalendarTextField = new CalendarTextField().withDateFormat(SimpleDateFormat.getDateTimeInstance());
    lEndCalendarTextField.setLocale(getSkinnable().getLocale());
    lEndCalendarTextField.setCalendar(abstractAppointmentPane.appointment.getEndTime());
    lMenuVBox.getChildren().add(lEndCalendarTextField);
    lEndCalendarTextField.calendarProperty().addListener(new ChangeListener<Calendar>()
    {
      @Override
      public void changed(ObservableValue<? extends Calendar> arg0, Calendar oldValue, Calendar newValue)
      {
        abstractAppointmentPane.appointment.setEndTime(newValue);
        // refresh is done upon popup close
      }
    });
    lEndCalendarTextField.setVisible(abstractAppointmentPane.appointment.getEndTime() != null);
    // wholeday
    if ((abstractAppointmentPane.appointment.isWholeDay() != null && abstractAppointmentPane.appointment.isWholeDay() == true) || abstractAppointmentPane.appointment.getEndTime() != null)
    {
      final CheckBox lWholedayCheckBox = new CheckBox("Wholeday");
      lWholedayCheckBox.setId("wholeday-checkbox");
      lWholedayCheckBox.selectedProperty().set(abstractAppointmentPane.appointment.isWholeDay());
      lMenuVBox.getChildren().add(lWholedayCheckBox);
      lWholedayCheckBox.selectedProperty().addListener(new ChangeListener<Boolean>()
      {
        @Override
        public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldValue, Boolean newValue)
        {
          abstractAppointmentPane.appointment.setWholeDay(newValue);
          if (newValue == true)
          {
            abstractAppointmentPane.appointment.setEndTime(null);
          }
          else
          {
            Calendar lEndTime = (Calendar)abstractAppointmentPane.appointment.getStartTime().clone();
            lEndTime.add(Calendar.MINUTE, 30);
            abstractAppointmentPane.appointment.setEndTime(lEndTime);
            lEndCalendarTextField.setCalendar(abstractAppointmentPane.appointment.getEndTime());
          }
          lEndCalendarTextField.setVisible(abstractAppointmentPane.appointment.getEndTime() != null);
          // refresh is done upon popup close
        }
      });
    }
    // event handling
    lStartCalendarTextField.calendarProperty().addListener(new ChangeListener<Calendar>()
    {
      @Override
      public void changed(ObservableValue<? extends Calendar> arg0, Calendar oldValue, Calendar newValue)
      {
        // enddate
        if (abstractAppointmentPane.appointment.isWholeDay())
        {
          abstractAppointmentPane.appointment.setStartTime(newValue);
        }
        else
        {
          // remember
          Calendar lOldStart = abstractAppointmentPane.appointment.getStartTime();

          // set
          abstractAppointmentPane.appointment.setStartTime(newValue);

          // end date
          if (abstractAppointmentPane.appointment.getEndTime() != null)
          {
            long lDurationInMS = abstractAppointmentPane.appointment.getEndTime().getTimeInMillis() - lOldStart.getTimeInMillis();
            Calendar lEndCalendar = (Calendar)abstractAppointmentPane.appointment.getStartTime().clone();
            lEndCalendar.add(Calendar.MILLISECOND, (int)lDurationInMS);
            abstractAppointmentPane.appointment.setEndTime(lEndCalendar);

            // update field
            lEndCalendarTextField.setCalendar(abstractAppointmentPane.appointment.getEndTime());
          }

          // refresh is done upon popup close
        }
      }
    });

    // summary
    lMenuVBox.getChildren().add(new Text("Summary:"));
    TextField lSummaryTextField = new TextField();
    lSummaryTextField.setText(abstractAppointmentPane.appointment.getSummary());
    lSummaryTextField.textProperty().addListener(new ChangeListener<String>()
    {
      @Override
      public void changed(ObservableValue<? extends String> arg0, String oldValue, String newValue)
      {
        abstractAppointmentPane.appointment.setSummary(newValue);
        // refresh is done upon popup close
      }
    });
    lMenuVBox.getChildren().add(lSummaryTextField);

    // location
    lMenuVBox.getChildren().add(new Text("Location:"));
    TextField lLocationTextField = new TextField();
    lLocationTextField.setText( abstractAppointmentPane.appointment.getLocation() == null ? "" : abstractAppointmentPane.appointment.getLocation());
    lLocationTextField.textProperty().addListener(new ChangeListener<String>()
    {
      @Override
      public void changed(ObservableValue<? extends String> arg0, String oldValue, String newValue)
      {
        abstractAppointmentPane.appointment.setLocation(newValue);
        // refresh is done upon popup close
      }
    });
    lMenuVBox.getChildren().add(lLocationTextField);

    // actions
    lMenuVBox.getChildren().add(new Text("Actions:"))// TODO: internationalize
    HBox lHBox = new HBox();
    lMenuVBox.getChildren().add(lHBox);
    // delete
    {
      // close icon
      ImageViewButton lImageView = new ImageViewButton();
      lImageView.getStyleClass().add("delete-icon");
      lImageView.setPickOnBounds(true);
      lImageView.setOnMouseClicked(new EventHandler<MouseEvent>()
      {
        @Override public void handle(MouseEvent evt)
        {
          lPopup.hide();
          getSkinnable().appointments().remove(abstractAppointmentPane.appointment);
          // refresh is done via the collection events
        }
      });
      Tooltip.install(lImageView, new Tooltip("Delete")); // TODO: internationalize
      lHBox.getChildren().add(lImageView);
    }

    // construct a area of appointment groups
    lMenuVBox.getChildren().add(new Text("Group:"));
    GridPane lAppointmentGroupGridPane = new GridPane();
    lMenuVBox.getChildren().add(lAppointmentGroupGridPane);
    lAppointmentGroupGridPane.getStyleClass().add("AppointmentGroups");
    lAppointmentGroupGridPane.setHgap(2);
    lAppointmentGroupGridPane.setVgap(2);
View Full Code Here

   */
  private void calculateSizes()
  {
    // generic
    double lScrollbarSize = new ScrollBar().getWidth();
    textHeightProperty.set( new Text("X").getBoundsInParent().getHeight() );
   
    // header
    highestNumberOfWholedayAppointmentsProperty.set(0);
    for (DayPane lDay : weekPane.dayPanes)
    {
      if (lDay.wholedayAppointmentPanes.size() > highestNumberOfWholedayAppointmentsProperty.get())
      {
        highestNumberOfWholedayAppointmentsProperty.set( lDay.wholedayAppointmentPanes.size() );
      }
    }
    titleCalendarHeightProperty.set( 1.5 * textHeightProperty.get() );
    wholedayTitleHeightProperty.set( textHeightProperty.get() + 5 ); // not sure why the 5 is needed
    headerHeightProperty.set( titleCalendarHeightProperty.get() + (highestNumberOfWholedayAppointmentsProperty.get() * wholedayTitleHeightProperty.get()) );

    // time column
    timeWidthProperty.set( new Text("88:88").getBoundsInParent().getWidth() + timeColumnWhitespace );
   
    // day columns
    dayFirstColumnXProperty.set( timeWidthProperty.get() );
    if (weekScrollPane.viewportBoundsProperty().get() != null)
    {
View Full Code Here

      // link up the day and day header panes
      this.dayPane = dayPane;
      dayPane.dayHeaderPane = this; // two way link
     
      // set label
      calendarText = new Text("?");
      calendarText.getStyleClass().add("Calendar");
      calendarText.setX( padding ); // align left
      calendarText.setY( calendarText.prefHeight(0) );
      Rectangle lClip = new Rectangle(0,0,0,0);
      lClip.widthProperty().bind(widthProperty().subtract(padding));
View Full Code Here

      // historical visualizer
      historicalVisualizer = new HistoricalVisualizer(this);
      getChildren().add(historicalVisualizer);

      // add a text node
      Text lSummaryText = new Text(appointment.getSummary());
      lSummaryText.getStyleClass().add("AppointmentLabel");
      lSummaryText.setX( padding );
      lSummaryText.setY( textHeightProperty.get() );
      Rectangle lClip = new Rectangle(0,0,0,0);
      lClip.widthProperty().bind(widthProperty().subtract(padding));
      lClip.heightProperty().bind(heightProperty());
      lSummaryText.setClip(lClip);
      getChildren().add(lSummaryText);     
     
      // add the menu header
      getChildren().add(menuIcon);
    }
View Full Code Here

          l.endYProperty().bind( NodeUtil.snapXY(l.startYProperty()));
          getChildren().add(l);
        }
        // hour text
        {
          Text t = new Text(lHour + ":00");
          t.xProperty().bind(timeWidthProperty.subtract(t.getBoundsInParent().getWidth()).subtract(timeColumnWhitespace / 2));
          t.yProperty().bind(hourHeighProperty.multiply(lHour));
          t.setTranslateY(t.getBoundsInParent().getHeight()); // move it under the line
          t.getStyleClass().add("HourLabel");
          t.setFontSmoothingType(FontSmoothingType.LCD);
          getChildren().add(t);
        }
      }

      // 7 days per week
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.