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.