Search code examples
java-mecanvasscrollbarlcdui

How to add a vertial scrollbar in Canvas?


I am developing a Java ME application using Canvas. The details displayed on the Canvas are plentiful, so I need to scroll down the screen to view the further details.

But how can I add a vertical scrollbar on a Canvas?


Solution

  • I think that the scrollbar should be drawn inside the paint method. And you implement the keyReleased method when clicking the arrow of the scrollbar. To implement the scrolling I would prefer call repaint(); and I will manage the paint method with boolean or some other type of private variable.