当我有这个课时,我怎么能手工创建一个JavaScriptObject
public class Person extends JavaScriptObject{
protected Person(){}
public final native String FirstName()/*-{
return this.firstName;
}-*/;
public final native String LastName()/*-{
return this.lastName;
}-*/;
}
Run Code Online (Sandbox Code Playgroud)
我问,因为我有一个这个JavaScriptObject庇隆的数组
public JsArray<Person> persons = JavaScriptObject.createArray().cast();
Run Code Online (Sandbox Code Playgroud)
我想用这些Person对象填充这个数组
Peson a = new Person();
a.setfirstName(textField1.getText());
a.setLastName(textField2.getText());
persons.push(a)
Run Code Online (Sandbox Code Playgroud)
但我不知道如何手工创建这样的对象.firstName和lastName的值将来自UI组件,如textField.请帮忙!
从今天开始,我收到了像昨天一样的相同代码的错误消息,但我没有改变任何内容.我收到此错误消息
[WARN] [perchsearch] - 从JSNI方法'@ com.google.gwt.dom.client.DOMImplStandardBase $ ClientRect :: getTop()'返回除int之外的其他内容:舍入double(178.40000915527344)到int for int
当我在浏览器上运行项目时,Chrome浏览器上会出现一个奇怪的grafic对象(因为firefox不存在我的版本的gwt插件),但我不知道怎么样,从哪里来.这是这个grafic的图片.
有什么解决方法我可以删除这个东西吗?它真的很烦人.
我正在使用带有m2e插件的Eclipse Juno.我通过Eclipse将我的java项目转换为maven项目
右键单击项目>转到菜单配置>转换为maven项目.
这些是错误:
Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-
plugin:2.3.2:compile (execution: default-compile, phase: compile)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-
plugin:2.3.2:testCompile (execution: default-testCompile, phase: test-compile)
- CoreException: Could not get the value for parameter compilerId for plugin execution default-
compile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of
its dependencies could not be resolved: The following artifacts could not be resolved:
org.codehaus.plexus:plexus-compiler-manager:jar:1.8.1, org.codehaus.plexus:plexus-compiler-javac:jar:1.8.1:
Failure to transfer org.codehaus.plexus:plexus-compiler-manager:jar:1.8.1 from http://repo.maven.apache.org/ …
Run Code Online (Sandbox Code Playgroud) 我真的不明白AttachEvent类或addAttachHandler是什么.这有用的是什么?有人可以为此发布一个例子吗?多谢.
我想知道rootPanel
(在entryClass中)究竟是什么,以及GWT如何通过rootpanel将Java代码加载到appname.html文件中.那到底发生了什么?rootpanel和HTML文件之间的连接在哪里?
我找不到任何能够详细解释这个过程的方面.如果有人可以解释它或发送一些很好的链接到解释这个问题的网站将是非常有帮助的.
我真的不明白PlaceTokenizer在做什么?他是否将场所的类名称转换为字符串,以便gwt历史记录机制可以使用它将其放入浏览器的url中?多数民众赞成在我的理解,但我不确定这是否是正确的。
我有一个从JPanel扩展的类A,它包含一个JScrollpanel.
SearchTapViewImpl extends JPanel implements SearchTapView {
SearchTapViewImpl(){
JPanel panel = new JPanel();
// ... add stuff to this panel
JScrollPane scrollPane = new JScrollPane(panel)
//create stuff
add(anotherPanel, BorderLayout.NORTH);
add(scrollpanel, BorderLayout.CENTER);
}
}
Run Code Online (Sandbox Code Playgroud)
现在我有一个从JPanel扩展的控制器类,它只添加了一个SearchTapViewImpl实例
public class SearchTapController extends JPanel{
view = new SearchTapViewImpl();
// stuff
add((Component)view, BorderLayout.NORTH);
}
Run Code Online (Sandbox Code Playgroud)
现在我有一个从JFrame扩展并包含JTabbedPane的类,当我添加一个SearchTapController实例时,它包含一个SearchTapViewImpl实例,滚动窗格不可见.相反,当我将SearchTapViewImpl添加到Jframe类时,滚动条是可见的.当我通过SearchTapController添加它时为什么不可见?
// NOT WORKING EXAMPLE
public class StartGUI extends JFrame {
tabbedPane = new JTabbedPane();
tabbedPane.addTab("Search", new SearchTapController() );
}
// WORKING EXAMPLE
public class StartGUI extends JFrame {
tabbedPane = new …
Run Code Online (Sandbox Code Playgroud) 我使用mgwt和phonegap为我的移动网络项目和iam使用eclipse.要在我的项目中使用phonegap,我需要为vm参数设置两个参数,这些参数将在下面描述.
http://code.google.com/p/gwt-phonegap/wiki/FileModule
这些是两个参数.-DinsecurePhoneGapFileApi =真
-DphonegapFilePath ="您要使用的目录的路径"
我真的不知道在哪里或如何添加这些参数.
请帮忙.
我有以下循环迭代数组,我尝试访问数组中当前位置的下一个位置.
for( var i in myArray){
var temp = myArray[i+1];
}
Run Code Online (Sandbox Code Playgroud)
问题是它没有添加1与var i,但它只是在i上添加数字1.就像我是2,我这样做
i+1
Run Code Online (Sandbox Code Playgroud)
结果是
21
Run Code Online (Sandbox Code Playgroud)
而不是3.
为什么这样,我怎么能添加这两个变量?
我有一个这样的侧面
<body>
<header>blabla</header>
<main> some content </main>
<footer>blabla</footer>
</body>
Run Code Online (Sandbox Code Playgroud)
我必须在标题下为主要内容的某些部分设置动画,
所以我在主要和页脚周围放置了一个 div 并将其用作锚点。
<body>
<header>blabla</header>
<div id="myId">
<main> some content </main>
<footer>blabla</footer>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)