Looking at the code, there's a canScroll boolean which turns the buttons off, but none of the mouse-wheel stuff checks it, so that should all work even without the buttons AFAICT (?)
If this was trivial, I'd have done it, but it looks a bit more hairy than that..
The position of the leftmost key is actually different when the buttons are missing, which is why it does that "firstKey = (float) rangeStart" stuff. Otherwise, if you created a keyboard and then turned off the buttons, I think it'd leave the first key too far to the right?
I know this is an old issue, and @jules said it wasn’t trivial to change, but it doesn’t seem like it should be rocket science either. I have a case where I want to use the keyboard along the side of a piano roll, and control the position of the keyboard based on scrolling the piano roll, without displaying the scroll buttons on the keyboard. I thought I had a work around by overriding drawUpDownButton and not drawing anything in there, but of course the buttons are still there, just invisible. lol… any chance you could make the setLowestVisibleKey work when the scroll buttons aren’t displayed?
edit: a co-worker suggested another approach, which I think should provide the same experience. ie. don’t externally scroll a 127 note keyboard, instead use setAvailableRange to dynamically adjust a static 24 note keyboard. I haven’t tested it yet, but I’ll post the results when I do.