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

+6 votes

I'm on the second part of the lab and I'm struggling to figure out how to get the brush size dependent on the slider.

asked ago in CSC 305 Fall 2024 by (629 points)

2 Answers

+3 votes
 
Best answer

the Slider class has a function call getValue(). I would save the value of the slider in a variable by calling SliderObject.getValue() and use it for the brush size. You should find the code to set the brush size in the mousePressed() function or somewhere around.

answered ago by (528 points)
selected ago by
+2 votes

You are able to add what is called a Listener to the slider which will allow you to run some code when it changes. Try reading this: https://www.geeksforgeeks.org/javafx-slider-class/

answered ago by (439 points)
...