简体   繁体   English

将JavaScript面板添加到GWT面板

[英]Adding JavaScript panel into GWT panel

I want to add an external JavaScript file that contains a colored panel and one button into a GWT panel. 我想在GWT面板中添加一个包含彩色面板和一个按钮的外部JavaScript文件。 Anyone can help me? 有人可以帮助我吗?

您可以使用GWT中的按钮创建面板,在该面板上设置您的本机JavaScript代码所需的ID,然后使用JSNI执行本机JavaScript方法

If you need to invoke a function in an imported javascript file ( library ). 如果您需要在导入的javascript文件(库)中调用函数。

Step 1 - You would need to load the js file via your module gwt xml file with tag <script src="thirparty.js" /> 第1步-您需要通过标签为<script src="thirparty.js" />模块gwt xml文件加载js文件

Step 2 - Use JSNI to get element (panel) from imported thirdparty lib. 第2步-使用JSNI从导入的第三方库中获取元素(面板)。 Create a div or use innerhtml and set it to the GWT panel. 创建一个div或使用innerhtml并将其设置为GWT面板。

If you are trying to find a third party color picker - 如果您要查找第三方颜色选择器-

http://www.auroris.net/gwt/colorpicker/
http://code.google.com/p/auroris/

No i can't create button with gwt 不,我无法使用gwt创建按钮

I only can create a empty panel in gwt and i add over a javascript panel. 我只能在gwt中创建一个空面板,然后在javascript面板上添加一个面板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM