I'm using a Painter to display a validation hint, similar to the example in the API docs.
This is the code that actually paints the image:
private void paintMe(Graphics g, Component comp) {
int xpos = comp.getAbsoluteX();
int ypos = comp.getAbsoluteY();
float width = comp.getWidth();
xpos += Math.round(width);
xpos -= 28;
ypos -= 28;
g.drawImage(image, xpos, ypos);
}
Which works fine, as per the first screen shot. However, when I scroll up, the component is hidden by the heading component, but the glass pane doesn't know that. How can I figure out whether I should render the image ?