JavaFX Tutorial - Java VLineTo.setY(double value)








Syntax

VLineTo.setY(double value) has the following syntax.

public final void setY(double value)

Example

In the following code shows how to use VLineTo.setY(double value) method.

/*from  w w w.j a v a 2s . co m*/
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import javafx.scene.shape.VLineTo;
import javafx.stage.Stage;
 
public class Main extends Application {

    @Override
    public void start(final Stage stage) {
        stage.setTitle("HTML");
        stage.setWidth(500);
        stage.setHeight(500);
        Scene scene = new Scene(new Group());

        VBox root = new VBox();     

        Path path = new Path();
        path.getElements().add(new MoveTo(50.0f, 0.0f));
        VLineTo vlt = new VLineTo(50.0f);
        vlt.setY(.7);
        path.getElements().add(vlt);
        
        System.out.println(vlt.getY());

        root.getChildren().addAll(path);
        scene.setRoot(root);

        stage.setScene(scene);
        stage.show();
    }
 
    public static void main(String[] args) {
        launch(args);
    }
}