hello, I tried to reproduce an example of program (from the magazine "programmez", in french), using GWT, but there is an execution error, which I cannot understand, but I know which lines are involved.
the program deals with a list of pictures; which are displayed.There is a button "add" which allows to add a new picture, by entering its name, its url. the sample pictures are well displayed, but the error comes when I want to add a new picture; the dialog box stays displayed a few seconds and there is an error which makes the program stop. the error is : "Invalid memory access of location 00000010 eip=95d4e77b". here is the code. there are 3 classes : Miniature (which concern each picture), Formulaire (which manages the addition of picture), and test!1, the main classe. nothing really complicated. Miniature ****************************************************************** package test.client; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.VerticalPanel; public class Miniature extends Composite { VerticalPanel panel; Image miniature; Label label; public Miniature(String url, String titre){ miniature=new Image (url); label=new Label(titre); label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel = new VerticalPanel(); panel.add(miniature); panel.add(label); initWidget(panel); setHeight("80px"); setWidth("80px"); setStyleName("miniature-float"); } } ****************************************************************** Formulaire ****************************************************************** package test.client; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.*; public class Formulaire extends DialogBox { public TextBox saisieUrl = new TextBox(); public TextBox saisieTitre = new TextBox(); public Formulaire() { super(); setText("Ajouter une nouvelle image"); Grid grid=new Grid(3,2); grid.setWidget(0, 0, new Label("Url")); grid.setWidget(0, 1, saisieUrl); grid.setWidget(1, 0, new Label("Titre")); grid.setWidget(1, 1, saisieTitre); Button boutonAjouter = new Button("Ajouter"); grid.setWidget(2, 1, boutonAjouter); boutonAjouter.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Formulaire.this.hide(); } }); add(grid); center(); } } ****************************************************************** test_1 ****************************************************************** package test.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.event.logical.shared.CloseEvent; import com.google.gwt.event.logical.shared.CloseHandler; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.DialogBox; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.PopupPanel; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.VerticalPanel; /** * Entry point classes define <code>onModuleLoad()</code>. */ public class Test_1 implements EntryPoint, ClickHandler, CloseHandler<PopupPanel> { private FlowPanel liste; private Button boutonAjouter; /** * This is the entry point method. */ public void onModuleLoad() { VerticalPanel verticalPanel = new VerticalPanel(); liste = new FlowPanel(); liste.add(new Miniature("http://www.programmez.com/img/magazines/ couverture_119.jpg", "Mai 2009")); liste.add(new Miniature("http://www.programmez.com/img/magazines/ couverture_120.jpg", "Juin 2009")); boutonAjouter = new Button("Ajouter"); boutonAjouter.addClickHandler(this); verticalPanel.add(liste); verticalPanel.add(boutonAjouter); RootPanel.get().add(verticalPanel); } public void onClick(ClickEvent event){ if (event.getSource()==boutonAjouter){ //liste.add(new Miniature("http://www.programmez.com/img/magazines/ couverture_121.jpg", "Juillet 2009")); Formulaire fenetreAjout = new Formulaire(); fenetreAjout.addCloseHandler(this); fenetreAjout.show(); } } public void onClose(CloseEvent<PopupPanel> event){ Formulaire fenetreAjout = (Formulaire) event.getTarget(); if (fenetreAjout != null){ String url=fenetreAjout.saisieUrl.getText(); String titre=fenetreAjout.saisieTitre.getText(); if (url.length() != 0){ liste.add(new Miniature(url, titre)); } } } } ****************************************************************** the error comes from the method onClick in the previous class, because if I replace the lines in this method by the commented one, the error is no more here (but the comportment of the method is changed). I use eclipse 3.5, I downloaded GWT via the update site (so the version is the last one), and in macosx the java version is 6 which support the 64 bit processors. can you help me? or tell me that the program has no bugs? olivier. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=.