import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.stage.Stage; public class Parabola extends Application { public void start(Stage stage) { stage.setTitle(""); final Canvas canvas = new Canvas(200, 200); GraphicsContext gc = canvas.getGraphicsContext2D(); double a = -0.0025, b = 1, c = 0; for (int x0 = 0; x0 < 200; x0 += 10) { double y0 = a * x0 * x0 + b * x0 + c; int x1 = x0 + 10; double y1 = a * x1 * x1 + b * x1 + c; gc.strokeLine(x0, (int)y0, x1, (int)y1); System.out.printf("(%d, %.1f) -- (%d, %.1f)", x0, y0, x1, y1); } Group root = new Group(); root.getChildren().addAll(canvas); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); } public static void main(String... args) { launch(args); } }