Re: JScrollBar Repaint Question




"mearvk" <mearvk@xxxxxxxxx> wrote in message
news:1166802036.257503.141510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
For some reason the JScrollBar keeps setting its value to 3...

So if I subclass JScrollBar (see code) and trap for this anomaly, I
have kludged success.
The call to JScrollBar's paint (in case it is pertinent) is coming via
a repaint() call to a JDesktopPane. The JDesktopPane calls the
JInternalFrame which call its subcomponents (of which the JScrollBar is
a member). This is my understanding of the situation, at least..

public void paint(Graphics g)

{

int curVal=super.getValue();

if(curVal==3)
{
super.setValue(lastGoodValue);
}
else
{
lastGoodValue=curVal;
}

System.out.println("Painting with "+super.getValue());
super.paint(g);

}

So, of course, I am left to wonder why this is happening.

Any thoughts?

Post an SSCCE demonstrating the problem:
http://mindprod.com/jgloss/sscce.html

- Oliver


.