Java: How to draw non-scrolling overlay over ScrollPane Viewport?

Ordinarily, “Swing programs should override paintComponent() instead of overriding paint(),” as mentioned in Painting in AWT and Swing: The Paint Methods. Based on ScrollPanePaint, which draws below the scrolling content, the following example overrides paint() to draw above the scrolling content. import java.awt.*; import javax.swing.*; /** * @see https://stackoverflow.com/a/10097538/230513 * @see https://stackoverflow.com/a/2846497/230513 * @see https://stackoverflow.com/a/3518047/230513 … Read more

tech