I have a SWT Scale widget, and I need to add labels to the ticks on the scale.
Is there a way to do this? maybe on a Slider widget?
Thanks
This might be not exactly what you are asking, but you could incorporate a Text widget beside the Scale widget, responding to your Scale values.
For instance:
final Scale scale = new Scale(shell, SWT.HORIZONTAL);
scaleValue = new Text(shell, SWT.SINGLE | SWT.BORDER);
//scale properties omitted...
scale.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
int perspectivevalue = scale.getSelection();
scaleValue.setText("" + (perspectivevalue));
}
});
This has the effect of updating the value in the Text widget given whatever you drag the Scale slider to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With