Set position of textbox relative to slider based on window size

#1

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)?

0 Likes

#2

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

0 Likes

#3

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

0 Likes

#4

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?

0 Likes

#5

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

0 Likes