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.


+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.


There's also a SliderDemo program linked in Section 6.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)

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 ?


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


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