删除AWT中的容器(ScrollPane)边框
我正在寻找一种解决方案来删除 AWT ScrollPane 中的默认边框。
在 JScrollPane 中它相当简单..
paneScrollPane.setBorder(BorderFactory.createEmptyBorder());
或者
paneScrollPane.setBorder(null);
只是想知道 ScrollPane 是否可以达到相同的效果
I was looking for a solution to remove default border in AWT ScrollPane.
In JScrollPane its rather simple..
paneScrollPane.setBorder(BorderFactory.createEmptyBorder());
or
paneScrollPane.setBorder(null);
Just wanted to know can we achieve the same effect in case of ScrollPane
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可能是不可能的。
AWT
的主要缺点之一是您无法实际绘制或自定义AWT
组件的视图。我可能提出的唯一建议是,您可以尝试在 ScrollPanel 周围创建在边框上绘制的画布。
This probably is not possible. One of the main drawbacks of
AWT
was that you can't actually draw over or customize the view of yourAWT
component.The only recommendation I might make would be that you could try creating Canvases around your ScrollPanel that draw over the border.
您可以使用此方法:
我从类 javax.swing.plaf.synth.SynthScrollPaneUI 获取了以下信息:
You could use this method:
I got this information from class javax.swing.plaf.synth.SynthScrollPaneUI:
这是不可能的,因为
AWT
实现了外观和感觉
,并且强烈基于来自本机操作系统(主题
)的方法,Border 仅针对Swing JComponents 实现,
that not possible because
AWT
implementsLook and Feel
and is strongly based on methods that came from Native OS (Themes
), Border are implemented just forSwing JComponents
,