我有一个 SWT shell,里面有一个 SWT 浏览器。在 OSX 上它工作正常,但在 Windows 上它坚持在 shell 或浏览器中放置一个禁用的垂直滚动条(我不知道是哪个!)。有没有办法强制小部件隐藏它们的滚动条?
当我在 shell 或浏览器上调用 getVerticalScrollBar() 或水平等效项时,我得到 null。那么有没有办法完全删除滚动条?
这是我的代码,没什么特别的:
this.shell = new Shell(this.display, SWT.CLOSE | SWT.MIN | SWT.MAX);
shell.addListener(SWT.Close, new Listener(){
public void handleEvent(Event event) {
event.doit = false;
location = shell.getLocation();
shell.setVisible(false);
}
});
shell.setSize(popUpSize);
shell.setMinimumSize(popUpSize);
if(this.location == null){
shell.setLocation(x, y);
}else{
shell.setLocation(this.location);
}
shell.setLayout(new FillLayout());
this.browser = new Browser(shell, SWT.NONE | SWT.SMOOTH);
有什么想法吗?
干杯
安迪
最佳答案
我对 SWT 浏览器对象也有类似的问题。我最终在我的 HTML 页面中使用了“overflow:hidden”CSS 样式,它告诉浏览器抑制滚动条并在页面太大无法容纳时将网页裁剪到浏览器窗口的边缘。
关于java - SWT 浏览器 - 禁用垂直滚动我如何隐藏它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3322556/