11.4. Interacting with the browser

Where you’d use JNI in Java to access operating system functions, you (or rather GWT) use JSNI to access the web browser. Luckily, the version of GWT you have provides most of this already, so you can use GWT Java classes and be oblivious that underneath they’re using JSNI and managing all the awkward browser differences for you:

  • Through the Window class (in com.google.gwt.user.client), you can raise alert and confirmation windows, open new browser windows, set browser titles, enable and disable window scrolling, and get all of the browser dimensions you could want. For example, Window.alert("hello"); pops up a JavaScript alert window containing the text hello.
  • The Window class also gives access to managing ...

Get GWT in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.