我正在使用GwtAI
(Gwt Applet Integration)开发一个演示应用程序。我已经包含了所有的GwtAI-client.jar,GwtAI-core.jar
。我指的是http://code.google.com/p/gwtai/wiki/GettingStarted以下是代码。
FileUploadingApplet.class
@ImplementingClass(com.nextenders.appletImpl.FileUploadingAppletImpl.class)
@Height("60")
@Width("350")
@Archive("GwtAI-Client.jar,FileUploadingAppletImpl.jar")
@Codebase("applet")
public interface FileUploadingApplet extends Applet{
public void increment();
public void decrement();
public Object getCurrentValue();
}
FileUploadingAppletImpl.class
public class FileUploadingAppletImpl extends JApplet implements FileUploadingApplet {
JTextField m_fileNameTF = new JTextField(15);
String controlTransactionId = "";
JFileChooser m_fileChooser = new JFileChooser();
JPanel content = new JPanel();
FileWriter fstream = null;
long fileLength = 0l;
@Override
public void init() {
JPanel panelMain = new JPanel();
m_fileNameTF = new JTextField(20);
m_fileNameTF.setHorizontalAlignment(JTextField.CENTER);
m_fileNameTF.setText("0");
m_fileNameTF.setEditable(false);
panelMain.add(new JLabel("Current count : "));
panelMain.add(m_fileNameTF);
panelMain.setBorder(BorderFactory.createTitledBorder("CounterApplet"));
panelMain.setBackground(Color.WHITE);
getContentPane().add(panelMain);
}
public void increment() {
int currentCount = Integer.parseInt(m_fileNameTF.getText());
currentCount++;
m_fileNameTF.setText(currentCount + "");
}
public void decrement() {
int currentCount = Integer.parseInt(m_fileNameTF.getText());
currentCount--;
m_fileNameTF.setText(currentCount + "");
}
public Object getCurrentValue() {
return m_fileNameTF.getText();
}
}
NTFileUpload.java
private void createPanel(){
PopupPanel panel = new PopupPanel();
panel.setPopupPosition(500, 500);
panel.setHeight("600px");
panel.setHeight("900px");
final FileUploadingApplet fileUploadApplet = (FileUploadingApplet) GWT.create(FileUploadingApplet.class);
VerticalPanel panelMain = new VerticalPanel();
Button buttonInc = new Button("Increment");
buttonInc.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
fileUploadApplet.increment();
}
});
Widget widgetApplet = AppletJSUtil.createAppletWidget(fileUploadApplet);
panelMain.add(widgetApplet);
panelMain.add(buttonInc);
panel.add(panelMain);
panel.show();
}
我按照链接遵循了包结构。但我正在关注异常。
java.lang.IncompatibleClassChangeError: Found interface com.google.gwt.core.ext.typeinfo.JClassType, but class was expected
at com.google.gwt.gwtai.applet.generator.AppletProxyGenerator.generate(AppletProxyGenerator.java:71)
at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:647)
at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:268)
at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:257)
at com.google.gwt.dev.DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(DistillerRebindPermutationOracle.java:91)
at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds(WebModeCompilerFrontEnd.java:96)
at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.process(AbstractCompiler.java:254)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:173)
at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:288)
at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.access$400(AbstractCompiler.java:139)
at com.google.gwt.dev.jdt.AbstractCompiler.compile(AbstractCompiler.java:588)
at com.google.gwt.dev.jdt.BasicWebModeCompiler.getCompilationUnitDeclarations(BasicWebModeCompiler.java:97)
at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.getCompilationUnitDeclarations(WebModeCompilerFrontEnd.java:52)
at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:569)
at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:33)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:284)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:233)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
at com.google.gwt.dev.Compiler.run(Compiler.java:232)
at com.google.gwt.dev.Compiler.run(Compiler.java:198)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
at com.google.gwt.dev.Compiler.main(Compiler.java:177)
提前致谢。