Package javafx.scene

Examples of javafx.scene.Group


  public Scene createVisualScene() {
    final int screenHeight = GetScreenWorkingHeight();
    final int screenWidth = GetScreenWorkingWidth();
    final double delimter = (screenWidth / 1.673);
    final int translatLocation = (int) Math.round(screenWidth - delimter);
    final Group root = new Group();
    final Random rand = new Random();

    UISession.getMediaView().setFitWidth(1);
    UISession.getMediaView().setFitHeight(1);
    UISession.getMediaView().setPreserveRatio(false);

    final VBox vbox = new VBox();
    final HBox hbox = new HBox(2);
    final int bands = UISession.getMediaPlayer().getAudioSpectrumNumBands() - 20;
    final Rectangle[] rects = new Rectangle[bands];
    for (int i = 0; i < rects.length; i++) {
      rects[i] = new Rectangle();
      rects[i].getTransforms().add(new Rotate(180, 0, 0)); //
      rects[i].setFill(Color.GRAY);
      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,
View Full Code Here


  public MediaView view;

  public Scene createScene(final String sourceURL) throws Throwable {
    final ControlPanel panel = UISession.getControlPanel();
    final Group root = new Group();
    root.autosize();
    MediaUtils.activeMedia = sourceURL;
    final String trailer = MediaUtils.getMediaURL(sourceURL);
    try {
      media = new Media(trailer.trim());
    } catch (final Exception e) {
View Full Code Here

     * @return the button
     */
    protected Button createViewOriginalButton() {
      // TODO : handle image zoom when no file is specified
      if (file != null) {
        final Group btnGraphic = createButtonGraphic(0.2);
        final Button zoomButton = new Button();
        zoomButton.setTooltip(new Tooltip(imageFullSizeToolTip));
        zoomButton.setGraphic(btnGraphic);
        zoomButton.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
          @Override
View Full Code Here

      }
      return null;
    }
   
    protected Group createButtonGraphic(final double scale) {
    final Group btnGrp = new Group();
      final Circle circle = new Circle(106.0 * scale, 74.0 * scale, 25.0 * scale);
      circle.setFill(Color.rgb(0xcc, 0xff, 0x00, 1.0));
      circle.setOpacity(0.9);
      circle.setSmooth(true);
      circle.setStroke(Color.rgb(0xa7, 0xd1, 0x00, 1.0));
      circle.setStrokeWidth(2.0 * scale);
      final Path path = new Path();
      path.setStroke(null);
      path.setOpacity(0.74);
      path.setSmooth(true);
      final MoveTo mt = new MoveTo(123.143 * scale, 61.088 * scale);
      mt.setAbsolute(true);
      path.getElements().add(mt);
      final RadialGradient rg = new RadialGradient(0, 0, 118.0 * scale, 90.0 * scale, 53.625 * scale, false, CycleMethod.NO_CYCLE,
          new Stop(0.0 * scale, Color.rgb(0xFF, 0xFF, 0xFF, 1.0)),
          new Stop(0.2033 * scale, Color.rgb(0xFE, 0xFF, 0xFD, 1.0)),
          new Stop(0.2765 * scale, Color.rgb(0xFD, 0xFD, 0xF6, 1.0)),
          new Stop(0.3286 * scale, Color.rgb(0xF9, 0xFB, 0xEB, 1.0)),
          new Stop(0.3708 * scale, Color.rgb(0xF4, 0xF7, 0xDA, 1.0)),
          new Stop(0.4065 * scale, Color.rgb(0xEE, 0xF2, 0xC4, 1.0)),
          new Stop(0.4157 * scale, Color.rgb(0xEC, 0xF1, 0xBD, 1.0)),
          new Stop(1.0 * scale, Color.rgb(0xCC, 0xFF, 0x00, 1.0)));
      path.setFill(rg);
      final CubicCurveTo cct1 = new CubicCurveTo(130.602 * scale, 70.889 * scale, 129.01 * scale,
          84.643 * scale, 119.59 * scale, 91.813 * scale);
      cct1.setAbsolute(true);
      path.getElements().add(cct1);
      final CubicCurveTo cct2 = new CubicCurveTo(110.171 * scale, 98.981 * scale, 96.489 * scale,
          96.843 * scale, 89.032 * scale, 87.043 * scale);
      cct2.setAbsolute(true);
      path.getElements().add(cct2);
      final CubicCurveTo cct3 = new CubicCurveTo(81.573 * scale, 77.24 * scale, 83.165 * scale,
          63.486 * scale, 92.584 * scale, 56.316 * scale);
      cct3.setAbsolute(true);
      path.getElements().add(cct3);
      final CubicCurveTo cct4 = new CubicCurveTo(102.004 * scale, 49.149 * scale, 115.686 * scale,
          51.285 * scale, 123.143 * scale, 61.088 * scale);
      cct4.setAbsolute(true);
      path.getElements().add(cct4);
      path.getElements().add(new ClosePath());
//      final Ellipse ellipse = new Ellipse(96.5 * scale, 62.5 * scale, 8.294 * scale, 4.906 * scale);
//      ellipse.setFill(Color.rgb(0xff, 0xff, 0xff, 1.0));
//      ellipse.setSmooth(true);
//      ellipse.getTransforms().add(Transform.affine(0.7958 * scale, -0.6055 * scale, 0.655 * scale,
//          0.7958 * scale, -18.1424 * scale, 71.1966 * scale));
      btnGrp.getChildren().addAll(circle, path);//, ellipse);
      return btnGrp;
    }
View Full Code Here

      final Screen screen = Screen.getPrimary();
      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

   */
  protected final void createChildren() {
    // create basic gauge shapes
    final Shape gaugeCenter = createBackground(outerRadius, innerRadius, centerGaugeFillProperty,
        outerRimFillProperty, outerRimEffectFillProperty);
    final Group gaugeParent = createParent(gaugeCenter);

    // add tick marks
    addTickMarks(gaugeParent, true, false);
    // add display that will show the current tick value
    final double tickValueHeight = 20d * sizeScale;
    final Node tickValueDisplay = this.indicatorType == IndicatorType.KNOB ? null :
      createTickValueDisplay(tickValueHeight, tickValueDisplayFillProperty, tickValueDisplayTextFillProperty);
    final Node tickValueDisplay2 = this.indicatorType == IndicatorType.KNOB ? null :
      createTickValueDisplay2(tickValueHeight, tickValueDisplayFillProperty, tickValueDisplayTextFillProperty);
   
    // create intensity indicators that will indicate when values are moderate, medium, or intense
    final Group intensityIndicator = createIntensityIndicator();
   
    // create highlight
    final double highlightAngle = 270d; //isCircular() ? 270d : getGeometricCenterAngle();
    final Shape highlight = this.indicatorType == IndicatorType.KNOB ? null : createHighlight(0, 0, highlightAngle);
   
    // create indicator/hand
    final Group indicator = createIndicator(gaugeParent, indicatorPointDistance,
        indicatorFillProperty, indicatorOpacityProperty);
   
    if (tickValueDisplay2 != null) {
      gaugeParent.getChildren().add(tickValueDisplay2);
    }
View Full Code Here

   *
   * @param gaugeCenter the center of the gauge display
   * @return the gauge parent
   */
  protected final Group createParent(final Shape gaugeCenter) {
    final Group gaugeParent = new Group();
    gaugeParent.getChildren().addAll(gaugeCenter);
    return gaugeParent;
  }
View Full Code Here

    region2Arc.setCache(true);
    region3Arc.setSmooth(false);
    region3Arc.setCache(true);
    updateIntensityIndicatorProperties(region1Arc, region2Arc, region3Arc, intensityIndicatorRegionsProperty.get());
   
    final Group intensityIndicator = new Group();
    intensityIndicator.setCache(true);
    intensityIndicator.setCacheHint(CacheHint.SPEED);
    intensityIndicatorRegionsProperty.addListener(new ChangeListener<IntensityIndicatorRegions>() {
      @Override
      public void changed(ObservableValue<? extends IntensityIndicatorRegions> observable,
          IntensityIndicatorRegions oldValue, IntensityIndicatorRegions newValue) {
        updateIntensityIndicatorProperties(region1Arc, region2Arc, region3Arc, newValue);
      }
    });
    intensityIndicator.getChildren().addAll(region3Arc, region2Arc, region1Arc);
    return intensityIndicator;
  }
View Full Code Here

     * @param opacityProperty the opacity property to bind to
   * @return the indicator/hand
   */
  protected final Group createIndicator(final Group gaugeParent, final double pointDistance,
      final ObjectProperty<Paint> fillProperty, final DoubleProperty opacityProperty) {
    final Group indicator = new Group();
    Bindings.bindBidirectional(indicator.opacityProperty(), opacityProperty);
    indicator.setCache(true);
    indicator.setCacheHint(CacheHint.ROTATE);
    final DropShadow handDropShadow = new DropShadow();
    handDropShadow.setOffsetX(4);
    handDropShadow.setOffsetY(4);
    handDropShadow.setRadius(7);
    handDropShadow.setColor(Color.BLACK);
    handDropShadow.setInput(getIndicatorMoveEffect());
    indicator.setEffect(handDropShadow);
    gaugeParent.addEventFilter(MouseEvent.ANY, new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent event) {
        if (event.getEventType() == MouseEvent.MOUSE_DRAGGED ||
            event.getEventType() == MouseEvent.MOUSE_PRESSED) {
          if (event.isMetaDown() || event.isControlDown() || event.isAltDown() ||
              event.isShiftDown() || event.isShortcutDown() || !event.isPrimaryButtonDown()) {
            return;
          }
          needleDragging.set(true);
          getIndicatorMoveEffect().setLevel(indicatorType == IndicatorType.KNOB ? 0.2d : 0.7d);
          moveIndicator(centerX - event.getX(), centerY - event.getY());
        } else if (event.getEventType() == MouseEvent.MOUSE_RELEASED) {
          getIndicatorMoveEffect().setLevel(0);
          needleDragging.set(false);
        }
      }
    });
    final Group indicatorBase = new Group();
    indicatorBase.setCache(true);
    indicatorBase.setCacheHint(CacheHint.ROTATE);
    final double ix = centerX - (indicatorWidth / 1.2);
    final double iy = centerY - (indicatorHeight / 2);
   
    // indicator shape
    final Rotate indicatorRotate = new Rotate(this.angleProperty.get(), centerX, centerY);
    Bindings.bindBidirectional(indicatorRotate.angleProperty(), this.angleProperty);
    Shape indicatorShape;
    if (indicatorType == IndicatorType.KNOB) {
      indicatorShape = createIndicatorShape(indicatorType, ix, iy, indicatorWidth - pointDistance,
          indicatorHeight - pointDistance, pointDistance,
          centerX, centerY, fillProperty);
      final double knobSurfaceRadius = indicatorWidth - pointDistance * 2d;
        final Group knobSurface = createKnobSurface(0, centerX, centerY,
            knobSurfaceRadius, knobSurfaceRadius, DEFAULT_KNOB_SURFACE_COLORS);
        final Group indicatorShapeGroup = createKnob(indicatorShape, knobSurface);
      indicatorShapeGroup.getTransforms().addAll(indicatorRotate);     
      indicatorBase.getChildren().add(indicatorShapeGroup);
    } else {
      indicatorShape = createIndicatorShape(indicatorType, ix, iy, indicatorWidth,
          indicatorHeight, pointDistance, centerX, centerY, fillProperty);
      indicatorShape.getTransforms().addAll(indicatorRotate);
View Full Code Here

   * @param addMinorTickLabel true to add the value label to the minor tick marks
   * @return the tick mark group
   */
  protected final Group addTickMarks(final Group parent, final boolean addMajorTickLabel,
      final boolean addMinorTickLabel) {
    final Group tickGroup = new Group();
    tickGroup.setCache(true);
    tickGroup.setCacheHint(CacheHint.ROTATE);
    Shape tick;
    // all tick marks will have the same starting coordinates- only the angle will be adjusted
    final double tx = tickMarkDefaultX();
    final double ty = tickMarkDefaultY();
    final int numOfTotalMinorTicks = getNumberOfMinorTicks();
    int i;
    String label;
    double angle, labelAngle, labelRadius, tlx, tly;
    // add the minor tick marks
    for (i=0; i<=numOfTotalMinorTicks; i++) {
      angle = tickMarkAngle(numOfTotalMinorTicks, i);
      tick = createTickMark(tx, ty, minorTickMarkWidth, minorTickMarkHeight,
          angle + minorTickMarkHeight / 2.5d, minorTickMarkFillProperty);
      tickGroup.getChildren().add(tick);
    }
    // add the major tick marks
    for (i=0; i<=numOfMajorTickMarks; i++) {
      angle = tickMarkAngle(numOfMajorTickMarks, i);
      tick = createTickMark(tx, ty, majorTickMarkWidth, majorTickMarkHeight,
          angle + majorTickMarkHeight / 2.5d, majorTickMarkFillProperty);
      tickGroup.getChildren().add(tick);
      if (addMajorTickLabel && (i != numOfMajorTickMarks || !isCircular())) {
        // TODO : adjust position to accommodate for number of digits in guage label
        label = getTickValueLabel(angle, true); // 180d - ((angleLength / numOfMarks) * index) - angleStart
        labelAngle = positiveAngle(angle - (majorTickMarkHeight / 2d) - 180d);
        labelRadius = indicatorType == IndicatorType.KNOB ? outerRadius :
          innerRadius - majorTickMarkWidth * 2d;
        tlx = (centerX + labelRadius)
            * Math.cos(Math.toRadians(labelAngle));
        tly = (centerY + labelRadius)
            * Math.sin(Math.toRadians(labelAngle));
        tickGroup.getChildren().add(createTickMarkLabel(tlx, tly, angle, labelAngle, label, tick,
            tickMarkLabelFillProperty));
      }
        }
    parent.getChildren().add(tickGroup);
    return tickGroup;
View Full Code Here

TOP

Related Classes of javafx.scene.Group

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.