Call an applet in my Application

50 views
Skip to first unread message

IHateSoda

unread,
Aug 31, 2011, 3:07:42 PM8/31/11
to gwtai
Hello,

I need to browse folder in my application, so I want to use an applet
with JFileChooser, but I get this error :
Unable to load module entry point class

Source code:

Interface :

package com.dnd.client;

import com.google.gwt.gwtai.applet.client.Applet;
import com.google.gwt.gwtai.applet.client.Archive;
import com.google.gwt.gwtai.applet.client.ImplementingClass;
import com.google.gwt.gwtai.applet.client.Height;
import com.google.gwt.gwtai.applet.client.Width;

@ImplementingClass(com.dnd.impl.FileAppletImpl.class)
@Height("60")
@Width("350")
@Archive("GwtAI-Client.jar,GwtAI-Demo.jar")
public interface FileApplet extends Applet {

}


class :

package com.dnd.impl;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import com.dnd.client.FileApplet;

public class FileAppletImpl extends JApplet implements FileApplet{

public void init()
{
JButton b = new JButton( "File" );
b.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent ae )
{
JFileChooser jfc = new JFileChooser();
// limit the chooser only on folders

jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

// I retrieve the absolute path
String path = jfc.getSelectedFile().getAbsolutePath();
System.out.println("Selected path : " +
path);
}
});
getContentPane().add( b );
}
}

entrypoint :

public class Dnd implements EntryPoint {

/**
* @see com.google.gwt.core.client.EntryPoint#onModuleLoad()
*/
@Override
public void onModuleLoad() {
VerticalPanel panelMain = new VerticalPanel();



final FileApplet fp = (FileApplet)
GWT.create(FileApplet.class);



Widget widgetApplet = AppletJSUtil.createAppletWidget(fp);

panelMain.add(widgetApplet);

RootPanel.get().add(panelMain);
}
}

I added the module
<inherits name='com.google.gwt.gwtai.applet.AppletIntegration'/>

And I added on my classpath : GwtAI-Client-0.3.jar, GwtAI-Core-03.jar.

Thanks in advance.


Reply all
Reply to author
Forward
0 new messages