Set position of textbox relative to slider based on window size

I’ve got 2 sliders. A rotary one and a verticle one. As you can se tyeh are at the same height but the textbox are at different heights. size and position is programmed like this:

rotary.setBounds(localBounds.getWidth() / 40, 
				 localBounds.getHeight() / 8,
				 localBounds.getWidth() / 4.8,
				 localBounds.getHeight() / 2.5);

vertical.setBounds(localBounds.getWidth() / 6.8,
				   localBounds.getHeight() / 8,
				   localBounds.getWidth() / 4.8,
				   localBounds.getHeight() / 2.7);

they look like this:

img

Is there a way to move the height of the textbox relative to the slider based on the way above (with relativity to the height)?

Is a grid layout an option for you? I think this would bring you the desired effect.

If you’re relying on the built-in labels for sliders, you may have to provide a custom LookAndFeel overriding getSliderLayout()

that sounds like something I’d be intrested in. Does this work with the label provided with the slider or do I need to make another label then?

I’ve tried that, however, I could not get the label to change position.