Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+36 votes

There four options for showing the path of where the user click on the screen (point).
1) Switch ImageView to Canvas
- getGraphicsCountext() from canvas
- draw Image on the canvas
- draw dots on canvas

2) Put transparent canvas on top of ImageView using stackPane
- Just draw the dots on canvas using the GraphicsContext
- Will need the mouse events on Canvas
- Need Canvas to always be EXACTLY same size as ImageView
(if you have issues with this see http://lovelace.augustana.edu/q2a/index.php/246/there-properties-the-video-resize-the-imageview-the-canvas)

3) draw on Buffered Image before concerting to JavaFX image + Setting the ImageView

4) Add Circle object to a Pane that contains ImageView

In my team we used method 2 and it was not that bad.

asked in CSC285_Fall2018 by (1 point)

2 Answers

+16 votes
 
Best answer

just for clarification, on option #4 you say adding a circle object to the anchor/border pane in this case? Or do you also have to add a stack pane like with option 2?
I might be getting it wrong but so far option 4 and 2 look pretty similar to me.

answered by (1 point)
selected by
+6

Option 2 involves using one Canvas node to draw graphics on a transparent layer. Option 4 involves using multiple Circle nodes which get included in the JavaFX scene.

+15 votes

I went with option two as well. It seems to be the most straightforward process, and does not interfere with the rest of the code too much. I would reiterate that if you use this method you have to collect the point information from the canvas and not the image view

answered by (1 point)
+4

It would also be possible to get the points form mouse event by doing the .getX and .getY.

...