在 JScrollPane 上滚动时渲染新的可见部分
我有一个嵌入 JScrollPane 中的大型 JPanel。当我移动滚动条时,我注意到可见部分不会自行渲染,并且出现故障。而当我调整框架大小时,我可以看到渲染的新可见部分。所以我需要知道在调整框架大小时会触发哪些方法来重新绘制视图。我应该使用什么监听器/方法?
I have a large JPanel embedded in a JScrollPane. When I move the scrollbar, I notice that the visible portion does not render itself and I get glitches. Whereas when I resize the frame, I can see the new visible portions rendered. So I need to know which methods are fired upon frame resize to repaint the view. What listeners/methods should I use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不需要知道这一点。您需要做的就是更改滚动条的值或视口的位置,并且组件应该正确地重新绘制自身。如果它没有正确绘制,那么你就有其他问题了。也许是
如果这些建议没有帮助,那么您需要发布正确的 SSCCE 这说明了问题,因为我们不能一直猜测你的代码在做什么。
You don't need to know that. All you need to do is change the value of the scrollbar or the position of viewport and the component should repaint itself properly. If it is not painting properly, then you have a problem with something else. Maybe
If those suggestsion doen't help then you need to post a proper SSCCE that demonstrates the problem because we can't keep guessing what your code is doing.
您重新验证了面板吗?
您的代码中可能存在某些问题。
我一直在使用大量卷轴,从未遇到过您所描述的问题。
也许显示问题的代码示例会很好。
祝你好运,博罗
Did you revalidate the panel?
It might be that something is not right in the code of yours.
I have been using lots of scrolls and never had an issue as you describe.
Maybe a code sample showing the problem would be nice.
Good luck, Boro