Package javafx.scene.shape

Examples of javafx.scene.shape.Line


      }
    });
  }
 
  public static void addMarker(final XYChart<?, ?> chart, final StackPane chartWrap) {
    final Line valueMarker = new Line();
    final Node chartArea = chart.lookup(".chart-plot-background");

    chartArea.setOnMouseMoved(new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent event) {
        Point2D scenePoint = chart.localToScene(event.getSceneX(), event.getSceneY());
        Point2D position = chartWrap.sceneToLocal(scenePoint.getX(), scenePoint.getY());
       
        Bounds chartAreaBounds = chartArea.localToScene(chartArea.getBoundsInLocal());
        valueMarker.setStartY(0);
        valueMarker.setEndY(chartWrap.sceneToLocal(chartAreaBounds).getMaxY()-chartWrap.sceneToLocal(chartAreaBounds).getMinY());
       
        valueMarker.setStartX(0);
        valueMarker.setEndX(0);
        valueMarker.setTranslateX(position.getX()-chartWrap.getWidth()/2);
       
        double ydelta = chartArea.localToScene(0, 0).getY()-chartWrap.localToScene(0,0).getY();
        valueMarker.setTranslateY(-ydelta*2);
      }
    });
   
    chartWrap.getChildren().add(valueMarker);
  }
 
View Full Code Here


    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);
    lineInput.startXProperty().set(getAnimationPaneWidth()/2- getAnimationPaneWidth()/8);
    lineInput.endXProperty().set(lineInput.startXProperty().get());
    lineInput.startYProperty().set(0);
    lineInput.endYProperty().bind(animationPane.heightProperty());
    animationPane.getChildren().add(lineInput);
   
    Line lineOutput = new Line();
    lineOutput.getStrokeDashArray().addAll(5d);
    lineOutput.setCache(true);
    lineOutput.startXProperty().set(getAnimationPaneWidth() / 2 + getAnimationPaneWidth() / 8);
    lineOutput.endXProperty().set(lineOutput.startXProperty().get());
    lineOutput.startYProperty().set(0);
    lineOutput.endYProperty().bind(animationPane.heightProperty());
    animationPane.getChildren().add(lineOutput);
   
  }
