开发者

JScrollPane shows graphics glitches on row header. How to avoid this?

I'm trying to use a JScrollPane with a column header and a row header.

On the rowheader, there is some text. When I开发者_JAVA技巧 scroll down the pane, some graphics artifacts appear on the rowheader. It's like the bottom line of pixels is repeated once and again.

The problem is solved if I maximize and restore the main window, but it's not the way it should be.

Is there any way to avoid this?


I find that glitches like this are usually caused by custom paint() methods or not repainting after you make changes.

First, I always call as the first line in my custom paint method.

super.paint();  or  super.paintComponent(g);

I also find that these two lines keep everything fresh and up to date. They might be time consuming, but they have solved a lot of problems. I usually put them at the end of code that modifies the view.

this.validate();
this.repaint();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