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

+10 votes

I am unable to make the slider show up on the canvas, does have any ideas?

asked in CSC305 Fall 2023 by (1 point)

2 Answers

+3 votes

You can read more about sliders (and other JavaFX widgets) in 6.4 of the textbook.

https://math.hws.edu/javanotes/c6/s4.html

There's also a SliderDemo program linked in Section 6.4.6.
https://math.hws.edu/javanotes/c6/s4.html#GUI1.4.6

answered by (508 points)
+2 votes

Did you make sure that your Slider object was defined in your HBox parameters? My slider showed up after adding it when defining HBox box = new HBox(brushSize, slider)

answered by (1 point)
+2

That makes sense but didn't you have to instantiate the slider first before adding it as a parameter in HBox box = new HBox(brushSize, slider) ? How did you define your Slider object ?

+2

After making my slider a private data field, what I did was instantiate the slider, ex. slider = new Slider(min, max, start point).

+2

I hadn't instantiated it that way, I'll have to try it out. Thank You!!!

...