I have this method for drawing a Cartesian plane in JavaFX using canvas
public class Grafics extends StackPane { private Canvas canvas; public void Grafics(){ GridPane grid = new GridPane(); grid.setPadding(new Insets(5)); grid.setHgap(10); grid.setVgap(10); canvas = new Canvas(); canvas.setHeight(500); canvas.setWidth(700); GridPane.setHalignment(canvas, HPos.CENTER); grid.add(canvas, 0, 2); GraphicsContext gc = canvas.getGraphicsContext2D(); gc.setFill(Color.BLACK); gc.fillRect(0, 0, canvas.getWidth(), canvas.getHeight()); gc.setFill(Color.WHITE); gc.fillRect(1, 1, canvas.getWidth() - 2, canvas.getHeight() - 2); drawAxesXY(gc);
this is a feature of my codes http://postimg.org/image/uipe1mgyb/
and I want to draw, as in the examples http://postimg.org/image/98k9mvnb3/
in another entry, they recommended that I use PixelWriter to record pixels in the canvas. I tried but does nothing.
I think the method that I use to draw a Cartesian plane using canvas in JavaFX is incorrect, there is no other method to draw a Cartesian plane in JavaFX without using PixelWriter.
How to draw a Cartesian plane with a canvas in JavaFX and show the coordinates of the axes (x, y) and (-x, -y), as an example does?
source share