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

+13 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 in CSC 305 Fall 2024 by (868 points)

2 Answers

+5 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 by (1.9k points)
selected by
+3 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 by (1.2k points)
...