View Full Code Here

      // draw hours
      for (int lHour = 0; lHour < 24; lHour++)
      {
        // hour line
        {
          Line l = new Line(0,10,100,10);
          l.setId("hourLine" + lHour);
          l.getStyleClass().add("HourLine");
          l.startXProperty().set(0.0);
          l.startYProperty().bind( NodeUtil.snapXY(hourHeighProperty.multiply(lHour)) );
          l.endXProperty().bind( NodeUtil.snapXY(widthProperty()));
          l.endYProperty().bind( NodeUtil.snapXY(l.startYProperty()));
          getChildren().add(l);
        }
        // half hour line
        {
          Line l = new Line(0,10,100,10);
          l.setId("halfHourLine" + lHour);
          l.getStyleClass().add("HalfHourLine");
          l.startXProperty().bind( NodeUtil.snapXY(timeWidthProperty));
          l.endXProperty().bind( NodeUtil.snapXY(widthProperty()));
          l.startYProperty().bind( NodeUtil.snapXY(hourHeighProperty.multiply(lHour + 0.5)));
          l.endYProperty().bind( NodeUtil.snapXY(l.startYProperty()));
          getChildren().add(l);
        }
        // hour text
        {
          Text t = new Text(lHour + ":00");
View Full Code Here

    guiNodes = new GUINode[rows][columns];
    double angle, xPos, yPos;
    for (int r = 0; r < rows; r++) {
      for (int c = 0; c < columns; c++) {
        // make the connection lines
        Line lines[] = new Line[resources.arity()];
        for (int l = 0; l < lines.length; l++) {
          angle = ((((double) (l + 1)) / ((double) (lines.length + 1))) * Constants.THETA) - (Constants.THETA / 2);
          xPos = (-Math.cos(angle) * Constants.NODE_RADIUS) + (((c + 1) * (2 * Constants.NODE_RADIUS + Constants.SPACING)) + Constants.NODE_RADIUS);
          yPos = (Math.sin(angle) * Constants.NODE_RADIUS) + ((r * (2 * Constants.NODE_RADIUS + Constants.SPACING)) + Constants.NODE_RADIUS);
         
          lines[l] = new Line(xPos, yPos, xPos, yPos);
          lines[l].setMouseTransparent(true);
          lines[l].setVisible(false);
          connectionLines.add(lines[l]);
        }
        // make the GUI elements
        guiNodes[r][c] = new GUINode(this, chromosome.getNode(r, c), lines, gui);
      }
      content.getChildren().addAll(guiNodes[r]);
    }
    // outputs
    guiOutputs = new GUIOutput[resources.outputs()];
    for (int i = 0; i < guiOutputs.length; i++) {
      xPos = ((resources.columns() + 1) * (2 * Constants.NODE_RADIUS + Constants.SPACING));
      yPos = (chromosome.getOutput(i).getIndex() * (2 * Constants.NODE_RADIUS + Constants.SPACING)) + Constants.NODE_RADIUS;
      // make the line
      Line line = new Line(xPos, yPos, xPos, yPos);
      line.setMouseTransparent(true);
      line.setVisible(false);
      connectionLines.add(line);
      // make the GUI elements
      guiOutputs[i] = new GUIOutput(this, chromosome.getOutput(i), line, gui);
      content.getChildren().addAll(guiOutputs[i]);
    }
View Full Code Here

    HBox numberOfPlayersButtons = new HBox();
    numberOfPlayersButtons.setAlignment(Pos.CENTER);
    numberOfPlayersButtons.getChildren().addAll(numberOfPlayers1,
            numberOfPlayers2, numberOfPlayers3);

    Line horizontalLine1 = new Line();
    horizontalLine1.setEndX(480);
    horizontalLine1.setStroke(Color.GRAY);
    horizontalLine1.setStrokeWidth(2);

    Label worldCreationLabel = new Label("CREATION OF THE WORLD");
    worldCreationLabel.setFont(Assets.getFont(Assets.FONT_COURIERNEW_BOLD_16));
    worldCreationLabel.setTextFill(Color.LIGHTGRAY);

    worldCreation = new ToggleGroup();

    RadioButton worldCreation1 = new RadioButton("1");
    worldCreation1.setFont(Assets.getFont(Assets.FONT_COURIERNEW_BOLD_13));
    worldCreation1.setSelected(true);
    worldCreation1.setUserData(new FlatLandWorldGenerator(0.15));
    worldCreation1.setToggleGroup(worldCreation);
    worldCreation1.setMinWidth(120);
    worldCreation1.setMaxWidth(120);

    RadioButton worldCreation2 = new RadioButton("2");
    worldCreation2.setFont(Assets.getFont(Assets.FONT_COURIERNEW_BOLD_13));
    worldCreation2.setUserData(new FlatLandWorldGenerator(0.3));
    worldCreation2.setToggleGroup(worldCreation);
    worldCreation2.setMinWidth(120);
    worldCreation2.setMaxWidth(120);

    RadioButton worldCreation3 = new RadioButton("3");
    worldCreation3.setFont(Assets.getFont(Assets.FONT_COURIERNEW_BOLD_13));
    worldCreation3.setUserData(new FlatLandWorldGenerator(0.45));
    worldCreation3.setToggleGroup(worldCreation);
    worldCreation3.setMinWidth(120);
    worldCreation3.setMaxWidth(120);

    RadioButton worldCreation4 = new RadioButton("4");
    worldCreation4.setFont(Assets.getFont(Assets.FONT_COURIERNEW_BOLD_13));
    worldCreation4.setUserData(new FlatLandWorldGenerator(0.6));
    worldCreation4.setToggleGroup(worldCreation);
    worldCreation4.setMinWidth(120);
    worldCreation4.setMaxWidth(120);

    RadioButton worldCreation5 = new RadioButton("5");
    worldCreation5.setFont(Assets.getFont(Assets.FONT_COURIERNEW_BOLD_13));
    worldCreation5.setUserData(new FlatLandWorldGenerator(0.75));
    worldCreation5.setToggleGroup(worldCreation);

    HBox worldCreationButtons = new HBox();
    worldCreationButtons.setAlignment(Pos.CENTER);
    worldCreationButtons.getChildren().addAll(worldCreation1, worldCreation2,
            worldCreation3, worldCreation4, worldCreation5);

    Line horizontalLine2 = new Line();
    horizontalLine2.setEndX(480);
    horizontalLine2.setStroke(Color.GRAY);
    horizontalLine2.setStrokeWidth(2);

    Label gameLevelLabel = new Label("GAME LEVEL");
    gameLevelLabel.setFont(Assets.getFont(Assets.FONT_COURIERNEW_BOLD_16));
    gameLevelLabel.setTextFill(Color.LIGHTGRAY);
View Full Code Here

  private Line createWestBorder() {
    return createLine(World.TILE_WIDTH / 2.0, World.TILE_HEIGHT, 0.0, World.TILE_HEIGHT / 2.0);
  }

  private Line createLine(double startX, double startY, double endX, double endY) {
    Line line = new Line();
    line.setStartX(startX);
    line.setStartY(startY);
    line.setEndX(endX);
    line.setEndY(endY);
    line.getStrokeDashArray().addAll(1.0, 4.0);
    line.setStroke(Color.rgb(200, 200, 200));
    line.setStrokeWidth(1.0);
    line.setFill(Color.TRANSPARENT);
    return line;
  }
View Full Code Here

    cClip.translateYProperty().bind(localRadius);

    viewer = new Viewer(localRadius, localRadius);
    viewer.setClip(cClip);

    final Line vL = new Line();
    vL.setStartX(0);
    vL.setStartY(0);
    vL.setEndX(0);
    vL.getStyleClass().add("magnifier-vLine");
    vL.strokeWidthProperty().bind(scopeLineWidthProperty);
    vL.visibleProperty().bind(scopeLinesVisibleProperty);
    vL.endYProperty().bind(localRadius.multiply(2));

    final Line hL = new Line();
    hL.setStartX(0);
    hL.setStartY(0);
    hL.setEndY(0);
    hL.getStyleClass().add("magnifier-hLine");
    hL.strokeWidthProperty().bind(scopeLineWidthProperty);
    hL.visibleProperty().bind(scopeLinesVisibleProperty);
    hL.endXProperty().bind(localRadius.multiply(2));

    // Adding all parts in a container.
    mainContent.getChildren().addAll(frame, viewer, vL, hL);

    final Popup popUp = new Popup();
View Full Code Here

    {
      double connectX = x - X_GAP;
      double connectY = y + RECT_HEIGHT / 2;
      double upLineY = y + RECT_HEIGHT / 2;

      Line lineUp = new Line(connectX, upLineY, connectX, parentY);
      lineUp.setStrokeWidth(STROKE_WIDTH);
      pane.getChildren().add(lineUp);

      Line lineLeft = new Line(connectX, connectY, x, connectY);
      lineLeft.setStrokeWidth(STROKE_WIDTH);
      pane.getChildren().add(lineLeft);
    }

    double nextX = x + plotNode.rect.getWidth() / 2;
View Full Code Here

     *
     * @param moveType
     * @param vel
     */
    public void drawLine(String moveType, double vel) {
        Line l;
        l = new Line();
        l.setSmooth(true);
        //Code to make mm's look the same size as inches
        double scale = 1;
        double unitMagnication = 1;

//        if (TinygDriver.getInstance().m.getGcodeUnitMode().get().equals(Gcode_unit_modes.inches.toString())) {
//            unitMagnication = 5;  //INCHES
//        } else {
//            unitMagnication = 2; //MM
//        }
//        double newX = unitMagnication * (Double.valueOf(TinygDriver.getInstance().m.getAxisByName("X").getWork_position().get()) + 80);// + magnification;
//        double newY = unitMagnication * (Double.valueOf(TinygDriver.getInstance().m.getAxisByName("Y").getWork_position().get()) + 80);// + magnification;


//        if (newX > gcodePane.getWidth() || newX > gcodePane.getWidth()) {
//            scale = scale / 2;
//            Line line = new Line();
//            Iterator ii = gcodePane.getChildren().iterator();
//            gcodePane.getChildren().clear(); //remove them after we have the iterator
//            while (ii.hasNext()) {
//                if (ii.next().getClass().toString().contains("Line")) {
//                    //This is a line.
//                    line = (Line) ii.next();
//                    line.setStartX(line.getStartX() / 2);
//                    line.setStartY(line.getStartY() / 2);
//                    line.setEndX(line.getEndX() / 2);
//                    line.setEndY(line.getEndY() / 2);
//                    gcodePane.getChildren().add(line);
//
//                }

//            }
//            console.appendText("[+]Finished Drawing Prevew Scale Change.\n");
//            gcodeWindow.setScaleX(scale);
//            gcodeWindow.setScaleY(scale);
//        }
//        Main.print(gcodePane.getHeight() - TinygDriver.getInstance().m.getAxisByName("y").getWork_position().get());
        double newX = TinygDriver.getInstance().machine.getAxisByName("x").getMachinePositionSimple().get();// + magnification;
        double newY = this.getHeight() - TinygDriver.getInstance().machine.getAxisByName("y").getMachinePositionSimple().get();//(gcodePane.getHeight() - (Double.valueOf(TinygDriver.getInstance().m.getAxisByName("y").getWork_position().get())));// + magnification;
      
       
        if (Draw2d.isFirstDraw()) {
            //This is to not have us draw a line on the first connect.
            l = new Line(newX, this.getHeight(), newX, this.getHeight());
            Draw2d.setFirstDraw(false);
        } else {
            l = new Line(xPrevious, yPrevious, newX, newY);
            l.setStrokeWidth(.5);
        }
       
         xPrevious = newX;
        yPrevious = newY; //TODO Pull these out to CNC machine or Draw2d these are out of place


        if (TinygDriver.getInstance().machine.getMotionMode().get().equals("traverse")) {
            //G0 Moves
            l.getStrokeDashArray().addAll(1d, 5d);
            l.setStroke(Draw2d.TRAVERSE);
        } else {
//            l.setStroke(Draw2d.getLineColorFromVelocity(vel));
            l.setStroke(Draw2d.FAST);
        }



        if (l != null) {
View Full Code Here

        this.setScaleY(scaleAmount);
        Iterator ii = this.getChildren().iterator();

        while (ii.hasNext()) {
            if (ii.next().getClass().getName().endsWith("Line")) {
                Line l = (Line) ii.next();
                l.setStrokeWidth(stroke);
            }
        }
    }
View Full Code Here

TOP

Related Classes of javafx.scene.shape.Line

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.