用于JavaScript window.resizeTo的SWT监听器?

时间:2022-11-28 22:19:11

I'm working on an application that uses the SWT Browser widget to display an HTML page with some JavaScript in it. The JavaScript tries to use window.resizeTo to change the size of the window, but it currently isn't having any effect.

我正在开发一个使用SWT Browser小部件的应用程序来显示一个包含JavaScript的HTML页面。 JavaScript尝试使用window.resizeTo来更改窗口的大小,但它目前没有任何效果。

I've fiddled with the browser settings, and it doesn't seem to be an issue with the underlying browser; switching between Mozilla and Internet Explorer rendering engines has no effect. I suspect that SWT simply doesn't automatically re-size the window in response to JavaScript functions.

我已经摆弄了浏览器设置,它似乎不是底层浏览器的问题;在Mozilla和Internet Explorer渲染引擎之间切换没有任何效果。我怀疑SWT根本不会自动重新调整窗口大小以响应JavaScript函数。

I can easily re-size the window from my Java code, but I need to know when to re-size it, and how big JavaScript wants it to be. Does SWT provide a way to listen for this? If so, how?

我可以很容易地从我的Java代码重新调整窗口大小,但我需要知道何时重新调整它的大小,以及JavaScript想要它的大小。 SWT是否提供了一种倾听方式?如果是这样,怎么样?

1 个解决方案

#1


0  

I still don't know of any way to get this information, but a work-around is to change SWT versions. Some of them implement JavaScript's window.resizeTo automatically, and some of them do not.

我仍然不知道有任何方法可以获得这些信息,但解决方法是改变SWT版本。他们中的一些人自动实现了JavaScript的window.resizeTo,而其中一些则没有。

#1


0  

I still don't know of any way to get this information, but a work-around is to change SWT versions. Some of them implement JavaScript's window.resizeTo automatically, and some of them do not.

我仍然不知道有任何方法可以获得这些信息,但解决方法是改变SWT版本。他们中的一些人自动实现了JavaScript的window.resizeTo,而其中一些则没有。