如何创建可滚动的二维对象
我正在构建一个模拟,并有一个我想要显示并且能够滚动的地图,但是我尝试过的每种方法(ScrollPane、JScrollPane、Component)都失败了。滚动条要么显示但不起作用,要么根本不显示。我已经用谷歌搜索了这个问题,但没有找到可行的解决方案,有谁知道如何使 java 2d 对象可滚动吗?先感谢您!
谢谢大家弄清楚了,因为这是一个愚蠢的错误!哈哈
I am building a simulation and have a map that i want displayed and to be able to be scrollable however every approach I have tried (ScrollPane, JScrollPane, Component) has failed. Either the scroll bars show up and do not function or do not show up at all. I have googled this to death and have not find a viable solution, does any know how to make a java 2d object scrollable? Thank you in advance!
Thanks guys figured it out, as it was a stupid mistake! lol
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Swing 教程有解释和示例: http://download.oracle .com/javase/tutorial/uiswing/components/scrollpane.html#scrollable
您的组件必须实现
Scrollable
接口。The Swing tutorial has explanations and examples : http://download.oracle.com/javase/tutorial/uiswing/components/scrollpane.html#scrollable
Your component must implement the
Scrollable
interface.