Note that there are some explanatory texts on larger screens.

plurals
  1. POCall Java from JavaScript gwt
    primarykey
    data
    text
    <p>Hi I have the following strange issue:</p> <p>I have gwt application. it contains 3 image widgets and a button. on Button click I am calling function X() and then inside X I am calling Test(testscan instance) by passing instance to the Javascript function. </p> <p>now take a look at Test function. I am trying to call Java function named "updateImageContent" from there.The syntax written according GWT documentation. </p> <p>When I run the application the instance of "testscan" class is Null what can be the reason?</p> <pre><code>public class testscan implements EntryPoint { private Image image_0 = new Image("home.gif"); public void onModuleLoad() { RootPanel rootPanel = RootPanel.get("main_panel"); rootPanel.getElement().getStyle().setPosition(Position.RELATIVE); VerticalPanel verticalPanel = new VerticalPanel(); rootPanel.add(verticalPanel, 5, 5); verticalPanel.setSize("100%", "100%"); HorizontalPanel horizontalPanel = new HorizontalPanel(); verticalPanel.add(horizontalPanel); horizontalPanel.setSize("100%", "100%"); Image image_1 = new Image("home.gif"); horizontalPanel.add(image_1); image_1.setSize("180px", "180px"); horizontalPanel.add(image_0); image_0.setSize("180px", "180px"); Image image_2 = new Image("home.gif"); horizontalPanel.add(image_2); image_2.setSize("180px", "180px"); Button btnScan = new Button("Scan"); verticalPanel.add(btnScan); btnScan.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { x(); } }); } public void x() { Test(this); } public native void Test(testscan instance) /*-{ instance.@com.sflpro.testscan.client.testscan::updateImageContent()(); }-*/; public void updateImageContent() { Window.alert("ok"); //String s = scanFileContent(); //Window.alert(s); if(image_0==null) Window.alert("bad"); else Window.alert("good"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload